Skip to content

Benchmark project using paket dependency manager fails to build auto-generated projects #2364

@marklam

Description

@marklam

Using paket for the nuget package management causes the auto-generated projects to fail their build.

The reported error is:

...\BenchmarkDotNet.Autogenerated.csproj : warning NU1604: Project dependency %(PaketReferencesFileLinesInfo.PackageName) does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results.
...\BenchmarkDotNet.Autogenerated.csproj : error NU1101: Unable to find package %(PaketReferencesFileLinesInfo.PackageName). No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, nuget.org

Which seems to be due to the section in the BenchmarkDotNet.Autogenerated.csproj:

  <!-- Begin copied settings from benchmarks project -->
  <ItemGroup>
    <PackageReference Include="%(PaketReferencesFileLinesInfo.PackageName)" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <Version>%(PaketReferencesFileLinesInfo.PackageVersion)</Version>
      <PrivateAssets Condition=" ('%(PaketReferencesFileLinesInfo.AllPrivateAssets)' == 'true') Or ('$(PackAsTool)' == 'true') ">All</PrivateAssets>
      <ExcludeAssets Condition=" %(PaketReferencesFileLinesInfo.CopyLocal) == 'false' or %(PaketReferencesFileLinesInfo.AllPrivateAssets) == 'exclude'">runtime</ExcludeAssets>
      <ExcludeAssets Condition=" %(PaketReferencesFileLinesInfo.OmitContent) == 'true'">$(ExcludeAssets);contentFiles</ExcludeAssets>
      <ExcludeAssets Condition=" %(PaketReferencesFileLinesInfo.ImportTargets) == 'false'">$(ExcludeAssets);build;buildMultitargeting;buildTransitive</ExcludeAssets>
      <Publish Condition=" '$(PackAsTool)' == 'true' ">true</Publish>
      <AllowExplicitVersion>true</AllowExplicitVersion>
    </PackageReference>
  </ItemGroup>

I've created a repo which shows the problem: https://github.com/marklam/paketAndBenchmarkdotnet

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions