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.

Runtime for migration bundle creation in Net7

See original GitHub issue

When I create a migration bundle and do not specify a runtime, it looks like the subsequent build step does not specify a runtime. The creation of the bundle (from the verbose logging: dotnet publish --runtime win-x64) however does specify a runtime. This part then fails with ‘error NETSDK1112: The runtime pack for Microsoft.NETCore.App.Runtime.win-x64 was not downloaded.’.

I can work around this by running a build specifying the runtime, and then a ‘dotnet ef migrations bundle --no-build’ succeeds.

So for example on my windows dev machine this fails:

dotnet ef migrations bundle -r linux-x64 -v

error: ‘error NETSDK1112: The runtime pack for Microsoft.NETCore.App.Runtime.linux-x64 was not downloaded. Try running a NuGet restore with the RuntimeIdentifier ‘linux-x64’

and this succeeds:

dotnet build -r linux-x64
dotnet ef migrations bundle -r linux-x64 --no-build

I think that when creating a bundle, the build and publishing of the bundle should specify the same runtime.

Issue Analytics

  • State:open
  • Created 8 months ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
bricelamcommented, Feb 28, 2023

I wasn’t able to repro it either. I think we’re missing a piece of the puzzle.

FYI that hack shouldn’t be needed anymore in net 7.0.

True, but trying to figure out which version of the SDK they’re using is a lot more work than just leaving it in. 😉

1reaction
bricelamcommented, Feb 15, 2023

Here’s a repro project that takes dotnet ef out of the picture. The bundle project (that we call dotnet publish on) looks like this:

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net7.0</TargetFramework>
    <PublishSingleFile>True</PublishSingleFile>
    <IncludeNativeLibrariesForSelfExtract>True</IncludeNativeLibrariesForSelfExtract>
    <ValidateExecutableReferencesMatchSelfContained>False</ValidateExecutableReferencesMatchSelfContained>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.2" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\App\App.csproj">
      <!-- HACK: Work around dotnet/sdk#10566 -->
      <GlobalPropertiesToRemove>SelfContained</GlobalPropertiesToRemove>
    </ProjectReference>
  </ItemGroup>

</Project>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrate from ASP.NET Core 6.0 to 7.0
Create a new 7.0 Blazor project from one of the Blazor project templates. For more information, see Tooling for ASP.NET Core Blazor.
Read more >
Breaking changes in .NET 7
Navigate to the breaking changes in .NET 7. ... load and execute successfully without recompilation, and the run-time behavior won't change.
Read more >
Migrate your database using Entity Framework Core ...
Learn how to use EF Core's new Migration Bundles feature, how to generate bundles, and how to execute them to migrate your databases....
Read more >
.NET 7 Entity Framework/EF7 - Install And Code First ...
First, create a new .NET 7 console project and install EF7 using the NuGet Package Manager console or the dotnet CLI as described...
Read more >
Upgrade to .NET 7: Simplified Migration for Legacy .NET Apps
NET Upgrade Assistant is a tool created by Microsoft that helps with the migration from ... NET Upgrade Assistant (Visual Studio Extension): ...
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