Hi @Donald Symmons ,
In one of the articles, I read a line where it is stated that Visual Studio can automatically do the necessary changes when we use the publish tool from VS, please, is that true?
This is true.
There are two ways to automate the process of changing Web.config file settings: Web.config transformations and Web Deploy parameters.
After creating a publish profile and deploying the database, you can configure the publish profile transformation.
There are detailed steps to deploy to production environment in the document. You can also try deploying to a test environment first.
ASP.NET Web Deployment using Visual Studio: Deploying to Production
ASP.NET Web Deployment using Visual Studio: Deploying to Test
Configure the Publish Profile Transformation Steps:
- In Solution Explorer, expand Properties, expand PublishProfiles.
- Right-click CustomProfile.pubxml and rename it Test.pubxml.
- Right-click Test.pubxml. Select Add Config Transform.(Visual Studio creates the Web.Test.config transform file and opens it.)
- In the Web.Test.config transform file, insert the following code immediately after the opening configuration tag.
<appSettings> <add key="Environment" value="Test" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/> </appSettings> - Save and close the file.
- Right-click the Web.Test.config file and select Preview Transform to make sure that the transform you coded produces the expected changes. The Web.config Preview window shows the result of applying both the Web.Release.config transforms and the Web.Test.config transforms.
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.