Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'dotnet store' can't find crossgen with .NET 6

See original GitHub issue

Describe the bug

Calling ‘dotnet store’ on a package store manifest throws error that it can’t find crossgen, since crossgen is not included in the tools directory of .NET 6.0.3

To Reproduce

  1. On Windows, install .NET 6.0.3 SDK
  2. Create a file called packages.csproj
  3. Fill it with the example content from here (the example with Moq and Newtonsoft.Json):
  4. From the same directory as the created csproj run dotnet store --manifest packages.csproj --framework net6.0 --runtime win-x64
  5. Exception is thrown
  6. Add flag --skip-optimization to command and it will work

Exceptions (if any)

C:\Program Files\dotnet\sdk\6.0.201\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(82,5): error NETSDK1016: Unable to find resolved path for 'C:\Users\username\.nuget\packages\\6.0.3\runtimes\win-x64\native\..\..\..\tools\crossgen.exe'. [C:\Users\username\Downloads\DleteMe\subTest\testProject\packages.csproj]

Further technical details

Results of dotnet --info

.NET SDK (reflecting any global.json):
 Version:   6.0.201
 Commit:    ef40e6aa06

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19042
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.201\

Host (useful for support):
  Version: 6.0.3
  Commit:  c24d9a9c91

.NET SDKs installed:
  3.1.417 [C:\Program Files\dotnet\sdk]
  7.0.406 [C:\Program Files\dotnet\sdk]
  8.0.101 [C:\Program Files\dotnet\sdk]
  6.0.102 [C:\Program Files\dotnet\sdk]
  6.0.200 [C:\Program Files\dotnet\sdk]
  6.0.201 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

Beau-Gosse-devcommented, Apr 11, 2022

@baronfel do you have a link to documentation for the mentioned FrameworkReference? A quick search only seems to show how to use the ASP.NET FrameworkReference, but in this case we’re trying to build our own custom store (maybe that means we should be trying to build our own custom FrameworkReference now?).

Our use case is shown here in the Lambda Layers CLI PublishLayers command.

richlandercommented, May 15, 2022

I wrote this brain-dump on shared libraries last summer: It’s just a branch I pushed. Nothing more has happened on it. I didn’t even re-read it just now so I hope it is semi-coherent.

I’ll let @baronfel speak to the current status dotnet store.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to install CrossGen to optimize .NET Core Library in ci ...
Run dotnet restore deleteme.csproj . This will download the Crossgen nuget package to local cache. I can now run ~/.nuget/packages/microsoft.
Read more >
Conversation about crossgen2 - .NET Blog
When publishing your application, Crossgen runs the JIT over all assemblies and stores the JITted code in an extra section that can be...
Read more >
Announcing .NET 6 - The Fastest .NET Yet - .NET Blog
NET 6 is now available. It is easier to use, runs faster, and has many new features.
Read more >
Announcing .NET 6 Preview 6
Crossgen (1 and 2) enables pre-compiling IL to native code as a publishing step. Pre-compilation is primarily beneficial for improving startup.
Read more >
Conversation about ready to run - .NET Blog
Ready to run (R2R) is the native executable code format for .NET. R2R code is produced using the crossgen tool. We're using the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found