ASP.NET Web.config transformation won't work in installer

前端 未结 3 1612
耶瑟儿~
耶瑟儿~ 2021-02-15 00:22

I am working on an ASP.NET project in Visual Studio .NET 2010 and attempting to make an MSI installer using a Web Setup Project. I added the Primary output from the project (wh

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-15 01:13

    I found a workaround that works for me:

    1. Create needed configurations (Dev,QA,Production etc.) and associated web config transformations.

    2. Use notepad or other text editor and include following in your web application project file (.csproj file) before tag (near the end of the project file):

      
        
      
      

      Do not include Web.Transformed.config in the web application project - if you do visual studio will alert you about the changes after every build which is pretty annoying.

    3. In the web setup project: select Content files - > Exclude Filter and add Web.config (and all other Web.*.config files containing transformation rules).

    4. In the web setup project: select file system editor icon -> web application folder -> Add File and select Web.Transformed.config in the root of your web application project folder.

    5. In the same screen: right click Web.Transformed.config and rename it to Web.config

    Now you are able to generate .msi files with selected configuration and root web.config file is transformed! Please note that this does not affect web.config files in the sub folders.

提交回复
热议问题