Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type or namespace could not be found

I'm currently trying to convert a WiX 3.5 custom actions project in Visual Studio 2008 to WiX 3.7 and Visual Studio 2012 and I'm getting the following exception:

The type or namespace name 'MyNamespace' could not be found (are you missing a using directive or an assembly reference?)

The dll is definitely referenced and Visual Studio 2012 has no problem seeing the namespace. Everything under the namespace even pops up in Intellisense, but when I build it I'm getting this exception.

Anyone have an idea of what's going on here?

Additional Info:

The namespace I'm referencing is a .Net 2.0 library and the custom actions project is a .Net 2.0 project.

EDIT:

After further investigation, I'm getting this warning, which I'm guessing is the root of the problem:

The primary reference "MyNamespace, Version=8.5.1.20, Culture=neutral, PublicKeyToken=f593502af6ee46ae, processorArchitecture=MSIL" could not 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 "4.0.0.0" than the version "2.0.0.0" in the current target framework.

Why is it trying to use mscorelib 4.0 when this is a 2.0 project?

like image 589
Seth Moore Avatar asked Jan 13 '23 19:01

Seth Moore


1 Answers

So it turned out that the dll being reference, while compiled to target the .Net 2.0 framework, was being compiled with the 4.0 compiler. Switching the project to compile with the 3.5 compiler solved the problem.

like image 149
Seth Moore Avatar answered Jan 19 '23 11:01

Seth Moore