首页 > 解决方案 > msbuild Microsoft.NET.Sdk: how to override globbing?

问题描述

It looks like the .csproj file globs all **/*.cs from the project file: I'd like instead to specify a particular subdirectory, but can't figure out the syntax, or what property to override?

How can I specify a particular subdirectory, and better yet how can I figure this out myself in the future?

标签: c#msbuild

解决方案


在 Visual Studio 的解决方案资源管理器中,您可以右键单击一个 cs 文件并选择从项目中排除,这样您就可以排除您不想要的内容。

或者您可以编辑 csproj 文件并添加行

  <ItemGroup>
    <Compile Remove="FileName.cs" />
  </ItemGroup>

查看MSBuild 项目文件文档以获取更多详细信息


推荐阅读