2012-06-06 22 views
3

我会在这里使用Visual Studio的行话......如何在Visual Studio中创建一个从Web站点解决方案文件(的.sln)2010

我有一个住在/Visual Studio 2010/Projects/My Project/Code/WebSite一个网站。

我想为此网站创建一个解决方案文件(.sln)文件,该文件位于/Visual Studio 2010/Projects/My Project/

有没有简单的方法从网站创建解决方案文件,并指定它的目录?还是有其他步骤,我需要采取...

+0

[检查这个](http://blogs.msdn.com/b/webdevtools/archive/2009/10/29/converting-a-web-site-project-to-a-web-application -project.aspx) – Damith

回答

3

注意:以下适用于网站项目,而不是Web应用程序项目。 WSP在Visual Studio项目中有点独特,因为它们没有项目文件,并且所有项目设置都存储在解决方案文件中。

很可能有2种方法来做到这一点:

  1. 创建所需的文件夹中的一个新的空的解决方案。然后,只需添加现有网站,将其指向您的网站文件夹,即可设置!您可能需要为您的网站自定义一些设置以符合您之前的设置。
  2. 如果您已经有一个现有的解决方案文件(您可能在磁盘上执行某个操作),可以将其移动到所需的路径,然后更新网站的相关文件路径。对于网站项目,解决方案文件的内容将如下所示:

    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 
    

    您可以看到网站实际驻留的文件夹的相对路径。

相关问题