2012-03-19 27 views
1

我創建了一個的parameters.xml並驗證了XPath的工作原理與在線工具的web.config文件http://www.xpathtester.com/網絡部署的parameters.xml設置不使他們的方式進入

<?xml version="1.0" encoding="utf-8" ?> 
<parameters> 
    <parameter name="Website URL" description="Please provide the base web address for the external part of the application" defaultValue="https://someOtherSite.com"> 
    <paramterEntry kind="XmlFile" scope="\\web.config$" match="/configuration/appSettings/add[@key='ExternalSiteBaseUrl']/@value" /> 
    </parameter> 
    <parameter name="Authentication Service URL" description="Please provide the web address for the authentication service" defaultValue="http://someOtherSite.com/auth"> 
    <paramterEntry kind="XmlFile" scope="\\web.config$" match="/configuration/appSettings/add[@key='AuthServiceAddress']/@value" /> 
    </parameter> 
</parameters> 

當我導入的zip通過IIS文件我到達設置頁面的連接字符串,並且這兩個選項按預期方式顯示。不管我將價值觀設置爲什麼,他們都被忽略了。 web.config中的值保持不變。連接字符串更改但是應用。在隨後彈出的摘要中,有幾行表示連接字符串在範圍內,但沒有任何與這兩個值相關的內容。我錯過了一個步驟嗎?

回答

1

所以神奇的答案是,在這裏聲明的範圍將發現第一個web.config恰好是我的MVC網站中的一個區域。因爲參數不存在,所以它跳過並像往常一樣繼續

+0

那麼,你還記得你是如何解決這個問題的?我現在遇到同樣的問題。另外,您是否知道是否有辦法從VS-2015發佈wizzard中獲取自動生成的SetParameters.xml文件中包含的這類參數。 (就像現在這樣,每次發佈時都會覆蓋它,而我的自定義參數丟失。) – Gertsen 2016-05-30 09:10:15

+0

嗯,好像我錯過了「/ @ value」部分,解釋了爲什麼沒有添加該值。現在使用類似於你的例子的代碼,只是在'web.config $'前沒有'\\'。我還在''元素上添加了'。 – Gertsen 2016-05-30 09:58:21

+0

另外,關於如何將這個問題帶入發佈嚮導生成的結果中,我發現我可以在解決方案中將''元素添加到此文件中:'/obj/Release/CSAutoParameterize.parameters。 xml' - 它會自動添加到' .SetParameters.xml'文件中作爲''元素。在這種情況下,我建議在CSAutoParameterize.parameters.xml文件中將缺省值留空,並在發佈後將值添加到' .SetParameters.xml'文件中。這樣更靈活。 – Gertsen 2016-05-30 10:01:49

相關問題