I have web.config with these two env variables that i need to remove see below web.config ..
web.config
<aspNetCore processPath=".\Widgets.API.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess">
<environmentVariables>
<environmentVariable name="COMPLUS_ForceENC" value="1" />
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
<environmentVariable name="CORECLR_ENABLE_PROFILING" value="1" />
I am trying to remove those variables using
web.Release.config
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<location>
<system.webServer>
<aspNetCore>
<!--remove the environment vars section in Release mode-->
<!--
Why? Because .NET Core has a bug where it adds environmentVariables section
during the build with the environment set as Development..
This obviously fails in production, which is why we remove it during
release.
-->
<environmentVariable name="COMPLUS_ForceENC" value="1" xdt:Transform="Remove" />
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" xdt:Transform="Remove" />
</aspNetCore>
</system.webServer>
</location>
</configuration>
Could not transform the file 'D:\Octopus\Applications\Widgets\XW QA\WidgetsAPI\2019.9.5_2\web.config' using the pattern 'web.Release.config'.
Using below i was able to resolve the issue.
<environmentVariables>
<environmentVariable name="COMPLUS_ForceENC" value="1" xdt:Transform="Remove" xdt:Locator="Match(name)"/>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" xdt:Transform="Remove" xdt:Locator="Match(name)"/>
</environmentVariables>