Difference between revisions of "AppCmd command to change Environment Variable"
From Logic Wiki
| (One intermediate revision by the same user not shown) | |||
| Line 5: | Line 5: | ||
in TFS just write | in TFS just write | ||
set config "<SITENAME>" -section:system.webServer/aspNetCore /+"environmentVariables.[name='ASPNETCORE_ENVIRONMENT',value='<VARIABLEVALUE>']" /commit:site | set config "<SITENAME>" -section:system.webServer/aspNetCore /+"environmentVariables.[name='ASPNETCORE_ENVIRONMENT',value='<VARIABLEVALUE>']" /commit:site | ||
| + | |||
| + | |||
| + | The commit parameter can be set to one of the following: | ||
| + | |||
| + | * (omitted) — default; write configuration at the level for which it is set | ||
| + | * url — same as default; write configuration at the level for which it is set | ||
| + | * site — write configuration in the Web.config at the site root of the url for which it is set | ||
| + | * app — write configuration in the Web.config at the app root of the url for which it is set | ||
| + | * apphost — write configuration at the server level, in the applicationHost.config file | ||
| + | * <PATH> — write configuration at the specified config path | ||
| + | == Batch File == | ||
| + | set arg1=%1 | ||
| + | set arg2=%2 | ||
| + | %systemroot%\system32\inetsrv\appcmd.exe set config "%arg1%" -section:system.webServer/aspNetCore /+"environmentVariables.[name='ASPNETCORE_ENVIRONMENT',value='%arg2%']" /commit:site | ||
| + | |||
| + | it gets 2 arguements. SiteName and Environment | ||
| + | |||
| + | in TFS if we add "Batch Script" Task in release, we can set it like this : | ||
| + | * Path : D:\web\Scripts\EnvSet.bat | ||
| + | * Arguments : CDTestSite Live | ||
Latest revision as of 11:31, 19 November 2018
%systemroot%\system32\inetsrv\appcmd.exe set config "<SITENAME>" -section:system.webServer/aspNetCore /+"environmentVariables.[name='ASPNETCORE_ENVIRONMENT',value='<VARIABLEVALUE>']" /commit:site
in TFS just write
set config "<SITENAME>" -section:system.webServer/aspNetCore /+"environmentVariables.[name='ASPNETCORE_ENVIRONMENT',value='<VARIABLEVALUE>']" /commit:site
The commit parameter can be set to one of the following:
- (omitted) — default; write configuration at the level for which it is set
- url — same as default; write configuration at the level for which it is set
- site — write configuration in the Web.config at the site root of the url for which it is set
- app — write configuration in the Web.config at the app root of the url for which it is set
- apphost — write configuration at the server level, in the applicationHost.config file
- <PATH> — write configuration at the specified config path
Batch File
set arg1=%1 set arg2=%2 %systemroot%\system32\inetsrv\appcmd.exe set config "%arg1%" -section:system.webServer/aspNetCore /+"environmentVariables.[name='ASPNETCORE_ENVIRONMENT',value='%arg2%']" /commit:site
it gets 2 arguements. SiteName and Environment
in TFS if we add "Batch Script" Task in release, we can set it like this :
- Path : D:\web\Scripts\EnvSet.bat
- Arguments : CDTestSite Live