visual-studiomsbuildbuild-automationprojects-and-solutionsaspnet-compiler

Why Visual Studio doesn't add AspNetCompiler settings in solution file for configurations different from standard (Release/Debug)?


I have 3 build configurations for my solution: Release, Debug, and Custom. Also I have WebSite (yes, not a WebApplication) project type. By default, when you create WebSite VisualStudio 2008 adds to the solution file following sections:

Debug.AspNetCompiler.VirtualPath = "/MyWebSite"
Debug.AspNetCompiler.PhysicalPath = "MyWebSite\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\MyWebSite\"
Debug.AspNetCompiler.Updateable = "false"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/MyWebSite"
Release.AspNetCompiler.PhysicalPath = "MyWebSite\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\MyWebSite\"
Release.AspNetCompiler.Updateable = "false"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
SlnRelativePath = "\MyWebSite\"

This configuration is used by MSBuild to precompile/publish WebSite. As you can see here is no configuration for my "Custom" build configuration, only for "Release" and "Debug". So when I am trying to build solution with MSBuild and with "Custom" build configuration WebSite simply don't get compiled.

But, when I manually add following lines in solution file everything works as expected. :

Custom.AspNetCompiler.VirtualPath = "/MyWebSite"
Custom.AspNetCompiler.PhysicalPath = "MyWebSIte\"
Custom.AspNetCompiler.TargetPath = "PrecompiledWeb\MyWebSite\"
Custom.AspNetCompiler.Updateable = "false"
Custom.AspNetCompiler.ForceOverwrite = "true"
Custom.AspNetCompiler.FixedNames = "false"
Custom.AspNetCompiler.Debug = "True"

I think that this is a bug in VisualStudio 2008 (I've checked this in 2010). The problem is that when VisualStudio 2008 will modify solution file (e.g. in case of adding a new project) my manually added lines will be removed. Maybe I should submit a bug somewhere to Microsoft VS development team?

If anyone else had the same problem and had any suggestions how to solve it? Thanks!


Solution

  • There is no official way of doing this.