Visual Studio 正在扩展通配符项目文件包含在构建中 [英] Visual Studio is expanding wildcard project file includes upon build
问题描述
我正在使用 Visual Studio 2019 并且正在升级 .vbproj 文件以使用一些更现代的功能 - 我认为最初的解决方案/项目可能早在 VS 2008 就已经构建.我正在将大量显式文件包含转换为一个通配符以提取我的所有文件:
I am using Visual Studio 2019 and am upgrading a .vbproj file to use some more modern features - I think the initial solution/project may have been built as far back as VS 2008. I'm converting the masses of explicit file includes into one wildcard to pull in all my files:
<ItemGroup>
<Compile Include="Src\**\*.vb" />
</ItemGroup>
这很好用,我可以看到 Visual Studio 项目资源管理器中的所有文件.但是,当我构建项目时,这个通配符会被展开并且每个源文件都被命名,如下所示:
This works great, I can see all the files inside Visual Studio's project explorer. However, when I build the project, this wildcard gets expanded out and every source file is named, like this:
<ItemGroup>
<Compile Include="Src\Code\File1.vb" />
<Compile Include="Src\Code\File2.vb" />
<Compile Include="Src\Code2\File1.vb" />
</ItemGroup>
在我构建项目之前不会发生这种情况,我可以毫无问题地加载 Visual Studio,并且项目文件保持不变.
This doesn't happen until I build the project, I can load Visual Studio with no issues and the project file remains untouched.
我这样做是因为在删除许多文件的重构分支中合并这些文件时遇到了一些问题,因此这种方法会容易得多.
I'm doing this because of having a few problems merging these files across some refactoring branches where many files are deleted, so this method would be much easier.
我可以阻止 Visual Studio 这样做吗?
Can I prevent Visual Studio from doing this?
推荐答案
我已通过将项目文件升级到 Visual Studio 2017/2019 类型来解决此问题.以下指南非常方便:https://natemcmaster.com/blog/2017/03/09/vs2015-to-vs2017-upgrade/
I have managed to work around this by upgrading the project file to a Visual Studio 2017/2019 type. The following guide was really handy: https://natemcmaster.com/blog/2017/03/09/vs2015-to-vs2017-upgrade/
- 使用
- 删除我在原始帖子中指定的通配符包含 -- 默认情况下,Visual Studio 将此 glob 模式与新项目样式相匹配
- 将packages.config NuGet 引用转换为使用
s
对结果很满意:)
这篇关于Visual Studio 正在扩展通配符项目文件包含在构建中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!