【发布时间】:2016-12-30 10:37:09
【问题描述】:
我有一个网站项目的解决方案。共有三种自定义解决方案配置:Dev、Test、Prod。但是,网站项目没有 .csproj 文件,并且无法(或者我找不到)为网站项目使用配置。 我正在使用 MSBuild 构建解决方案:
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
结束项目
并且网站没有建立。
好的,我可以手动编辑解决方案文件并更改/添加 Dev.XXXX、Test.XXX 等相关设置,一切正常,直到您在 Visual Studio 中打开解决方案并保存它。 Visual Studio 会释放您的所有更改,而您又面临同样的问题。
作为一种解决方法,我可以创建 .sln 文件的副本并手动将其与原始解决方案同步。有人有更好的主意吗?
【问题讨论】:
-
它对我有用。但我也先将开发和测试添加到构建配置管理器中。
标签: visual-studio msbuild web