我可以在 Compile 元素中同时使用通配符和 Link 元素吗? [英] Can I use both wildcard and Link element inside the Compile element?

查看:12
本文介绍了我可以在 Compile 元素中同时使用通配符和 Link 元素吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.csrpoj文件中,如果有

<Compile Include="c:pathFile1.cs">
  <Link>Dir1File1.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屋!

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