如何在与Web项目相同的目录中创建Visual Studio解决方案文件(.sln)?

Bri*_*ght 17 visual-studio-2005 projects-and-solutions visual-studio-2008 visual-studio

我正在使用VisualSVN客户端和服务器,并且Web项目按要求工作的要求之一是将.sln与其他文件放在同一目录(root)中.

我认为这就像删除所有额外的父路径../和其他相对路径并保存它一样简单.但是,当我尝试打开它时,只需锁定Visual Studio.

有没有一种标准的方法来创建这种类型的解决方案文件或解决方案文件工具,以帮助确保它是有效的?或者我只是遗漏了一些非常明显的东西?

/
/MyWebsite.org.sln
/Images
/App_Data
/default.aspx
/default.aspx.cs
Run Code Online (Sandbox Code Playgroud)

显然这个伎俩,至少我要求的是你必须使用..\MyWebsite.org或任何包含网站文件的文件夹.

[编辑]我学到了什么,以及这个特定项目的最终.sln文件:

这是最终的解决方案文件,允许我打开网站并在.net文件夹的根目录中包含.sln.

Project("{E24C65DC-7377-472B-9ABA-BCSG3B73C61A}") = "MyWebsite.org", "\", "{F8F4E96F-40BF-4374-B8BA-968D0SGG4A9E}"
    ProjectSection(WebsiteProperties) = preProject
        TargetFramework = "3.5"
        Debug.AspNetCompiler.VirtualPath = "/MyWebsite.org"
        Debug.AspNetCompiler.PhysicalPath = "..\MyWebsite.org\"
        Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\MyWebsite.org\"
        Debug.AspNetCompiler.Updateable = "true"
        Debug.AspNetCompiler.ForceOverwrite = "true"
        Debug.AspNetCompiler.FixedNames = "false"
        Debug.AspNetCompiler.Debug = "True"
        Release.AspNetCompiler.VirtualPath = "/MyWebsite.org"
        Release.AspNetCompiler.PhysicalPath = "..\MyWebsite.org\"
        Release.AspNetCompiler.TargetPath = "PrecompiledWeb\MyWebsite.org\"
        Release.AspNetCompiler.Updateable = "true"
        Release.AspNetCompiler.ForceOverwrite = "true"
        Release.AspNetCompiler.FixedNames = "false"
        Release.AspNetCompiler.Debug = "False"
        VWDPort = "1603"
        VWDDynamicPort = "false"
        VWDVirtualPath = "/"
    EndProjectSection
EndProject
Run Code Online (Sandbox Code Playgroud)

AJ.*_*AJ. 17

一般来说,我所做的是从"空白解决方案"开始,该解决方案位于"新建项目"对话框中的"其他项目类型 - > Visual Studio解决方案"下.然后,将该网站以及您需要的任何其他项目添加到解决方案中.


Mit*_*ers 14

另一个选择是在创建项目时只需取消选中"create directory for solution"的默认框


Jer*_* B. 9

以下步骤应该有效.

  1. 做一个空白的解决方案,没有任何内容.
  2. 将解决方案移动到您希望Web项目生效的位置.
  3. 打开解决方案.
  4. 在所需区域中创建Web项目.

我经常这样做,所以项目将很好地坐在svn.不要忘记svn:忽略*.suo文件.