无法在.NET Core中加载文件或程序集"System.Runtime,Version = 4.1.0.0"

NBM*_*NBM 6 c# .net-core

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

   at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
   at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
   at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
   at System.Attribute.GetCustomAttributes(Assembly element, Type attributeType, Boolean inherit)
   at System.AppDomain.GetTargetFrameworkName()
Run Code Online (Sandbox Code Playgroud)

我在我的应用程序中使用AssemblyLoadContext,所以我有"System.Runtime.Loader":"4.0.0"作为依赖,但在发布我的项目后,我有上面的错误.

dotnet --version
1.0.0-preview2-003121

{
  "version": "1.0.0-*",
  "buildOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "Microsoft.NETCore.App": {
      "type": "platform",
      "version": "1.0.0"
    },
    "CommandLineArgumentsParser": "3.0.4",
    "System.Runtime.Loader": "4.0.0",
    "Microsoft.Extensions.DependencyModel": "1.0.0",
    "System.Runtime": "4.1.0"
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": "dnxcore50"
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

使用visual studio我可以运行我的应用程序但是使用dotnet命令行我有上面的错误.有人能帮助我吗?

小智 0

项目文件夹中的“dotnet Restore”?(我遇到了这样的问题 rc2 -> project.lock.json 在解决方案级别“恢复”后不包含右 Arch 的 lib 链接)