New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"exclude" doesn't work with new csproj format #3133

Closed
M0ns1gn0r opened this Issue Mar 26, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@M0ns1gn0r

M0ns1gn0r commented Mar 26, 2018

Description

I am converting one of my test projects to the new csproj format. The project references XUnit and an optional package XUnit.Assert.Source which adds source files of the assertion library to the project structure. I have to remove the transitive dependency Xunit.Assert which includes the compiled version of the same assertions so that no conflicts occur. This worked well for the traditional csproj.

Repro steps

paket.dependencies:

source https://www.nuget.org/api/v2
nuget xunit
nuget xunit.assert.source

paket.references

xunit
    exclude xunit.assert
xunit.assert.source

TestOfExclude.csproj

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="Asserts\Assert.cs">
      <Paket>True</Paket>
    </Compile>
    .... and so on ....
    <Compile Include="Asserts\Sdk\Exceptions\XunitException.cs">
      <Paket>True</Paket>
    </Compile>
  </ItemGroup>
  <Import Project="..\.paket\Paket.Restore.targets" />
</Project>

A project with the reproduction TestOfExclude.zip

Expected behavior

  1. XUnit.Assert is not included in the list of referenced NuGet packages.
  2. The project compiles.

Actual behavior

The opposite, more than 200 errors like this:
CS0111 Type 'Assert' already defines a member called '.ctor' with the same parameter types TestOfExclude\Asserts\Assert.cs

@forki forki closed this in cd4058f Mar 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment