I've got a visual studio 2010 project which publishes an assembly called myAssembly.ddl
.
I then want to reference myAssembly.dll
from an existing vs 2008 project. If I try to load the reference it comes up with an yellow exclamation mark next to it, suggesting that the assembly wasn't loaded. However, I'm not getting any error messages during that process. Obviously, if i try to import the namespace in my code it doesn't compile.
Converting myAssembly.dll
to a .net version 3.5 doesn help.
Nor does copying the assembly to a different directory and referencing it from there.
Any ideas?
Which .NET Framework are you using to build the solution in Visual Studio 2008?
It needs to be version 3.5 in order to allow you to utilize the myAssembly.dll that you compiled with the 3.5 framework. Visual Studio 2008 will allow you to target the 2.0 Framework or even the 3.0 Framework.
Visual Studio 2008
Project > Properties > Application tab Look for Target Framework
I get a repro for this. It is visible in Ildasm.exe, the 2010 compiler marks the metadata as v4.0.30319. You can also see it with Corflags.exe. The 2008 build system generates a warning for this, you can see it in the Output window:
Changing the Target Framework to 3.5 fixes the problem, the assembly will now be marked as v2.0.50727, the CLR version used in 2005 and 2008. The IDE is however not smart enough to detect this change. You'll have to remove the assembly reference, then put it back in. And the yellow exclamation mark is no longer there.