VS 2010 .NET Framework issue with assembly assembler 3.5 complains that it needs a later version of the .NET framework

I have a weird issue with a build designed for .NET 3.5. When you enable this assembly through Add Links / Browse in a DLL - it complains:

"MyAssembly.dll" or one of its dependencies requires a later version of the .NET Framework than those specified in the project. You can change the target of the .NET Framework by clicking Properties on the Project menu, and then selecting a new target from the .NET Framework drop-down list. (In Visual BVasic, this is located on the Compilation tab by clicking on the "Advanced Compiler Options ..." button.) Do you still want to add a link to "MyAssembly.dll" in the project?

There seems to be no rhyme or reason for this error - we tried the โ€œobviousโ€ things.

The assembly consuming the DLL is .NET 3.5. DLLs are .NET 3.5. All the builds that everyone uses are .NET 3.5. Nothing uses .NET 4.0 [AFAIK]

What can I check / do? There are several COM interactions in the DLL - could it be? This project was moved from VS 08 to VS 10, but again, it still targets .NET 3.5. I confirmed that all assemblies listed in the Reference section indicate the correct version of the CLR [2].

Upgrading the target project to .NET 4 fixes the problem - but that's not what we can do at this time.

  • It should also be noted that including it through a link / project [the same solution] seems to work - when lowering the DLL to .NET 3.0. [this may not be entirely accurate - many things have been verified]

I have no ideas at the moment.

+4
source share
2 answers

It turns out that the problem is ... oddly enough .. with Janus Controls.NET 3.5 components .. donโ€™t play well with others, as it seems.

Today, Janus Controls [GridEX] do not work with VS 10 and .NET 3.5, ... only with .NET 4 projects, even if the solution was built into .NET 3.5 and VS 2008.

+2
source

I assume that you have already used Reflector or ILDASM to verify the manifest of the assemblies causing the problem.

One option is to ignore the message and add the link anyway. Then try using any type in the assembly. You should receive a more complete error message.

For example, this is an error that I get on my computer when I try to reference a class library aimed at a higher structure:

The main reference "ClassLibrary2" cannot be resolved because it has an indirect dependency on the .NET Framework assembly "mscorlib, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089", which has a higher version of "4.0. 0.0" than version 2.0.0.0 in the current target structure. ConsoleApplication1

Hope this helps identify the problem.

+1
source

Source: https://habr.com/ru/post/1311815/


All Articles