tags:

views:

20

answers:

1

Hi,

im trying to compile an assembly at runtime with CSharpCodeProvider and i would like to know which compiler switch to use to target for example .NET Framework 2.0.

+1  A: 

You should be able to do something like this:

Dictionary<string,string> options = new Dictionary<string,string>
{ 
    {"CompilerVersion", "v2.0"}
};

var compiler = new CSharpCodeProvider(options);
TheCloudlessSky
It kinda works but how do i check if it is really is on 2.0 base ?
Chilln
@Chilln - What do you mean it kind of works? What about it isn't working?
TheCloudlessSky
No the thing is just, im abit confused, if i just use the C# Compiler v2.0 or target the Framework v2.0 or is this the same?
Chilln
@Chilln - Setting `CompilerVersion` does indeed target the `v2.0 Framework`
TheCloudlessSky