Skip to content
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

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

Closed
marklam opened this issue Jul 11, 2023 · 2 comments · Fixed by #2365
Closed
Assignees
Labels
Milestone

Comments

@marklam
Copy link

marklam commented Jul 11, 2023

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

@AndreyAkinshin
Copy link
Member

@timcassell could you please take a look?

@timcassell
Copy link
Collaborator

We copy some settings from both the csproj/fsproj and imported targets. It looks like in this case there are some variables in that PackageReference that we aren't able to resolve when we copy it. #1403 should have a proper fix, but in the meantime, should we remove PackageReference from the copied settings @AndreyAkinshin? I'm not sure how to fix just the variables by itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants