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

M0ns1gn0r opened this Issue Mar 26, 2018 · 0 comments


None yet
1 participant

M0ns1gn0r commented Mar 26, 2018


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


nuget xunit
nuget xunit.assert.source


    exclude xunit.assert


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

A project with the reproduction

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