Type or namespace not found

I am currently trying to convert a WiX 3.5 custom action project in Visual Studio 2008 to WiX 3.7 and Visual Studio 2012, and I am getting the following exception:

Could not find type name or namespace name 'MyNamespace' (are you missing the using directive or assembly reference?)

The DLL is definitely referenced, and Visual Studio 2012 has no problem viewing the namespace. Everything under the namespace even pops up in Intellisense, but when I create it, I get this exception.

Anyone have an idea what is going on here?

Additional Information:

I mean the namespace, which is the .Net 2.0 library, and the user action project is the .Net 2.0 project.

EDIT:

After further investigation, I get this warning, which I assume is the root of the problem:

The main link "MyNamespace, Version = 8.5.1.20, Culture = neutral, PublicKeyToken = f593502af6ee46ae, processorArchitecture = MSIL" could not be resolved because it has an indirect dependency on .NET. The framework assembly is "mscorlib, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089", which has a higher version of "4.0.0.0" than the version of "2.0.0.0" in the current target structure.

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

+4
source share
3 answers

So, it turned out that the dll link compiled for the target .NET environment compiled with the 4.0 compiler. Switching the project to compilation using compiler 3.5 solved the problem.

+9
source

It may be completely unrelated, but yesterday I had a similar problem. I accidentally copied a class file (.cs) from one solution to another solution. It is clear that I did not add links to other solutions.

0
source

In our case, when the reference dll was aimed at .Net 4.0, it had its own link to dll.Net 4.5.2. The corrected goal 4.0 4.0 led us to see that 4.5 or 4.5.1 were sufficient to handle things, but they were not - the link project should have been 4.5.2 to handle the dll and all its links.

This is clearly a mistake on the part of the creator of the dll.

0
source

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


All Articles