我可以在Compile元素中同时使用通配符和Link元素吗? [英] Can I use both wildcard and Link element inside the Compile element?
问题描述
在.csrpoj
文件中,如果我有
<Compile Include="c:\path\File1.cs">
<Link>Dir1\File1.cs</Link>
</Compile>
然后,Visual Studio将该文件显示为解决方案资源管理器中Dir1
文件夹下的快捷方式.
Then Visual Studio shows that file as a shortcut under Dir1
folder in the Solution Explorer.
如果我有
<Compile Include="c:\path\*.cs"></Compile>
然后,所有.cs
文件都将作为解决方案浏览器中的快捷方式显示在顶层:
Then all .cs
files show up as shortcuts in Solution Explorer at top level:
有没有一种方法可以将 all 个文件包含在某个文件夹中,然后使其显示在子文件夹下?忽略Link
元素中的文件名不起作用:
Is there a way to include all files in some folder and make then show up under a sub-folder? Omitting the filename in Link
element does not work:
<Compile Include="c:\path\*.cs">
<Link>Dir1\</Link>
</Compile>
文件仍显示在顶层.
如何将所有文件包含在文件夹中,并且仍然使用Link元素?我需要这个的原因是,我需要包含多个文件夹中的文件,其中一些具有相同的名称.顶层的两个文件不能具有相同的名称.
How do I include all files in a folder and still use the Link element? The reason I need this is, I need to include files from multiple folders and some of them have the same name. Two files at top level cannot have the same name.
还有其他方法可以实现这一目标吗?
Any other way to achieve this?
推荐答案
<Content Include="..\..\SomeDirectory\**\*.xml">
<Link>SomeLinkDirectoryOfYourChoosing\%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
这篇关于我可以在Compile元素中同时使用通配符和Link元素吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!