madskristensen / BundlerMinifier

Visual Studio extension
Other
611 stars 171 forks source link

bundlerminifier.core/3.2.449 requires .NET Core 2.x #592

Closed sprudel79 closed 1 year ago

sprudel79 commented 1 year ago

Hi everyone, thanks for this great tool, we've been using it for years and were able to bundle/minify our ASP.NET Core 3.1 projects. We've switched to ASP.NET 6 in the meantime and I have recognized locally on my Ubuntu 22.04 based Linux environment with only .NET 6 / .NET 7 installed that I get an error now.

First of all, here's the relevant snippet of my project file:

...
<ItemGroup>
    <DotNetCliToolReference Include="BundlerMinifier.Core" Version="3.2.449" />
  </ItemGroup>
  <Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
    <Exec Command="dotnet bundle" />
  </Target>
...

When I execute a dotnet publish command, I get the following output: You must install or update .NET to run this application.

App: /home/tbu/.nuget/packages/bundlerminifier.core/3.2.449/lib/netcoreapp2.0/dotnet-bundle.dll
  Architecture: x64
  Framework: 'Microsoft.NETCore.App', version '2.0.0' (x64)
  .NET location: /usr/share/dotnet/

  The following frameworks were found:
    6.0.13 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
    7.0.2 at [/usr/share/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=2.0.0&arch=x64&rid=linuxmint.21.1-x64

Since this .NET Core version is EOL may I request to update the package to be based on current LTS version 6? Many thanks in advance!

dcmwong commented 1 year ago

I also got this error so I installed .netcore 2.0 on the linux machine and then I got an error about netcore 1.0.0 at which point I could not resolve it by installing dotnetcore 1.0.

However we run linux agents on our TeamCity pipeline and that displays a different error:

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'System.Linq, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
[11:08:06](https://teamcity.nice.org.uk/buildConfiguration/GuidanceWeb_BuildAndPublish2/110507?mode=branches&showLog=110507_7298_7298)
         at BundlerMinifier.BundleHandler.TryGetBundles(String configFile, IEnumerable`1& bundles)
[11:08:06](https://teamcity.nice.org.uk/buildConfiguration/GuidanceWeb_BuildAndPublish2/110507?mode=branches&showLog=110507_7299_7299)
         at BundlerMinifier.Program.GetConfigFileFromArgs(String[] args, String& configPath)
[11:08:06](https://teamcity.nice.org.uk/buildConfiguration/GuidanceWeb_BuildAndPublish2/110507?mode=branches&showLog=110507_7300_7300)
         at BundlerMinifier.Program.Main(String[] args)
[11:08:06](https://teamcity.nice.org.uk/buildConfiguration/GuidanceWeb_BuildAndPublish2/110507?mode=branches&showLog=110507_7301_7301)
    /etc/teamcity/work/b09d6adc2857d3c5/**/*****(38,5): error MSB3073: The command "dotnet bundle" exited with code 134.

Does anyone have any solutions to this?

sprudel79 commented 1 year ago

It looks like this project is no longer active so I have decided to move to a different solution. There are definitely multiple ways to ensure the js / css files got properly minified. I ended up using this project https://github.com/ligershark/WebOptimizer to do that dynamically.

dcmwong commented 1 year ago

Funnily my manager suggested the same thing. There's also this https://www.nuget.org/packages/BundlerMinifier.Core.Tool which is an updated fork of this tool

sprudel79 commented 1 year ago

Nice, thanks for sharing @dcmwong !

ngorevsk commented 4 months ago

Had the same issue. Installing .NET Core 2.1 (SDK 2.1.818) fixed it for me!