I have an asp.net core app. I run the publish with the azure devops task :
dotnet restore
dotnet build
and finally
dotnet publish --configuration $(BuildConfiguration) --output
$(build.artifactstagingdirectory)
The artifact can be a zip file, or not.
The result of the artifact is all dll, web.config, ...
Ok, that was the build part.
Now, I want to do the relase part and deploy to IIS staging and IIS production.
I can see in the documentation that web deploy is the recommend way https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.2#deploy-the-app
But :
- dotnet publish don't create a web deploy package
- I need to change the tag in web.config to have
:
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Staging" />
</environmentVariables>
for staging and
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" />
</environmentVariables>
for production (note that I can't use env variables because the server can be the same for some environements)
So, how can I do proper release ?