Web.debug.config Conversion does not work

I don't know what I'm doing wrong, but I almost feel like I tried everything. I cannot force my project's web.config to convert with changes to web.debug.config. I read somewhere that transformation only happens when published. Then I read that SlowCheetah can handle this, so I installed it in my project. It also does not matter.

Launch of VS 2012 Express. I am debugging using the local IIS Express server that VS has installed. I am running Firefox as my browser.

web.config:

<appSettings> <add key="SiteUrl" value="http://development.mysite.com/" /> </appSettings> 

web.debug.config:

 <appSettings> <add key="SiteUrl" value="http://localhost:4652/" xdt:Transform="SetAttributes" xdt:Locator="Match(key)" /> </appSettings> 

I also tried using Replace:

 <appSettings> <add key="SiteUrl" value="http://localhost:4652/" xdt:Transform="Replace" xdt:Locator="Match(key)" /> </appSettings> 

When running in the debug configuration locally:

 string siteurl = ConfigurationManager.AppSettings["SiteUrl"]; 

Still the result of aturl http://development.mysite.com/

I started Preview Transform by right-clicking on web.debug.config and it shows that the conversion is doing fine, but not when I launch the web application locally.

Frankly, I do not see how to configure SlowCheetah. I see no way to configure it, and I thought that it could "something" on its own .: S

Does anyone know how to overcome this or if I do something wrong?

+4
source share
1 answer

I suggest ignoring the slow cheetah for now, because I don’t think you need it. I used it to develop Windows Forms, but did not need web development. Instead, use the standard one-click Web site deployment engine and rethink how you use configuration conversions.

Basically, use only conversions when publishing, and instead of localizing localization settings in your main Web.config instead of conversions.

  • Then, if you have the lab / test / sandbox environment that you want to publish to , create a solution and project configuration for this environment.

Adding a new solution configuration in Configuration Manager

  1. Next, right-click on Web.config and click on “Add Config Transform” to add the configuration transformation for the configuration of the solution you just created.

Adding a config transform

  1. Suppose you add a Sandbox solution configuration. In this case, a new file called Web.Sandbox.config appears in Solution Explorer. Go ahead and update the values ​​in Web.config and Web.Sandbox.config like this.

Web.config:

 <appSettings> <add key="SiteUrl" value="http://localhost:4652/" /> </appSettings> 

Web.Sandbox.config:

 <appSettings> <add key="SiteUrl" value="http://sandbox.mysite.com/" xdt:Transform="SetAttributes" xdt:Locator="Match(key)" /> </appSettings> 
  1. Finally, you need to create "sandbox.mysite.com" (or whatever your URL) to publish the profile and make sure that its Configuration is a sandbox so that Web.Sandbox.config transform is used during publication.

Selecting the Sandbox Configuration in the Publish Web dialog

0
source

Source: https://habr.com/ru/post/1497696/


All Articles