adams85 / bundling

A library for optimizing and bundling web assets of ASP.NET Core applications.
MIT License
44 stars 7 forks source link

Are there plans to update bundling tools to target .NET 7? #19

Closed jsholzer closed 1 year ago

jsholzer commented 1 year ago

Are there plans to update the tools application to target .NET 7?

Currently, the tools appear to require the .NET Core 3 runtime.

I've included my command line output to show the runtimes and SDKs that are available in my local environment, as well as the output from running dotnet-bundle --version

> dotnet --list-runtimes
Microsoft.AspNetCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.21 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

> dotnet --list-sdks
6.0.413 [C:\Program Files\dotnet\sdk]
7.0.201 [C:\Program Files\dotnet\sdk]
7.0.307 [C:\Program Files\dotnet\sdk]

> dotnet tool install -g dotnet-bundlingtools
You can invoke the tool using the following command: dotnet-bundle
Tool 'dotnet-bundlingtools' (version '3.6.1') was successfully installed.

> dotnet-bundle --version
You must install or update .NET to run this application.

App: C:\Users\jholzer\.dotnet\tools\dotnet-bundle.exe
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '3.0.0' (x64)
.NET location: C:\Program Files\dotnet\

The following frameworks were found:
  5.0.17 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  6.0.13 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  6.0.14 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  6.0.15 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  6.0.16 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  6.0.18 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  6.0.20 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  6.0.21 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  7.0.3 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  7.0.10 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

Learn about framework resolution:
https://aka.ms/dotnet/app-launch-failed

To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.0.0&arch=x64&rid=win10-x64
adams85 commented 1 year ago

As a matter of fact, .NET 7 should run the bundle tool without problems, even if it targets .NET Core 3. However, it seems the default roll forward policy prevent this.

As a quick fix, you can override this behavior by setting the DOTNET_ROLL_FORWARD environment variable as follows:

I'll try to find a permanent solution to the issue which doesn't require this workaround.

adams85 commented 1 year ago

FYI, the latest release (v3.7.0) fixes the issue.