Reputation: 2553
My dotNetCore 6 webapi webservice is hosted on an internal IIS webserver. The web.config has two transforms web.Debug.config and web.Release.config. The web.config is:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="bin\Debug\net6.0\SMARTapi.exe" arguments="" stdoutLogEnabled="false" hostingModel="InProcess">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="development" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</location>
</configuration>
The web.Release.config is:
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<location>
<system.webServer>
<aspNetCore>
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="production" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</environmentVariables>
</aspNetCore>
</system.webServer>
</location>
</configuration>
When I Publish using the Release profile I do not get the transformed web.config. I get the three separate files web.config, web.Debug.config and web.Release.config. I suspect because of this I also get three appsettings files. These are appsettings.json, appsettings.development.json and appsettings.production.json. I think I should only be getting appsettings.json and appsettings.production.json or just the one which would be a combination of appsettings.json and appsettings.production.json.
Q: Why is my transform not working? and once transform is fixed will appsettings get fixed?
Upvotes: 0
Views: 238