Visual Studio 2013 解决方案文件夹在哪里? [英] Where are Visual Studio 2013 Solution Folders?

查看:68
本文介绍了Visual Studio 2013 解决方案文件夹在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前的情况:

我有一个解决方案,我将一个大型 MVC 项目拆分为两个较小的项目.当然,这两个较小的项目引用了旧的较大项目中相同的 JavaScript 和内容文件.

我想做什么:

我不想复制 2 个项目中的脚本和内容,而是想创建一个共享文件夹,2 个项目使用链接或快捷方式等方式引用该文件夹.

我是如何解决这个问题的:

我认为解决方案文件夹是我问题的解决方案.所以我想创建一个解决方案文件夹,我会将所有脚本和内容文件移动到该文件夹​​中.

但是,我的问题是我必须逐个文件地将文件移动到此文件夹,因为我们不能简单地添加现有文件夹(我将脚本和内容文件夹移动到解决方案目录本身,而不是在特定项目中).这太乏味了.

这是我尝试做的:

  1. 首先,我尝试找到创建解决方案文件夹的位置.但是,我发现解决方案文件夹实际上并不存在.我认为它们只是您解决方案的某种逻辑结构.每当您将文件添加到解决方案文件夹时,它都会以物理方式添加到解决方案目录中.
  2. 我认为解决方案文件 (.sln) 可能以某种 xml 格式包含解决方案文件夹的配置及其内容.然而,情况似乎并非如此.
  3. 我打开了解决方案的 SQL Server Compact Edition 文件 (.sdf),认为可能有一个描述解决方案文件夹的数据库表.然而,情况似乎也并非如此.

最后,我的问题是:

有没有什么简单的方法可以将现有文件夹添加为解决方案文件夹,以避免一个一个的添加文件(我的文件太多).

更新:

感谢您的回答和建议.我最终采取了一种稍微不同的方法.我使用了一个预构建命令:XCOPY "$(SolutionDir)Files\*.*" "$(ProjectDir)"/E.我这样做是因为建议的解决方案和我之前的尝试是将链接/快捷方式添加到外部资源文件.虽然这很好,而且快捷方式实际上已添加到项目中,但当我测试 MVC 项目时,IIS 无法加载资源文件,因为它会查找物理文件(当然).>

所以我现在的查询是:是否有某种方式,无论是构建事件还是 csproj 文件中的配置,将新物理"复制的文件包含在项目中"?

解决方案

我对问题的最终解决方案是将解决方案建议的答案和我决定采用的方法相结合,以便 本地 IIS 可以查看文件.

我在 csproj 文件中添加了以下部分:

 <Link>%(RecursiveDir)%(Filename)%(Extension)</Link></内容>

我还在我的项目中添加了以下命令作为预构建事件:XCOPY/y "$(SolutionDir)Files\*.*" "$(ProjectDir)"/E

My Current Situation:

I had a solution in which I split a large MVC project into two smaller projects. Of course the two smaller projects reference the same JavaScript and content files that were in the old larger project.

What I wish to do:

Instead of duplicating the scripts and content in the 2 projects, I want to create a shared folder that the 2 project refer to using something like a link or a shortcut.

How I am trying to approach the problem:

I think that solution folders are the solution to my problem. So I want to create a solution folder to which I will move all my scripts and content files.

However, my problem is that I have to move file by file to this folder since we cannot simply add an existing folder (I moved the scripts and content folders to the solution directory itself instead of being inside a specific project). And this is so tedious.

Here is what I tried to do:

  1. First I tried to locate where solution folders are created. However, I discovered that solution folders don't physically exist. I think they are just some kind of logical structuring to your solution. Whenever you add a file to a solution folder it is physically added to the solution directory.
  2. I thought that the solution file (.sln) may contain the configuration of solution folders and their content in some kind of xml format. However, this doesn't seem to be the case.
  3. I opened the SQL Server Compact Edition file (.sdf) of the solution thinking that may there is a DB table that describes the solution folders. However, this also doesn't seem to be the case.

So, finally, my question is:

Is there any easy way to add an existing folder as a solution folder in order to avoid adding files one by one (I have too many files).

Update:

Thanks for the answers and suggestions. I ended up taking a somewhat different approach. I used a pre-build command: XCOPY "$(SolutionDir)Files\*.*" "$(ProjectDir)" /E. I did this because the suggested solutions and my previous attempt was to add links/shortcuts to the external resource files. While this was fine and shortcuts were actually added to the project, when I tested the MVC project, IIS didn't manage to load the resource files since it looks for physical files (of course).

So my query now is: is there someway, whether a build event or and configuration in the csproj file, to "Include In Project" the newly "physically" copied files?

解决方案

My final solution to the problem is a combination of the solutions suggested answers and the approach I decided to take so that local IIS can see the files.

I added the following section to the csproj file:

    <Content Include="..\Files\**">
    <Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
</Content>

I also added the following command as a pre-build event in my project:XCOPY /y "$(SolutionDir)Files\*.*" "$(ProjectDir)" /E

这篇关于Visual Studio 2013 解决方案文件夹在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