Skip to content

Commit

Permalink
Fix some bugs with the new XunitAssert
Browse files Browse the repository at this point in the history
I found a few bugs in trying to enable dotnet/runtime#86193.
One is that there's no way to flip Arcade to pull in the fork package instead of xunit.assert.
The second is that when both are pulled in, because the fork has a different assembly name, the
references are ambiguous and produce compile-time breaks. Matching names seems like it will get
rid of that problem, and it also has the side-effect of letting the analyzer work properly against
the fork.
  • Loading branch information
agocke committed May 13, 2023
1 parent 1aff4eb commit 141921b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Microsoft.DotNet.Arcade.Sdk/tools/XUnit/XUnit.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="xunit" Version="$(XUnitVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true"/>
<PackageReference Include="xunit.core" Version="$(XUnitVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true" />
<PackageReference Include="xunit.analyzers" Version="$(XUnitVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true" />
<PackageReference Include="xunit.assert" Version="$(XUnitVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true" Condition="'$(UseDotNetXUnitAssert)' != 'true'" />
<PackageReference Include="Microsoft.DotNet.XUnitAssert" Version="$(MicrosoftDotNetXUnitAssertVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true" Condition="'$(UseDotNetXUnitAssert)' == 'true'" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true"/>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFrameworks>$(NetCurrent);$(NetMinimum)</TargetFrameworks>
<AssemblyName>xunit.assert</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

<!-- This project provides xunit.assert, so we can't bring the package in, as it would conflict. -->
<ItemGroup>
<PackageReference Remove="xunit" />
<PackageReference Include="xunit.core" Version="$(XUnitVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true"/>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<PropertyGroup>
<TargetFramework>$(NetCurrent)</TargetFramework>
<Nullable>enable</Nullable>
<!-- Baselining tests from imported sources -->
<NoWarn>$(NoWarn);xUnit2000;xUnit2003;xUnit2005;xUnit2007;xUnit2011;xUnit2015;xUnit2017</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 141921b

Please sign in to comment.