R
Ravi Bhavnani
I have a .NET 3.5 app (built using VS2008 RTM, no CTPs installed) that uses
CSharpCodeProvider to compile some generated code that requires .NET 3.5.
When I set the compiler's .NET version to 3.5 (per the MSDN example), I get
a "csc.exe not found" exception thrown when I try to compile. Here's what
I'm doing:
// Set up compiler parameters CompilerParameters cp = new
CompilerParameters(); cp.xxx = xxx; // Specify .NET version
Dictionary<string,string> providerOptions = new Dictionary<string,string>();
providerOptions.Add ("CompilerVersion", "3.5"); CSharpCodeProvider
codeProvider = new CSharpCodeProvider (providerOptions); // Do the compile
string sourceCode = "..."; CompilerResults cr =
codeProvider.CompileAssemblyFromSource (cp, sourceCode);If I use
CSharpCodeProvider's default constructor, the code compiles if it's .NET 2.0
compliant, but (expectedly) generates an "unknown reference" error if I try
to reference a .NET 3.5 stock assembly.
A nudge in the right direction would be appreciated.
Thanks!
/ravi
CSharpCodeProvider to compile some generated code that requires .NET 3.5.
When I set the compiler's .NET version to 3.5 (per the MSDN example), I get
a "csc.exe not found" exception thrown when I try to compile. Here's what
I'm doing:
// Set up compiler parameters CompilerParameters cp = new
CompilerParameters(); cp.xxx = xxx; // Specify .NET version
Dictionary<string,string> providerOptions = new Dictionary<string,string>();
providerOptions.Add ("CompilerVersion", "3.5"); CSharpCodeProvider
codeProvider = new CSharpCodeProvider (providerOptions); // Do the compile
string sourceCode = "..."; CompilerResults cr =
codeProvider.CompileAssemblyFromSource (cp, sourceCode);If I use
CSharpCodeProvider's default constructor, the code compiles if it's .NET 2.0
compliant, but (expectedly) generates an "unknown reference" error if I try
to reference a .NET 3.5 stock assembly.
A nudge in the right direction would be appreciated.
Thanks!
/ravi