views:

52

answers:

1

Hello all,

I have an application that compiles some code dynamically, and creates an assembly as well.

I use the CodeDomProvider class with the CompilerParameters class in order to compile the files.

I add references with the ReferencedAssemblies.Add() method, and I need to add adittional assemblies as well (MyApp.dll) - And as far as I understanded, this is the source of the problem.

In the CompilerResults > Errors, there are no errors in the output of the compilation, BUT,

When I add the above created assembly to an application, it is added with a "!" mark on it, and the namespaces within it aren't recognized at all, and it cannot be accessed by the object browser as well.

Can someone point me to my problem\mistake?

I hope I was clear enough, my English isn't perfect at all, and this whole subject is a little bit complicated to explain.

Thanks alot in advance!

Gal.

+1  A: 

It's not really clear what's going on, but my suspicion based on your question title is that you're compiling an assembly against .NET 4, but then trying to use it in a .NET 3.5 project. That won't work. You'll need to build your assembly against 3.5.

Jon Skeet
Thanks for the answer Jon. Let me try be more clear... The machine that compiles the code, and the machine who opens it as an application reference, runs 4.0 framework.
Gal V
@Gal V: But if you're using Visual Studio 2008, you must be trying to add the reference to a .NET 3.5 project.
Jon Skeet
So as I understand from your answer, is that the only way for open this file, is to open it under VS2010 even if I have 4.0 framework installed ?
Gal V
@Gal V: Or build it targeting 3.5 to start with.
Jon Skeet