【发布时间】:2018-08-04 04:47:38
【问题描述】:
我正在运行 VS 2017 RC4。
我在我的 .NET Core 应用程序中添加了一个对我的 .NET 4.5 dll 的引用,它可以编译。当在运行时调用引用 dll 的行时,我得到:
System.IO.FileNotFoundException: 'Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.'
此图像显示要使用 4.5 引用,我需要使用 netstandard 1.1。 https://msdnshared.blob.core.windows.net/media/2016/07/172.png
假设这是我需要的,我如何在我的 .csproj 中引用它?我只能找到使用 project.json 时的旧文档。
我尝试添加以下内容,但没有帮助:
<NetStandardImplicitPackageVersion>1.1</NetStandardImplicitPackageVersion>
另外,我需要补充:
<RuntimeFrameworkVersion>1.0.3</RuntimeFrameworkVersion>
或者我得到 FileNotFoundException:无法加载文件或程序集。系统找不到指定的文件。
为什么会这样?
这是我的 .csproj 的相关部分:
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
<RuntimeFrameworkVersion>1.0.3</RuntimeFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="My4.5dll">
<HintPath>Dlls\My4.5dll.dll</HintPath>
</Reference>
</ItemGroup>
【问题讨论】:
标签: c# asp.net-core