Visual Studio 将数据集添加到报表时崩溃,无法加载文件或程序集

Visual Studio Crashes When Adding a DataSet to a Report, Could not load file or assembly

使用报表设计器将数据集添加到 .rdlc 报表时,Visual Studio 崩溃。 VS 留下一个 failure.txt 文件并出现此错误:

System.IO.FileNotFoundException: 无法加载文件或程序集 Microsoft.Extensions.DependencyInjection.Abstractions,版本=3.1.0.0

当我们将 Intuit QuickBooks Online NuGet 包 (IppDotNetSdkForQuickBooksApiV3) 从 v8 升级到 v14 时出现问题。此升级带来了十几个其他依赖包,包括导致上述 FileNotFoundException 的包。

我们无法将数据集添加到报表中,也无法获取报表中已存在的数据集的属性。显然,这是开发报告的真正障碍。有人有什么建议吗?

更多背景:

这是一个已经投入生产多年的大型网络表单应用程序。我们使用的是最新版本的 Visual Studio,Community 2019 版本 16.6.3。我们在 运行 Windows 10 Pro 下进行所有更新。我们发现两个不同的开发人员在不同的 PC 上遇到了同样的问题。

VS 具有最新版本的 RDLC 报表设计器扩展 v15.3.1。我们的应用程序以 .Net 4.7.2 为目标。

NuGet 包“Microsoft.ReportingServices.ReportViewerControl.WebForms 150.1404.0”已安装。

NuGet 包“Microsoft.Extensions.DependencyInjection.Abstractions v3.1.5”已安装。请注意,该错误抱怨 v3.1.1.0 和更早版本。我在 web.config 文件中有一个绑定重定向来处理这个 (bindingRedirect oldVersion="0.0.0.0-3.1.5.0" newVersion="3.1.5.0").

此解决方案中还有大约 70 个其他包,并且都是最新的。

我尝试过的事情:

到目前为止,我已经在这个问题上花了几天时间。有几个 SO 帖子列出了类似的错误,但它们似乎不适用于我的情况。

我已经删除了所有 NuGet 包、解决方案的“packages”文件夹以及配置和 csproj 文件中的所有引用。我已经重置 Windows 并从头开始安装 VS。我仅添加回所需的 NuGet 包。没有帮助。

如果我删除项目的 bin 和 obj 文件夹,重新启动 VS,并重建解决方案,VS 不会崩溃 - 耶!但是更新数据集不会显示数据集字段的变化,所以它真的没有帮助。此外,如果您退出并重新启动 VS,崩溃又回来了。

我尝试将有问题的软件包从 v3.1.5 降级到所需的 3.1.0。我的想法是,如果不需要绑定重定向,那就没有问题了。但是当我尝试这个时,其他包出现了同样的错误,并且不断。我放弃了,因为与 Intuit 的 IppDotNetSdkForQuickBooksApiV3 相关的包太多了。

我尝试创建一个只有一个空报告的新项目,没有其他内容。我添加了 Intuit 包及其所有依赖项(包括有问题的)。令人惊讶的是,一切正常,我可以在报告中添加和编辑数据集。这让我怀疑包之间可能存在冲突,或者我们的解决方案中存在更深层次的问题。不过,不知道它可能是什么。

我打开了FusionLog,重现了这个问题。我附上了 failure.txt 文件的输出。

=====融合日志=====

