question-mark
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.

Error when running Blazor app before running any other .NET Core 3.0 app: Unable to generate deps.json, it may have been already generated

See original GitHub issue

If you create a Blazor app after installing the .NET Core 3.0 Preview 2 SDK and you have a clean NuGet package cache you get an error when running the app: “Unable to generate deps.json, it may have been already generated”.

Blazor apps rely on a DotNetCliToolReference to run, but they also target .NET Standard:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <RunCommand>dotnet</RunCommand>
    <RunArguments>blazor serve</RunArguments> 
    <LangVersion>7.3</LangVersion>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Blazor" Version="0.8.0-preview-19104-04" />
    <PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="0.8.0-preview-19104-04" PrivateAssets="all" />

    <DotNetCliToolReference Include="Microsoft.AspNetCore.Blazor.Cli" Version="0.8.0-preview-19104-04" />
  </ItemGroup>

</Project>

It appears that the problem is that the Microsoft.NetCore.App package doesn’t get restored, which then causes the Blazor app to fail at runtime. If you create any other .NET Core app before trying to run the Blazor app, the Microsoft.NetCore.App package is then already restored and the app runs fine. At the very least the error message doesn’t really help you understand what is going on here.

Repro steps:

  • Install .NET Core 3.0 Preview 2
  • dotnet new -i Microsoft.AspNetCore.Blazor.Templates::0.8.0-preview-19104-04
  • dotnet nuget locals all -c
  • dotnet new blazor -o BlazorApp1
  • cd BlazorApp1
  • dotnet run

Expected result:

  • Blazor app runs successfully

Actual result:

  • Unable to generate deps.json, it may have been already generated. You can specify the “-d” option before the tool name for diagnostic output (for example, “dotnet -d <toolname>”: C:\Program Files\dotnet\sdk\3.0.100-preview-010184\Sdks\Microsoft.NET.Sdk\targets\GenerateDeps\GenerateDeps.proj

To workaround the issue you can create any .NET Core app, which will result in the missing Microsoft.AspNetCore.App package to get successfully restored.

Workaround:

  • cd ..
  • dotnet new console -o ConsoleApp1
  • cd BlazorApp1
  • dotnet run

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:10
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
alierdogan70commented, Feb 26, 2019

This worked for me. Thank you.

To workaround the issue you can create any .NET Core app, which will result in the missing Microsoft.AspNetCore.App package to get successfully restored.

Workaround:

  • cd ..
  • dotnet new console -o ConsoleApp1
  • cd BlazorApp1
  • dotnet run
0reactions
nguerreracommented, May 23, 2019

I took a look at this yesterday with @wli3, and we think this will be fixed when the targeting packs are bundled in the .NET Core SDK. This will be in Preview 3 for Windows.

I just checked. It stops reproducing

Closing as fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NET Core 3.0.100 not working with Blazor
"Unable to generate deps.json, it may have been already generated.": You may see this error when running a standalone Blazor app and you ......
Read more >
Asp.net core web application BLAZOR not starting
Unable to generate deps.json, it may have been already generated. You can specify the "-d" option before the tool name for diagnostic output ......
Read more >
Started to get "This project is targeting a version of .NET ...
1). In VS Installer > Individual components tab > check if components like .NET 5.0 Runtime or related components are checked. If it/they...
Read more >
NETSDK1045: The current .NET SDK does not support ...
If it contains an SDK version, delete the sdk node and all its children, or update it to the desired newer .NET Core...
Read more >
Deep-dive into .NET Core primitives: deps.json ...
Runtime.dll file we provided is newer, Version=4.2.0.0 . The compiler is warning because there could be issues when you run the application ......
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found