Dll .NET Framwerok 3.5 with references to DLL 4.5 (Do not Compile) C #

1

I am making a class library (DLL) to create a automation for Dynamics NAV 2009.

My idea is to create a DLL that contains another embedded Inside (I've done it before) using:

link

The problem is that in order for the automation to be valid for Dynamics NAV 2009, it must be at most compiled in the .NET Framework 3.5, but the DLL embedded in the project as a reference is 4.5

At the time of compiling, it says the following:

  

Severity Code Description Project File Line Deletion status   Warning The main reference "Microsoft.Dynamics.Nav.MX" is not   could resolve because it was generated with the .NET Framework version   ".NETFramework, Version = v4.5". This is a later version of the   current destination .NET Framework version   ".NETFramework, Version = v3.5". Dynasoft.Dynamics.Nav.MX

Is there any possibility to use a reference created in framework 4.5 for a project in 3.5?

Greetings and thanks

    
asked by Wierdoz 01.02.2016 в 17:59
source

3 answers

2

What I would recommend is that dll instead of embedding one within others register them in GAC Analyzing the documentation

Extending Microsoft Dynamics NAV Using Microsoft .NET Framework Interoperability

The use of the GAC is mentioned as a means to publish .net components and consume them from Dynamic NAV. If you have both frameworks installed on the server, the libraries could interact with each other.

    
answered by 02.02.2016 в 19:22
1

I agree with Leandro Tuttini, maybe if you register the assemblies in GAC the problem will be solved.

For contributing something else, the problem could also be in the references to the interoperability assemblies of Navision and that, with "The main reference", refer to Ensamblados de Interoperabilidad Primarios (PIA)

What could be happening is that references to assemblies of Interop of Navision are not correct. Something that could solve it is to add the references through the assembly files and not from COM (I do not know if this is the case).

Another thing that usually gives problems when working with references Interop is the option Embed interoperability types that in most cases you have to disable

    
answered by 02.02.2016 в 23:17
1

If it is not possible to use 3.5 in your auxiliary library, with 4.5 you should sign it and register it in the GAC.

You may have to modify the call between the libraries, instead of referencing them or using calls dynamically in your code .

Microsoft does not recommend gacutil for production environments although it works , it advises to create an installer for distribution.

On the target machine you must have both frameworks installed, if the operating system is < a href="https://es.stackoverflow.com/questions/138985/registrar-dll-en-gac-en-windows-server-2003-sobre-framework-4-0"> Windows Server 2003 you will not be able to do it ...

    
answered by 19.03.2018 в 14:48