*** Assembly Binder Log Entry  (7/13/2020 @ 3:32:19 PM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\devenv.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = Microsoft.Extensions.DependencyInjection.Abstractions, Version=3.1.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
 (Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = devenv.exe
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\sandygettings\AppData\Local\Microsoft\VisualStudio.0_968c7791\devenv.exe.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.Extensions.DependencyInjection.Abstractions, Version=3.1.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/Microsoft.Extensions.DependencyInjection.Abstractions.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/Microsoft.Extensions.DependencyInjection.Abstractions/Microsoft.Extensions.DependencyInjection.Abstractions.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/PublicAssemblies/Microsoft.Extensions.DependencyInjection.Abstractions.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/PublicAssemblies/Microsoft.Extensions.DependencyInjection.Abstractions/Microsoft.Extensions.DependencyInjection.Abstractions.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/PrivateAssemblies/Microsoft.Extensions.DependencyInjection.Abstractions.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/PrivateAssemblies/Microsoft.Extensions.DependencyInjection.Abstractions/Microsoft.Extensions.DependencyInjection.Abstractions.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/CommonExtensions/Microsoft/TestWindow/Microsoft.Extensions.DependencyInjection.Abstractions.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/CommonExtensions/Microsoft/TestWindow/Microsoft.Extensions.DependencyInjection.Abstractions/Microsoft.Extensions.DependencyInjection.Abstractions.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/CommonExtensions/Platform/Debugger/Microsoft.Extensions.DependencyInjection.Abstractions.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/CommonExtensions/Platform/Debugger/Microsoft.Extensions.DependencyInjection.Abstractions/Microsoft.Extensions.DependencyInjection.Abstractions.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/PrivateAssemblies/DataCollectors/Microsoft.Extensions.DependencyInjection.Abstractions.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/PrivateAssemblies/DataCollectors/Microsoft.Extensions.DependencyInjection.Abstractions/Microsoft.Extensions.DependencyInjection.Abstractions.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/PrivateAssemblies/DataCollectors/x86/Microsoft.Extensions.DependencyInjection.Abstractions.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/PrivateAssemblies/DataCollectors/x86/Microsoft.Extensions.DependencyInjection.Abstractions/Microsoft.Extensions.DependencyInjection.Abstractions.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/Microsoft.Extensions.DependencyInjection.Abstractions.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/Microsoft.Extensions.DependencyInjection.Abstractions/Microsoft.Extensions.DependencyInjection.Abstractions.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/PublicAssemblies/Microsoft.Extensions.DependencyInjection.Abstractions.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/PublicAssemblies/Microsoft.Extensions.DependencyInjection.Abstractions/Microsoft.Extensions.DependencyInjection.Abstractions.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/PrivateAssemblies/Microsoft.Extensions.DependencyInjection.Abstractions.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/PrivateAssemblies/Microsoft.Extensions.DependencyInjection.Abstractions/Microsoft.Extensions.DependencyInjection.Abstractions.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/CommonExtensions/Microsoft/TestWindow/Microsoft.Extensions.DependencyInjection.Abstractions.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/CommonExtensions/Microsoft/TestWindow/Microsoft.Extensions.DependencyInjection.Abstractions/Microsoft.Extensions.DependencyInjection.Abstractions.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/CommonExtensions/Platform/Debugger/Microsoft.Extensions.DependencyInjection.Abstractions.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/CommonExtensions/Platform/Debugger/Microsoft.Extensions.DependencyInjection.Abstractions/Microsoft.Extensions.DependencyInjection.Abstractions.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/PrivateAssemblies/DataCollectors/Microsoft.Extensions.DependencyInjection.Abstractions.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/PrivateAssemblies/DataCollectors/Microsoft.Extensions.DependencyInjection.Abstractions/Microsoft.Extensions.DependencyInjection.Abstractions.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/PrivateAssemblies/DataCollectors/x86/Microsoft.Extensions.DependencyInjection.Abstractions.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/PrivateAssemblies/DataCollectors/x86/Microsoft.Extensions.DependencyInjection.Abstractions/Microsoft.Extensions.DependencyInjection.Abstractions.EXE.
LOG: All probing URLs attempted and failed.

===== 这是 VS failure.txt 文件 =====

UNHANDLED EXCEPTIONS FROM PROCESS 14132:
=====================
7/13/2020 3:32:26 PM
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
   at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
   at System.Signature..ctor(IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
   at System.Reflection.RuntimeConstructorInfo.GetParametersNoCopy()
   at System.RuntimeType.FilterApplyMethodBase(MethodBase methodBase, BindingFlags methodFlags, BindingFlags bindingFlags, CallingConventions callConv, Type[] argumentTypes)
   at System.RuntimeType.GetConstructorCandidates(String name, BindingFlags bindingAttr, CallingConventions callConv, Type[] types, Boolean allowPrefixLookup)
   at System.RuntimeType.GetConstructorImpl(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
   at System.Type.GetConstructor(BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers)
   at Microsoft.ReportDesigner.Design.DesignUtil.GetVenusObjectDataSources(XmlSchema[] schemaDataSources, IServiceProvider serviceProvider)
   at Microsoft.ReportDesigner.Data.Local.DataSetSynchronizer.<GetProjectGenericObjectDataSources>d__11.MoveNext()
   at Microsoft.ReportDesigner.Data.Local.DataSetSynchronizer.<GetSynchableDataSources>d__7.MoveNext()
   at Microsoft.ReportDesigner.Data.Local.Dialogs.Pages.DataSetGeneralPage.LoadDataSources()
   at Microsoft.ReportDesigner.Data.Local.Dialogs.Pages.DataSetGeneralPage.LoadData()
   at Microsoft.ReportDesigner.Data.Local.Dialogs.DataSetDialog.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\devenv.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = Microsoft.Extensions.DependencyInjection.Abstractions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
 (Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/common7/ide/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\sandygettings\AppData\Local\Microsoft\VisualStudio.0_968c7791\devenv.exe.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
===================

=====更新=====

根据 Perry 的建议,我从头开始创建了一个新解决方案,将所有源文件复制到新项目中,并仅安装了所需的 NuGet 包。 VS 仍然以同样的方式崩溃。

这是解决方案中所有包的列表(“packages”文件夹的目录列表):

07/14/2020  01:48 PM    <DIR>          AjaxControlToolkit.20.1.0
07/14/2020  12:24 PM    <DIR>          Fizzler.1.2.0
07/14/2020  02:34 PM    <DIR>          IppDotNetSdkForQuickBooksApiV3.14.0.0
07/14/2020  04:21 PM    <DIR>          Microsoft.AspNet.Cors.5.2.7
07/14/2020  04:21 PM    <DIR>          Microsoft.AspNet.WebApi.Client.5.2.7
07/14/2020  04:21 PM    <DIR>          Microsoft.AspNet.WebApi.Core.5.2.7
07/14/2020  04:21 PM    <DIR>          Microsoft.AspNet.WebApi.Cors.5.2.7
07/14/2020  02:48 PM    <DIR>          Microsoft.Azure.DocumentDB.2.11.2
07/14/2020  02:48 PM    <DIR>          Microsoft.Bcl.AsyncInterfaces.1.1.1
07/14/2020  12:34 PM    <DIR>          Microsoft.CodeDom.Providers.DotNetCompilerPlatform.3.6.0
07/14/2020  02:48 PM    <DIR>          Microsoft.DotNet.PlatformAbstractions.3.1.6
07/14/2020  02:47 PM    <DIR>          Microsoft.Extensions.Configuration.3.1.6
07/14/2020  02:47 PM    <DIR>          Microsoft.Extensions.Configuration.Abstractions.3.1.6
07/14/2020  02:47 PM    <DIR>          Microsoft.Extensions.Configuration.Binder.3.1.6
07/14/2020  02:47 PM    <DIR>          Microsoft.Extensions.Configuration.FileExtensions.3.1.6
07/14/2020  02:48 PM    <DIR>          Microsoft.Extensions.Configuration.Json.3.1.6
07/14/2020  02:48 PM    <DIR>          Microsoft.Extensions.Configuration.Xml.3.1.6
07/14/2020  02:48 PM    <DIR>          Microsoft.Extensions.DependencyInjection.3.1.6
07/14/2020  02:47 PM    <DIR>          Microsoft.Extensions.DependencyInjection.Abstractions.3.1.6
07/14/2020  02:48 PM    <DIR>          Microsoft.Extensions.DependencyModel.3.1.6
07/14/2020  02:47 PM    <DIR>          Microsoft.Extensions.FileProviders.Abstractions.3.1.6
07/14/2020  02:47 PM    <DIR>          Microsoft.Extensions.FileProviders.Physical.3.1.6
07/14/2020  02:47 PM    <DIR>          Microsoft.Extensions.FileSystemGlobbing.3.1.6
07/14/2020  02:48 PM    <DIR>          Microsoft.Extensions.Logging.3.1.6
07/14/2020  02:47 PM    <DIR>          Microsoft.Extensions.Logging.Abstractions.3.1.6
07/14/2020  02:47 PM    <DIR>          Microsoft.Extensions.Options.3.1.6
07/14/2020  02:47 PM    <DIR>          Microsoft.Extensions.Options.ConfigurationExtensions.3.1.6
07/14/2020  02:47 PM    <DIR>          Microsoft.Extensions.Primitives.3.1.6
07/14/2020  01:48 PM    <DIR>          Microsoft.IdentityModel.JsonWebTokens.6.7.1
07/14/2020  01:48 PM    <DIR>          Microsoft.IdentityModel.Logging.6.7.1
07/14/2020  01:48 PM    <DIR>          Microsoft.IdentityModel.Tokens.6.7.1
07/14/2020  03:59 PM    <DIR>          Microsoft.ReportingServices.ReportViewerControl.WebForms.150.1404.0
07/14/2020  04:01 PM    <DIR>          Microsoft.SqlServer.Types.14.0.1016.290
07/14/2020  01:48 PM    <DIR>          Newtonsoft.Json.12.0.3
07/14/2020  01:48 PM    <DIR>          RestSharp.106.11.4
07/14/2020  02:34 PM    <DIR>          Serilog.2.9.0
07/14/2020  02:34 PM    <DIR>          Serilog.Enrichers.Environment.2.1.3
07/14/2020  02:34 PM    <DIR>          Serilog.Enrichers.Thread.3.1.0
07/14/2020  02:34 PM    <DIR>          Serilog.Extensions.Logging.3.0.1
07/14/2020  02:34 PM    <DIR>          Serilog.Settings.Configuration.3.1.0
07/14/2020  02:34 PM    <DIR>          Serilog.Sinks.AzureDocumentDB.4.0.0
07/14/2020  02:34 PM    <DIR>          Serilog.Sinks.Console.3.1.1
07/14/2020  02:34 PM    <DIR>          Serilog.Sinks.Debug.1.0.1
07/14/2020  02:34 PM    <DIR>          Serilog.Sinks.File.4.1.0
07/14/2020  02:34 PM    <DIR>          Serilog.Sinks.Literate.3.0.0
07/14/2020  02:34 PM    <DIR>          Serilog.Sinks.RollingFile.3.3.0
07/14/2020  02:34 PM    <DIR>          Serilog.Sinks.Trace.2.1.0
07/14/2020  02:34 PM    <DIR>          SerilogTraceListener.3.2.0
07/14/2020  12:24 PM    <DIR>          Svg.3.1.1
07/14/2020  02:47 PM    <DIR>          System.Buffers.4.5.1
07/14/2020  02:47 PM    <DIR>          System.ComponentModel.Annotations.4.7.0
07/14/2020  02:48 PM    <DIR>          System.Configuration.ConfigurationManager.4.7.0
07/14/2020  02:34 PM    <DIR>          System.Diagnostics.Debug.4.3.0
07/14/2020  02:34 PM    <DIR>          System.Diagnostics.TraceSource.4.3.0
07/14/2020  01:48 PM    <DIR>          System.IdentityModel.Tokens.Jwt.6.7.1
07/14/2020  02:34 PM    <DIR>          System.IO.4.3.0
07/14/2020  02:47 PM    <DIR>          System.Memory.4.5.4
07/14/2020  02:34 PM    <DIR>          System.Net.Http.4.3.4
07/14/2020  02:47 PM    <DIR>          System.Net.Http.WinHttpHandler.4.7.2
07/14/2020  02:47 PM    <DIR>          System.Numerics.Vectors.4.5.0
07/14/2020  02:47 PM    <DIR>          System.Runtime.4.3.1
07/14/2020  02:47 PM    <DIR>          System.Runtime.CompilerServices.Unsafe.4.7.1
07/14/2020  04:00 PM    <DIR>          System.Runtime.InteropServices.RuntimeInformation.4.3.0
07/14/2020  02:48 PM    <DIR>          System.Security.AccessControl.4.7.0
07/14/2020  02:48 PM    <DIR>          System.Security.Cryptography.Algorithms.4.3.1
07/14/2020  02:34 PM    <DIR>          System.Security.Cryptography.Encoding.4.3.0
07/14/2020  02:34 PM    <DIR>          System.Security.Cryptography.Primitives.4.3.0
07/14/2020  02:48 PM    <DIR>          System.Security.Cryptography.X509Certificates.4.3.2
07/14/2020  02:48 PM    <DIR>          System.Security.Cryptography.Xml.4.7.0
07/14/2020  02:48 PM    <DIR>          System.Security.Permissions.4.7.0
07/14/2020  02:48 PM    <DIR>          System.Security.Principal.Windows.4.7.0
07/14/2020  02:48 PM    <DIR>          System.Text.Encodings.Web.4.7.1
07/14/2020  02:48 PM    <DIR>          System.Text.Json.4.7.2
07/14/2020  02:48 PM    <DIR>          System.Threading.Tasks.Extensions.4.5.4
07/14/2020  02:48 PM    <DIR>          System.ValueTuple.4.5.0
07/14/2020  01:48 PM    <DIR>          Twilio.5.45.0

这是解决方案中失败项目中的 packages.config 文件:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="AjaxControlToolkit" version="20.1.0" targetFramework="net472" />
  <package id="IppDotNetSdkForQuickBooksApiV3" version="14.0.0" targetFramework="net472" />
  <package id="Microsoft.AspNet.Cors" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebApi.Cors" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.Azure.DocumentDB" version="2.11.2" targetFramework="net472" />
  <package id="Microsoft.Bcl.AsyncInterfaces" version="1.1.1" targetFramework="net472" />
  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="3.6.0" targetFramework="net472" />
  <package id="Microsoft.DotNet.PlatformAbstractions" version="3.1.6" targetFramework="net472" />
  <package id="Microsoft.Extensions.Configuration" version="3.1.6" targetFramework="net472" />
  <package id="Microsoft.Extensions.Configuration.Abstractions" version="3.1.6" targetFramework="net472" />
  <package id="Microsoft.Extensions.Configuration.Binder" version="3.1.6" targetFramework="net472" />
  <package id="Microsoft.Extensions.Configuration.FileExtensions" version="3.1.6" targetFramework="net472" />
  <package id="Microsoft.Extensions.Configuration.Json" version="3.1.6" targetFramework="net472" />
  <package id="Microsoft.Extensions.Configuration.Xml" version="3.1.6" targetFramework="net472" />
  <package id="Microsoft.Extensions.DependencyInjection" version="3.1.6" targetFramework="net472" />
  <package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="3.1.6" targetFramework="net472" />
  <package id="Microsoft.Extensions.DependencyModel" version="3.1.6" targetFramework="net472" />
  <package id="Microsoft.Extensions.FileProviders.Abstractions" version="3.1.6" targetFramework="net472" />
  <package id="Microsoft.Extensions.FileProviders.Physical" version="3.1.6" targetFramework="net472" />
  <package id="Microsoft.Extensions.FileSystemGlobbing" version="3.1.6" targetFramework="net472" />
  <package id="Microsoft.Extensions.Logging" version="3.1.6" targetFramework="net472" />
  <package id="Microsoft.Extensions.Logging.Abstractions" version="3.1.6" targetFramework="net472" />
  <package id="Microsoft.Extensions.Options" version="3.1.6" targetFramework="net472" />
  <package id="Microsoft.Extensions.Options.ConfigurationExtensions" version="3.1.6" targetFramework="net472" />
  <package id="Microsoft.Extensions.Primitives" version="3.1.6" targetFramework="net472" />
  <package id="Microsoft.ReportingServices.ReportViewerControl.WebForms" version="150.1404.0" targetFramework="net472" />
  <package id="Microsoft.SqlServer.Types" version="14.0.1016.290" targetFramework="net472" />
  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
  <package id="Serilog" version="2.9.0" targetFramework="net472" />
  <package id="Serilog.Enrichers.Environment" version="2.1.3" targetFramework="net472" />
  <package id="Serilog.Enrichers.Thread" version="3.1.0" targetFramework="net472" />
  <package id="Serilog.Extensions.Logging" version="3.0.1" targetFramework="net472" />
  <package id="Serilog.Settings.Configuration" version="3.1.0" targetFramework="net472" />
  <package id="Serilog.Sinks.AzureDocumentDB" version="4.0.0" targetFramework="net472" />
  <package id="Serilog.Sinks.Console" version="3.1.1" targetFramework="net472" />
  <package id="Serilog.Sinks.Debug" version="1.0.1" targetFramework="net472" />
  <package id="Serilog.Sinks.File" version="4.1.0" targetFramework="net472" />
  <package id="Serilog.Sinks.Literate" version="3.0.0" targetFramework="net472" />
  <package id="Serilog.Sinks.RollingFile" version="3.3.0" targetFramework="net472" />
  <package id="Serilog.Sinks.Trace" version="2.1.0" targetFramework="net472" />
  <package id="SerilogTraceListener" version="3.2.0" targetFramework="net472" />
  <package id="System.Buffers" version="4.5.1" targetFramework="net472" />
  <package id="System.ComponentModel.Annotations" version="4.7.0" targetFramework="net472" />
  <package id="System.Configuration.ConfigurationManager" version="4.7.0" targetFramework="net472" />
  <package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net472" />
  <package id="System.Diagnostics.TraceSource" version="4.3.0" targetFramework="net472" />
  <package id="System.IO" version="4.3.0" targetFramework="net472" />
  <package id="System.Memory" version="4.5.4" targetFramework="net472" />
  <package id="System.Net.Http" version="4.3.4" targetFramework="net472" />
  <package id="System.Net.Http.WinHttpHandler" version="4.7.2" targetFramework="net472" />
  <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
  <package id="System.Runtime" version="4.3.1" targetFramework="net472" />
  <package id="System.Runtime.CompilerServices.Unsafe" version="4.7.1" targetFramework="net472" />
  <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net472" />
  <package id="System.Security.AccessControl" version="4.7.0" targetFramework="net472" />
  <package id="System.Security.Cryptography.Algorithms" version="4.3.1" targetFramework="net472" />
  <package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net472" />
  <package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net472" />
  <package id="System.Security.Cryptography.X509Certificates" version="4.3.2" targetFramework="net472" />
  <package id="System.Security.Cryptography.Xml" version="4.7.0" targetFramework="net472" />
  <package id="System.Security.Permissions" version="4.7.0" targetFramework="net472" />
  <package id="System.Security.Principal.Windows" version="4.7.0" targetFramework="net472" />
  <package id="System.Text.Encodings.Web" version="4.7.1" targetFramework="net472" />
  <package id="System.Text.Json" version="4.7.2" targetFramework="net472" />
  <package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
  <package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
</packages>

Visual Studio Crashes When Adding a DataSet to a Report, Could not load file or assembly

这个问题,跟你的旧项目比较相关。由于新的VS2019 asp net web项目的结构和功能与之前版本的旧项目有很大不同,因此当您将项目迁移到VS2019时,它可能会不时出现一些问题。

或者您可以尝试以下建议:

1)首先,尝试将相关的dll添加到系统全局程序集缓存中。

运行 以管理员身份运行 CMD 然后输入这些:

cd xxxxx (the path of the the Microsoft.Extensions.DependencyInjection.Abstractions 3.1.0.0) // you can find it in the Microsoft.Extensions.DependencyInjection.Abstractions nuget package version 3.1.0

gacutil /i Microsoft.Extensions.DependencyInjection.Abstractions.dll

2)关闭VS,删除解决方案文件夹下的.vs隐藏文件夹,binobj文件夹

3) 运行 update-package -reinstallPackage Manager Console

======

xxx.csproj 文件中添加:

 <PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>

======

然后,请将所有 nuget 包更新到最新版本,因为您使用的是较新的 net framework 4.7.2。 运行 这个在 包管理器控制台上 :

Update-Package

======

在这些之后,重建您的项目以重试。

此外,

针对大老asp.net web项目升级迁移到新版本VS的问题,由于nuget包比较多,通常涉及到各种技术,升级过程有点复杂,所以我们建议在VS2019中新建一个web项目,然后直接将旧项目的内容迁移到新项目中。

就是你上面说的解决方法。它可能不理想,但它是有效的。

好消息 — 我可以再次编辑报告数据集了!

我做了两件事:

  • 重构了引用 QuickBooks Online DLL 的网页。该代码现已移至单独的库项目中。
  • 使用 VS 扩展 Resharper 查找并删除 未使用的 NuGet 包和项目引用。大概是关于 总计 40/50/60 以上。

我不知道问题的真正原因。我什至可以在新库中添加报告和数据集,而且也能正常工作。我最好的猜测是存在冲突的 NuGet 包或引用,或者它们配置不当。

故事的寓意:将 QuickBooks 代码隔离到一个单独的库中,并删除所有不必要的 NuGet 包和引用。

这两天的工作很扎实,但结果解决了最初的问题。整个项目也被清理干净了。 (感谢 Resharper!)