Reputation: 13256
I have some files that are specific to either .Net Core or .Net proper.
I could place a conditional compilation #if
around the entire, say, class but is it possible to exclude/include a file conditionally in the csproj
file?
I have tried this (to no avail):
<ItemGroup>
<Compiled Remove="IDbProviderFactories.cs" Condition="'$(TargetFramework)' != 'netstandard2.0' and '$(TargetFramework)' != 'netcoreapp2.0'"/>
</ItemGroup>
Upvotes: 2
Views: 2969
Reputation: 100751
The item type is Compile
, you used Compiled
(extra d
) in your code. If you change this, your example should work.
Upvotes: 2