Hi,
Thanks for the reply,
set with -p name=value on the dotnet publish command line.
My bad, I forgot to write in the original post: I use Visual Studio enterprise 2019, I want visual studio 2019 to manage the process.
However thanks to your reference to dotnet publish I found i can set an arbitrary value for the environment name directly in the publish profile and ignore the default of the server.
For everyone like me use Visual Studio 2019 is possible to edit the *.pubxml file.
Inside the element Propertygroup add an element called "EnvironmentName".
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<!-- other property you normally found... -->
<EnvironmentName>StagingDev</EnvironmentName> <----- this
</PropertyGroup>
</Project>
When you publish the application will read appsettings.StagingDev.json. Substitute StagingDev with whatever you want.
Bye.