Could not load file or assembly 'System.Runtime, Version=4.1.0.0'
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()
I using AssemblyLoadContext in my application so I have "System.Runtime.Loader": "4.0.0" as dependency but after publish my project I have above error.
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"
}
}
}
.NET Framework 4.6.2
with visual studio I can run my application but with dotnet command line I have above error. Can somebody help me ?
I introduced this issue with more details here https://github.com/dotnet/coreclr/issues/7154
I also have a similar problem here. A website with Aspnet Core + net462 and ClassLibrary with netstandard1.5. I've tried to Nuget-install the latest System.Runtime, but no use. After I manually copied System.Runtime.dll from Nutget cache directory to website's Debug\bin, the problem solved.
I am getting issue
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.
I have same issue, I'm trying to deploy .net core app for net462 and after installing DotNetCore.1.1.0.Preview1-WindowsHosting.exe the iis understands the web.config, and routes the request to the ASP.NET however the ASP.NET core throws an exception.
FileLoadException: Could not load file or assembly 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Update answer for my problem was here - https://stackoverflow.com/questions/45894659/fileloadexception-could-not-load-file-or-assembly-system-runtime-version-4-2-0
I had the same issue. I emptied the bin folder on my local machine and performed Build operation again, then published the new bin folder to the server and it started working.