Source-Only NuGet packages add <Compile Include="..." /> to csproj, resulting in build errors.
See original GitHub issueDescription
Paket Installing a source-only NuGet package adds a Compile element to the csproj file, which leads to build errors in the new dotnet sdk: Duplicate Compile items were included. The .NET SDK includes Compile items from your project directory by default. You can either remove these items from your project file, or set the 'EnableDefaultCompileItems' property to 'false' if you want to explicitly include them in your project file.
Repro steps
- Step A
Add e.g. TinyIoC to your paket.dependencies
and paket.references
of your dotnet 1.1+ console application.
- Step B
Run paket Install
.
Expected behavior
The files in the Content folder of the NuGet package (in TinyIoC’s case, TinyIoC.cs
) are added to the project. Since the dotnet sdk moved the globs to include compile items to the properties of the sdk, it isn’t necessary that an element (<Compile Include="TinyIoC.cs" />
) is added to the cspoj. Expected behavior is therefore that this doesn’t happen. (more info: https://aka.ms/sdkimplicititems)
Actual behavior
It does 😃 A Compile element is added to the csproj, which causes build errors (see above).
Known workarounds
The error goes away when you remove the element from the csproj, but it is added again after every paket Install
, which is unfortunate.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:14 (7 by maintainers)
Top GitHub Comments
ok fixed in latest alpha
PR coming… Verified the proposal, fixes the issue and solves the regression