如果您有一个“.sln”解决方案文件,可以按照以下步骤进行操作:
使用记事本打开解决方案文件。
查找以Project("{开头的行。
例如:
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "WebProject1", "WebProject1", ......
然后将其更改为:
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "WebProject1", "http://localhost:12345/WebProject1", ......
并添加新属性
SlnRelativePath = "C:\WebProject1\"
在ProjectSection(WebsiteProperties)内
例如,从以下ProjectSection开始:
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "WebProject1", "WebProject1", "{6D411253-734E-401A-A049-9620FC55D4FB}"
ProjectSection(WebsiteProperties) = preProject
UseIISExpress = "true"
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
Debug.AspNetCompiler.VirtualPath = "/WebProject1"
Debug.AspNetCompiler.PhysicalPath = "C:\WebProject1\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\WebProject1\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/WebProject1"
Release.AspNetCompiler.PhysicalPath = "C:\WebProject1\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\WebProject1\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
EndProjectSection
EndProject
最终变成这样:
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "WebProject1", "http://localhost:12345/WebProject1", "{6D411253-734E-401A-A049-9620FC55D4FB}"
ProjectSection(WebsiteProperties) = preProject
UseIISExpress = "true"
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
Debug.AspNetCompiler.VirtualPath = "/WebProject1"
Debug.AspNetCompiler.PhysicalPath = "C:\WebProject1\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\WebProject1\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/WebProject1"
Release.AspNetCompiler.PhysicalPath = "C:\WebProject1\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\WebProject1\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
SlnRelativePath = "C:\WebProject1\"
EndProjectSection
EndProject