Visual Studio 2015 - Adding virtual directory not possible

后端 未结 4 1327
难免孤独
难免孤独 2020-12-09 00:06

we are running some of our sites as Web Site projects in Visual Studio. We recently upgraded to VS2015. Now we can\'t add virtual directories to new websites.

We alr

4条回答
  •  孤城傲影
    2020-12-09 00:24

    Alternative if you have solution file ".sln", then follow the steps:

    1. Use notepad open the solution file.

    2. Find the row starts with Project("{

    For example:

    Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "WebProject1", "WebProject1", ......

    Then change it to be:

    Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "WebProject1", "http://localhost:12345/WebProject1", ......

    And add new property

    SlnRelativePath = "C:\WebProject1\"

    within ProjectSection(WebsiteProperties)

    In example, the ProjectSection from

    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
    

    become this finally:

    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
    

提交回复
热议问题