ASP.NET Core 2.0无法加载文件或程序集System.ServiceModel [英] ASP.NET Core 2.0 Could not load file or assembly System.ServiceModel
问题描述
我正在努力将根据.NET Framework 4.6.1(即完整框架)进行编译的"ASP.NET Core Web应用程序"移植到针对.NET Core 2.0进行编译的过程中.我有一些依赖项仍然需要完整的框架,但是有了.NET 2.0,我的理解是,我现在可以从.NET Core 2.0编译的应用程序中引用完整的框架程序集.
I am working on porting an "ASP.NET Core Web Application" that was compiling under the .NET Framework 4.6.1 (i.e. full framework) over to compiling against .NET Core 2.0. I have some dependencies which still require the full framework but with .NET 2.0 my understanding is that I can now reference full framework assemblies from within a .NET Core 2.0 compiled application.
当我尝试运行项目时,出现以下错误:
When I attempt to run the project, I get the following error:
无法加载文件或程序集'System.ServiceModel,版本= 4.0.0.0,区域性=中性,PublicKeyToken = b77a5c561934e089'.系统找不到指定的文件.
我浏览了我所引用的所有NuGet软件包和项目,但没有一个引用System.ServiceModel.Web,但我不认为这与System.ServiceModel相同.当我打开位于bin文件夹中的projectname.deps.json文件时,在"Microsoft.NETCore.App/2.0.0"部分下看到了对System.ServiceModel.Web的引用,但没有看到System.ServiceModel的引用.以下行: "ref/netcoreapp2.0/System.ServiceModel.Web.dll":{},
I looked through all the NuGet packages and projects I'm referencing and none of them reference System.ServiceModel.Web but I'm not convinced that's the same as the System.ServiceModel. When I open the projectname.deps.json file located in the bin folder, I see a reference to System.ServiceModel.Web but no reference to System.ServiceModel under the "Microsoft.NETCore.App/2.0.0" section which contains the following line: "ref/netcoreapp2.0/System.ServiceModel.Web.dll": {},
我还在"C:\ Program Files \ dotnet \ shared \ Microsoft.NETCore.App \ 2.0.0"文件夹中闲逛,然后看到了System.ServiceModel.Web.dll.
I also poked around in the "C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.0" folder and I see a System.ServiceModel.Web.dll.
我没有做任何WCF工作,正如我所说,我已经查看了我正在使用的库的所有依赖关系,而且它们似乎都没有引用System.ServiceModel.
I'm not doing any WCF work and as I stated I've looked at all the dependencies of the libraries I'm using and none of them appear to be referencing System.ServiceModel.
还有其他人遇到这个问题吗?我感谢任何人可能拥有的所有见解.
Has anyone else run into this issue? I appreciate any and all insights anyone might have.
推荐答案
我解决了安装Nuget软件包的问题:
I solved this problem installing the Nuget package:
Install-Package Microsoft.Windows.Compatibility
我使用的是ASP.net Core 2.2,但也许也适用于2.0v
I was using ASP.net Core 2.2 but maybe works for 2.0v too
这篇关于ASP.NET Core 2.0无法加载文件或程序集System.ServiceModel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!