netCore 1.1 incompatibility with .Net Framework 4.6.1 in aspx project

1

in my company we have a project that was built using .netcore v 1.1. The project contains all the classes used by a web service, also built in v1.1. I am attempting to write a tester for the API in an aspx project and wanted to reference that set of classes, either as an included project or even as a DLL.

I'll skip over the hell I had trying to get this to work with included projects and jump to having my web app reference the dll. When I start up the app (in development, VS2017) it compiles okay, but the first instance of trying to create an object from that dll, I get this error:

Could not load file or assembly 'System.Runtime, Version=4.1.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)

I have looked around the web and there are all sorts of question/answers that either do not relate or don't make sense.

I did add binding redirects, but it did not change the error:

  <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
  </dependentAssembly>

From my view, this should a straight forward use of a dll, no cloud, no major fancy stuff just a .net (4.6.1) program using a referenced dll (1.1 core). I admit to not being versed in the intricacies of DLL these days, but I thought Microsoft was working to get us past DLL Hell.

c#
asp.net
.net
dll
.net-core
asked on Stack Overflow Oct 30, 2018 by j.hull

1 Answer

0

As mentioned here, you may need to target multiple framework.

<PropertyGroup><TargetFrameworks>net452;netstandard1.3</TargetFrameworks></PropertyGroup>

You may end up updating to latest .NET Core or Standard Version.

This sample from github may give you a more clear idea, it was mentioned at this article, which explains different scenarios to combine projects using two frameworks as well as, scenarios where it is beneficial to keep them seperate.

answered on Stack Overflow Oct 30, 2018 by Hitesh Gaur

User contributions licensed under CC BY-SA 3.0