madskristensen / BundlerMinifier

Visual Studio extension
Other
614 stars 172 forks source link

Could not load file or assembly 'Newtonsoft.Json, Version=13.0.0.0 #556

Closed thewaywest closed 3 years ago

thewaywest commented 3 years ago

Installed product versions

Description

Product working New machine. Installed VS2019 + Newtonsoft.json 13.0.1 and dropped new (previously working) code from repo to local. BundlerMinifier 3.2 installed by default. Running "update bundles" bundleconfig.json in place, Runtime error minifying file. Tried backing off to Newtonsoft 12.x, same result.

Steps to recreate

  1. Select any .js file
  2. Richt-click > Bundler Minifier > Minify file

Current behavior

Console reports:

5/7/2021 11:32:37 AM: Processing file 'D:\Projects\lumisourceproducts\bundleconfig.json' results in exception:
System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
   at BundlerMinifier.BundleHandler.TryGetBundles(String configFile, IEnumerable`1& bundles)
   at BundlerMinifier.BundleHandler.GetBundles(String configFile) in E:\Developer\NewCode\BundlerMinifier\src\BundlerMinifier.Core\Bundle\BundleHandler.cs:line 78
   at BundlerMinifier.BundleFileProcessor.Process(String fileName, IEnumerable`1 bundles) in E:\Developer\NewCode\BundlerMinifier\src\BundlerMinifier.Core\Bundle\BundleFileProcessor.cs:line 35
   at BundlerMinifierVsix.BundleService.<>c__DisplayClass8_0.<Process>b__0(Object o) in E:\Developer\NewCode\BundlerMinifier\src\BundlerMinifierVsix\BundleService.cs:line 112

This version of Newstonsoft doesn't exist. Some technotes report there is some conflict... somewhere. Build in test without bundling works fine, but bundling/minifying chokes.

Packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Antlr" version="3.5.0.2" targetFramework="net45" />
  <package id="BuildWebCompiler" version="1.12.405" targetFramework="net452" />
  <package id="DotNetZip" version="1.13.3" targetFramework="net452" />
  <package id="elmah" version="1.2.2" targetFramework="net45" />
  <package id="elmah.corelibrary" version="1.2.2" targetFramework="net45" />
  <package id="elmah.sqlserver" version="1.2" targetFramework="net45" />
  <package id="EntityFramework" version="6.2.0" targetFramework="net452" />
  <package id="IronRuby" version="1.1.3" targetFramework="net45" />
  <package id="jQuery" version="3.4.1" targetFramework="net452" />
  <package id="jQuery.UI.Combined" version="1.12.1" targetFramework="net452" />
  <package id="jQuery.Validation" version="1.17.0" targetFramework="net452" />
  <package id="Markdig" version="0.17.1" targetFramework="net452" />
  <package id="Microsoft.AspNet.Mvc" version="5.2.7" targetFramework="net452" />
  <package id="Microsoft.AspNet.Razor" version="3.2.7" targetFramework="net452" />
  <package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net452" />
  <package id="Microsoft.IO.RecyclableMemoryStream" version="1.4.1" targetFramework="net48" />
  <package id="Microsoft.Office.Interop.Excel" version="15.0.4795.1000" targetFramework="net45" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
  <package id="Microsoft-WindowsAPICodePack-Core" version="1.1.3.3" targetFramework="net452" />
  <package id="Microsoft-WindowsAPICodePack-Shell" version="1.1.3.3" targetFramework="net452" />
  <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
  <package id="SassAndCoffee.AspNet" version="2.1.1.0" targetFramework="net45" />
  <package id="SassAndCoffee.Core" version="2.1.1.0" targetFramework="net45" />
  <package id="SassAndCoffee.JavaScript" version="2.1.1.0" targetFramework="net45" />
  <package id="SassAndCoffee.Ruby" version="2.1.1.0" targetFramework="net45" />
  <package id="SSH.NET" version="2016.1.0" targetFramework="net452" />
  <package id="System.Linq.Dynamic" version="1.0.7" targetFramework="net452" />
  <package id="System.Net.Http" version="2.0.20126.16343" targetFramework="net452" />
  <package id="System.Net.Http.Formatting.Extension" version="5.2.3.0" targetFramework="net452" />
  <package id="WebGrease" version="1.6.0" targetFramework="net45" />
</packages>

Expected behavior

Files minify/bundle without error.

thewaywest commented 3 years ago

I just created a brand-new project with no dependencies, without the BuildBundlerMinifier, and get the same issue. Must be a platform issue.

UPDATE: Colleague on another machine reports the same problem, VS 2019 etc etc

thewaywest commented 3 years ago

My old machine was running the beta version @ 3.2.463. I installed the production .VSIX on the new machine, thinking that it was probably solid for recent config -- when I received a new/strange(r) error message, that appeared to be runtime, I was thrown for a loop.

Got back into my failed machine and found I was running a more recent beta version there @ 3.2463. Tracked the current builds down to this website, installed 3.2.476, and all is building correctly again.

Thanks for the ongoing work, team!