I have a solution with Web Site project. There are three custom Solution configuration: Dev, Test, Prod. However, Web Site project doesn't have .csproj file and there is no way(or I can't find it out) to use configurations for Web Site project. I'm using MSBuild to build the solution:
MSBuild.exe MySolution.sln /m /p:Platform=x86;TargetFrameworkVersion=v4.6.2;OutputPath=bin;Configuration=Dev /ToolsVersion:14.0
As .sln file doesn't have any information about my Dev configuration for Web Site project, there are only Debug and Release "sections":
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Web", "Web\", "{1F81A0DB-6FF4-4F89-B988-6D327797C4FD}"
ProjectSection(WebsiteProperties) = preProject
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.6.2"
ProjectReferences = "{12A625AA-8B5A-4336-AA4A-3630AAB3A27D}|MyLib.dll;"
Debug.AspNetCompiler.VirtualPath = "/localhost_54141"
Debug.AspNetCompiler.PhysicalPath = "Web\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_54141\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/localhost_54141"
Release.AspNetCompiler.PhysicalPath = "Web\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_54141\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
VWDPort = "54141"
SlnRelativePath = "Web\"
StartServerOnDebug = "false"
EndProjectSection
EndProject
And Web Site is not being built.
OK, I can manually edit solution file and change/add Dev.XXXX, Test.XXX etc related settings and everything is working well until you open solution in Visual Studio and save it. Visual Studio discharges all your changes and you are faced with the same problem again.
As a workaround, I can create a copy of .sln file and manually synchronize it with the original solution. Does anybody have a better idea?