C # - using wildcards inside a csproj file and adding new files

Inside .csproj, Visual Studio and Xamarin Studio files by default contain a link to each file used within the project.

<ItemGroup>
    <Compile Include="Utils\Foo1Utils.cs" />
    <Compile Include="Utils\Foo2Utils.cs" />
    <Compile Include="Services\FooService.cs" />
    ...
</ItemGroup>

To avoid conflicts in csproj files inside our solution every time we add a file, we started using wildcards :

<ItemGroup>
    <Compile Include="Utils\*.cs" />
    <Compile Include="Services\*.cs" />
    ...
</ItemGroup>

The problem is that, apparently, both in Visual Studio and in Xamarin Studio it is impossible to "explain" the IDE that we use wildcards, and when we add a new file to the project, they add a new link to the file, ignoring a wildcard *.csin a folder. This is still a good solution because we don’t need to commit our .csproj every time we add a file, but now we have to reset them every time ... does anyone know if there is a solution?

EDIT: with Rider (JetBrains) there is no this problem if csproj has a wildcard and I add a new file, everything works fine.

+6
source share
2 answers

, , : Rider , , Visual Studio, Win, Mac. .csproj( <Project Sdk="Microsoft.NET.Sdk"> -, , , .

0

(.NET core 2), , . , , .

+1

Source: https://habr.com/ru/post/1015970/


All Articles