且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何创建从Web站点在Visual Studio 2010解决方案文件(的.sln)

更新时间:2022-06-23 03:08:11

请注意:以下适用于网站项目,而不是Web应用程序项目。水安全计划是因为它们不具有项目文件Visual Studio项目中的位唯一的,所有的项目设置被存储在溶液文件

Note: the following applies to Web Site Projects, not Web Application Projects. WSPs are a bit unique among Visual Studio projects in that they don't have a project file, and all the project settings are stored in the solution file.

有可能是2的方式来做到这一点:

There's probably 2 ways to do this:


  1. 创建所需的文件夹中的一个新的空的解决方案。然后,只是不加入现有的网站,在你的网站文件夹指向它,你定!您可能需要定制一些设置为你的网站,以配合您以前所。

  2. 如果您已经有一个现有的解决方案文件(你可能做的地方在磁盘上),你可以将它移动到你想要的路径,然后更新相对文件路径到网站。该解决方案文件的内容会是这个样子的网站项目:

  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.