Open billwert opened 5 years ago
I thought I could work around this by emitting a Directory.Build.props
, but y'all thought of that :)
https://github.com/dotnet/BenchmarkDotNet/blob/58fde64c809ceadb3fca9d677a7cec83071b833f/src/BenchmarkDotNet/Templates/CsProj.txt#L4-L5
I definitely understand why this is there, and think it's a good idea. It just prevented the work around I had hoped would be cheap of ensuring that there's a Directory.Build.props
in the correct place. As msbuild will stop looking, I can feel confident this is going to have the behavior I wanted. Alas.
This issue is very similar to #1023 :
A
has a reference to package B
C
that references 'A'B
is non transitive and BDN fails to build the auto-generated project because it lacks the reference@viktorhofer @ericstj @eerhardt would it be possible to make Microsoft.NetFramework.ReferenceAssemblies
package transitive? or somehow tell MSBuild to reference in C
everything that A
references? to solve things like #1023 as well?
@billwert if I won't be able to find any clean solution the only idea I currently have it to introduce a concept of BenchmarkDotNet.props
files that would be always included by the auto-generated project files.
The reason the reference to B
isn't included in C
is because the reference has PrivateAssets=All
on it:
https://github.com/dotnet/performance/pull/627/files#diff-931d1b8d9e5f2892d7f8e001da3bf159R25.
This means that this reference is "private" to A
and shouldn't be made transitive.
Possible fixes:
PrivateAssets=All
on the reference in the benchmark.csproj (A
).
PrivateAssets=All
in a benchmark project would be necessary. You don't really expect other projects referencing benchmark projects.PrivateAssets=All
and copy them to the generated project C
.@eerhardt thank you!
Remove PrivateAssets=All on the reference in the benchmark.csproj
@billwert could you please give it a try?
Remove PrivateAssets=All on the reference in the benchmark.csproj
FWIW this does not solve the problem (tested myself)
I've come here from https://stackoverflow.com/questions/58990324/how-to-benchmark-two-different-versions-of-the-same-non-nuget-library-in-benchma Have the same issue. I need to benchmark some changes in WinForms. For this I manually reference my newly build assembles:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Reference Include="d:\save\projects\winforms\artifacts\bin\System.Windows.Forms\Release\net6.0\System.Windows.Forms.dll" />
<Reference Include="d:\save\projects\winforms\artifacts\bin\System.Windows.Forms.Primitives\Release\net6.0\System.Windows.Forms.Primitives.dll" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
</ItemGroup>
</Project>
but System.Windows.Forms.dll
and System.Windows.Forms.Primitives.dll
simply not copied into autogenerated folder - benchmark uses default assemblies :(
Today, if a benchmark needs a reference to a Nuget package it goes into the original project (microbenchmarks.csproj, say) and then does not need to be in the auto generated csproj.
I’d like to enable us to remove the requirement that we run .NET Framework tests on VMs / machines that have Visual Studio installed: https://github.com/dotnet/performance/pull/627. The new Microsoft.NetFramework.ReferenceAssemblies package is precisely the answer.
But it fails because the generated project doesn’t include the package reference I added:
Interestingly, on my machine the second build (which includes --no-dependencies) works on my machine, probably because it’s using some ambient state at that point.
I see that csproj.txt doesn’t have a parameter for this, so we need some feature to plumb this through.