如何在Visual Studio 2010中从网站创建一个解决方案文件(.sln)

4
我会在这里使用Visual Studio术语...
我有一个Web站点,位于/ Visual Studio 2010 / Projects / My Project / Code / WebSite
我想为这个Web站点创建一个解决方案文件(.sln) ,它位于/ Visual Studio 2010/Projects/My Project/
是否有一种简单的方法可以从Web站点创建解决方案文件,并指定其所在目录?或者我需要采取其他步骤...

请查看以下链接:http://blogs.msdn.com/b/webdevtools/archive/2009/10/29/converting-a-web-site-project-to-a-web-application-project.aspx - Damith
1个回答

4
注意:以下内容适用于Web Site Projects,而非Web Application Projects。WSP在Visual Studio项目中有些独特,因为它们没有项目文件,所有项目设置都存储在解决方案文件中。
这可能有两种方法:
  1. Create a new empty solution in the folder you want. Then just do Add Existing Website, point it at your web site folder, and you're set! You may need to customize some settings for your web site to match what you had before.
  2. If you already have an existing solution file (which you probably do somewhere on disk), you can move it to the path you want, then update the relative file paths to the web site. The contents of the solution file will look something like this for a web site project:

    Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "WebSite1", "..\..\WebSites\WebSite1\", "{AB75CF01-6B54-4BB1-A14A-01A26727FEF2}"
        ProjectSection(WebsiteProperties) = preProject
            TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
            Debug.AspNetCompiler.VirtualPath = "/WebSite1"
            Debug.AspNetCompiler.PhysicalPath = "..\..\WebSites\WebSite1\"
            Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\WebSite1\"
            ... snip ...
            Release.AspNetCompiler.VirtualPath = "/WebSite1"
            Release.AspNetCompiler.PhysicalPath = "..\..\WebSites\WebSite1\"
            Release.AspNetCompiler.TargetPath = "PrecompiledWeb\WebSite1\"
            ... snip ...
            VWDPort = "47656"
            DefaultWebSiteLanguage = "Visual C#"
        EndProjectSection
    EndProject
    

    You can see the relative paths to the folder where the web site actually resides.


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接