0
我有一個網站項目解決方案。有三種自定義解決方案配置:Dev,Test,Prod。但是,網站項目沒有.csproj文件,並且沒有辦法(或者我無法找到它)使用Web站點項目的配置。 我使用的MSBuild構建解決方案:針對網站的Visual Studio重寫解決方案配置
MSBuild.exe MySolution.sln /m /p:Platform=x86;TargetFrameworkVersion=v4.6.2;OutputPath=bin;Configuration=Dev /ToolsVersion:14.0
由於.sln文件沒有關於網站項目我的開發配置的任何信息,只有調試和發佈「節」:
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
並且網站沒有被建立。
OK,我可以手動編輯解決方案文件和變更/添加Dev.XXXX,Test.XXX等相關設置,一切運作良好,直到你在Visual Studio開放的解決方案,並將其保存。 Visual Studio將完成所有更改並再次面臨同樣的問題。
作爲一種變通方法,我可以創建.sln文件的副本,並手動將其與原來的解決方案同步。有人有更好的主意嗎?