Skip to content

Commit

Permalink
Removed PackageReference from copied settings. (#2365)
Browse files Browse the repository at this point in the history
  • Loading branch information
timcassell committed Jul 17, 2023
1 parent 7a8135b commit fd2639f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 60 deletions.
3 changes: 1 addition & 2 deletions src/BenchmarkDotNet/Toolchains/CsProj/CsProjGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ public class CsProjGenerator : DotNetCliGenerator, IEquatable<CsProjGenerator>
"CopyLocalLockFileAssemblies",
"PreserveCompilationContext",
"UserSecretsId",
"EnablePreviewFeatures",
"PackageReference"
"EnablePreviewFeatures"
}.ToImmutableArray();

public string RuntimeFrameworkVersion { get; }
Expand Down
58 changes: 0 additions & 58 deletions tests/BenchmarkDotNet.Tests/CsProjGeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,64 +94,6 @@ public void UseWpfSettingGetsCopied()
Assert.Equal("Microsoft.NET.Sdk", sdkName);
}

[Fact]
public void PackageReferenceSingleLineGetsCopied()
{
const string WithPackageReference = @"
<Project Sdk=""Microsoft.NET.Sdk"">
<PropertyGroup>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<PackageReference Include=""xunit"" Version=""2.4.2"" />
</ItemGroup>
</Project>
";
var sut = new CsProjGenerator("netcoreapp3.0", null, null, null, true);

var xmlDoc = new XmlDocument();
xmlDoc.LoadXml(WithPackageReference);
var (customProperties, sdkName) = sut.GetSettingsThatNeedToBeCopied(xmlDoc, TestAssemblyFileInfo);

AssertCustomProperties(@"<ItemGroup>
<PackageReference Include=""xunit"" Version=""2.4.2"" />
</ItemGroup>", customProperties);
Assert.Equal("Microsoft.NET.Sdk", sdkName);
}

[Fact]
public void PackageReferenceMultiLineGetsCopied()
{
const string WithPackageReference = @"
<Project Sdk=""Microsoft.NET.Sdk"">
<PropertyGroup>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<PackageReference Include=""xunit.runner.visualstudio"" Version=""2.4.5"">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
";
var sut = new CsProjGenerator("netcoreapp3.0", null, null, null, true);

var xmlDoc = new XmlDocument();
xmlDoc.LoadXml(WithPackageReference);
var (customProperties, sdkName) = sut.GetSettingsThatNeedToBeCopied(xmlDoc, TestAssemblyFileInfo);

AssertCustomProperties(@"<ItemGroup>
<PackageReference Include=""xunit.runner.visualstudio"" Version=""2.4.5"">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>", customProperties);
Assert.Equal("Microsoft.NET.Sdk", sdkName);
}

[Fact]
public void SettingsFromPropsFileImportedUsingAbsolutePathGetCopies()
{
Expand Down

0 comments on commit fd2639f

Please sign in to comment.