Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using CodeDom to generate a CF assembly...

24 views
Skip to first unread message

Antao Almada

unread,
Jul 15, 2004, 11:39:11 AM7/15/04
to

I'm trying to use CodeDom to dinamically generate an assembly to be used
on a PDA.

After setting all the dependencies for a CF assembly, I can see in the
Lutz Roeder's Reflector that, my assembly depends on both the CF
mscorlib.dll and the non-CF mscorlib.dll.

I run a small test (source at the end of this post) with a single class
source and, once more, the resulting assembly depends on the non-CF
mscorlib.dll.

Is the CodeDom wrongly assuming that all assemblies will depend on the
non-CF mscorlib.dll? Am I doing something wrong?

Thanks,
Antao
____________________________
Antao Almada
http://www.ydreams.com/

CSharpCodeProvider compiler = new CSharpCodeProvider();
ICodeCompiler codeCompiler = compiler.CreateCompiler();

string code = @"
using System;

namespace Test
{
public class Class1
{
public Class1()
{
}
}
}
";

CompilerParameters compilerParams = new CompilerParameters();

compilerParams.CompilerOptions += " /filealign:4096"; // for better PE
file aligment

// find the location of System.dll for the Compact Framework
RegistryKey registryKey = Registry.LocalMachine;
registryKey =
registryKey.OpenSubKey(@"SOFTWARE\Microsoft\.NETCompactFramework\");
string systemLocation = (string)registryKey.GetValue("sdkInstallRoot");
systemLocation = Path.Combine(systemLocation, @"v1.0.5000\Windows
CE\System.dll");

compilerParams.ReferencedAssemblies.Add(systemLocation);

compilerParams.OutputAssembly = "Test.dll";
compilerParams.GenerateInMemory = false;
compilerParams.GenerateExecutable = false; // generate a DLL

compilerParams.IncludeDebugInformation = true;

CompilerResults results =
codeCompiler.CompileAssemblyFromSource(compilerParams, code);


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Alex Feinman [MVP]

unread,
Jul 15, 2004, 12:10:51 PM7/15/04
to
Try adding /nostdlib to the CompilerOptions

--
Alex Feinman
---
Visit http://www.opennetcf.org
"Antao Almada" <anon...@devdex.com> wrote in message
news:eDe2gHoa...@TK2MSFTNGP10.phx.gbl...

Antao Almada

unread,
Jul 15, 2004, 1:13:47 PM7/15/04
to

It's working!...

Thanks a lot,


Antao
____________________________
Antao Almada
http://www.ydreams.com/

*** Sent via Developersdex http://www.developersdex.com ***

0 new messages