Visual Studio链接的文件目录结构 [英] Visual Studio Linked Files Directory Structure

查看:254
本文介绍了Visual Studio链接的文件目录结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目的两个版本.一种用于Silverlight,另一种用于.NET. SL项目中包含绝大多数代码库.我想将SL项目中的所有文件全局添加为链接文件.我设法在.NET版本的csproj文件中成功做到了这一点:

I have two versions of a project. One for Silverlight and one for .NET. The SL project has the vast majority of the code base in it. I want to globally add all files from the SL project into the .NET version as linked files. I've managed to do so successfully like this in the csproj file for the .NET version:

<Compile Include="..\MyProj.Common.SL\**\*.cs" Exclude="..\MyProj.Common.SL\Properties\**">

不幸的是,这会将所有文件添加到我的项目的根目录中.因此,我最终在.NET项目中得到了一个长长的,不可读的链接文件列表.我真的真的不想手动维护整个重复的目录结构,而不必处理目录名更改和文件名更改等等.

Unfortunately, this adds all the files right to the root of my project... so I end up with a long unreadable list of linked files in the .NET project. I really really really don't want to have to maintain an entire duplicate directory structure by hand and deal with directory name changes and file name changes and whatnot.

那么,当以上述通配方式添加链接文件时,有什么方法可以使Visual Studio保留目录结构?还是至少有一种方法可以使它将所有链接的文件分组到.NET项目中的目录(如MyProj.Common.SL.Links)下?

So, is there any way to have Visual Studio preserve the directory structure when adding linked files in the wildcard manner above? Or is there at least a way of making it group all the linked files together under a directory in the .NET project like MyProj.Common.SL.Links?

我最接近的是将<Visible>false</Visible>设置在<Compile>标记下,这有效地删除了300多个文件的冗长的可读列表....但是不幸的是,这使Resharper搞砸了,后者不再可见这些文件是有效的,并且在引用.NET项目的所有项目中都变得疯狂.如果我想出一种使Resharper不再混乱的方法,那也是一个可以接受的解决方案...

The very closest I've come is to set the <Visible>false</Visible> under the <Compile> tag, which effectively removes the long unreadable list of 300+ files....but unfortunately this screws up Resharper, which no longer sees those files as valid and it goes crazy on all the projects that reference the .NET project. If I could figure out a way of making Resharper not get all messed up, that would be an acceptable solution too...

有什么建议吗?

谢谢.

推荐答案

我想我找到了一种使它起作用的方法:

I think I found a way of getting this to work:

<Compile Include="..\MyProj.Common.SL\**\*.cs" Exclude="..\MyProj.Common.SL\Properties\**">
  <Link>MyProj.Common.SL.LinkedFiles\MyProj.Common.SL.LinkedFiles</Link>
</Compile>

它将创建MyProj.Common.SL.LinkedFiles文件夹,并将所有链接文件分组到该文件夹​​下.

It will create a MyProj.Common.SL.LinkedFiles folder and group all the linked files under that folder.

这篇关于Visual Studio链接的文件目录结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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