Web.Live.Config:
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an attribute "name" that has a value of "MyDB".
-->
<appSettings>
<add key="ClaimPackPath" value="C:\\inetpub\\wwwroot\\Application\\ClaimPacks\\" xdt:Locator="Match(key)" xdt:Transform="Replace" />
</appSettings>
</configuration>
Wg.Debug.Config:
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an attribute "name" that has a value of "MyDB".
-->
<appSettings>
<add key="ClaimPackPath" value="C:\\Debug\\wwwroot\\Application\\ClaimPacks\\" xdt:Locator="Match(key)" xdt:Transform="Replace" />
</appSettings>
</configuration>
dann in der Anwendung können Sie die Variable anfordern, wie so:
string filepath = ConfigurationManager.AppSettings["ClaimPackPath"];
Und es wird für was auch immer Sie bei der Auswahl publish ändern Profil veröffentlichen :)
Haben Sie sich in Profilen veröffentlichen? –
Ich habe einige über sie gelesen, wenn das tut, werde ich tiefer graben – mreinsmith
Sie sind sehr gut für mehrere Release-Umgebungen. Ich gebe Ihnen einen Ausschnitt davon, wie wir Publizierungsprofile verwenden, um Variablen in einer Antwort unter –