0

는 응용 프로그램이비주얼 스튜디오 2015 - 시간의 설정 변경 또는 변수 게시

을 게시하거나에 대해 다음 IF를 실행하는 조건의 어떤 종류가있을 때 설정 또는 변수를 변경할 수 있습니까?

예를 들어, 내가 게시하고 내가 게시 할 때 내가 자주 변경하는 것을 잊지 때 로그 파일이 기록되는 방식을 변경하려면 그것을

+0

게시 프로파일을 사용해 보았습니까? –

+0

나는 그들에 대해 좀 읽었는데, 그렇게한다면 더 깊게 파고들 것이다. – mreinsmith

+0

여러개의 릴리즈 환경을 가지고있는 것이 좋다. 우리가 게시 프로파일을 사용하여 답변의 변수를 변경하는 방법을 알려주세요. –

답변

1

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> 

그런 다음 응용 프로그램에서 당신과 같이 변수를 요청할 수 있습니다

string filepath = ConfigurationManager.AppSettings["ClaimPackPath"]; 

게시 할 때 선택한 게시 프로파일에 따라 변경됩니다.