tag:help.appveyor.com,2012-11-13:/discussions/questions/59543-deploying-aspnet-core-6-to-environment-with-appsettings-transformAppVeyor: Discussion 2022-09-13T18:20:53Ztag:help.appveyor.com,2012-11-13:Comment/556842122022-09-09T14:12:13Z2022-09-09T14:12:13ZDeploying asp.net core 6 to environment with appsettings transform<div><p>Hi Peter,</p>
<p>Could you please confirm where is ASP.NET 4.6 app currently hosted and what method do you use to deploy it? Where is ASP.NET Core 6 app going to be hosted?</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/556842122022-09-09T14:41:31Z2022-09-09T14:41:31ZDeploying asp.net core 6 to environment with appsettings transform<div><p>Both are/were hosted by IIS on a VM in Google Cloud. I've installed the ASP.NET Core 6 Hosting bundle. I actually manually changed the appsettings.json file and then I can load the site. But of course, I want AppVeyor to change the appsettings.json file for me, so it happens on every deploy, and per environment.</p></div>peter.morliontag:help.appveyor.com,2012-11-13:Comment/556842122022-09-09T14:47:49Z2022-09-09T14:47:49ZDeploying asp.net core 6 to environment with appsettings transform<div><p>OK, do you use WebDeploy to deploy the app to that VM?</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/556842122022-09-12T14:32:19Z2022-09-12T14:32:19ZDeploying asp.net core 6 to environment with appsettings transform<div><p>Hi Feodor, sorry for the late reply and for forgetting to mention it. Yes, I'm using WebDeploy to deploy to the server.</p></div>peter.morliontag:help.appveyor.com,2012-11-13:Comment/556842122022-09-12T17:16:11Z2022-09-12T17:16:11ZDeploying asp.net core 6 to environment with appsettings transform<div><p>OK, so WebDeploy can't change <code>appsettings.json</code> during the deployment. However, as you're fully controlling the target server and IIS is used you can look into using of AppVeyor Deployment Agent: <a href="https://www.appveyor.com/docs/deployment/agent/">https://www.appveyor.com/docs/deployment/agent/</a>. With deployment agent you can have <code>deploy.ps1</code> changing <code>appsettings.json</code>. Let me know what you think.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/556842122022-09-13T18:19:45Z2022-09-13T18:19:45ZDeploying asp.net core 6 to environment with appsettings transform<div><p>Thank you! By combining the AppVeyor Deployment Agent docs with this script (<a href="https://gist.github.com/eivindivine/83cbfbf2efb97575ec7c1268459a05a0#file-gistfile1-txt">https://gist.github.com/eivindivine/83cbfbf2efb97575ec7c1268459a05a...</a>) I was able to do what I wanted.</p></div>peter.morlion