M
Mountain Bikn' Guy
This code (adapted from the examples in the docs) doesn't make complete
sense to me. I have it working, but I'm wondering why I need to declare an
assembly reference in 2 places. TIA.
Dave
CodeCompileUnit compileUnit = new CodeCompileUnit();
CodeNamespace myNamespace = new CodeNamespace("MyNamespace");
compileUnit.Namespaces.Add( myNamespace );
compileUnit.ReferencedAssemblies.Add(@"MyDLL.dll");//I declare an assembly
reference here first
myNamespace.Imports.Add( new CodeNamespaceImport("System") );
myNamespace.Imports.Add( new CodeNamespaceImport("MyOtherNamespace") );
[...]
ICodeCompiler compiler = provider.CreateCompiler();
CompilerParameters cp = new CompilerParameters(
new string[] {"System.dll",
"MyDLL.dll" //Now I still have to declare the assembly reference here too.
Why?
},
filepath.Substring(0, filepath.LastIndexOf(".") + 1)+"dll", false);
sense to me. I have it working, but I'm wondering why I need to declare an
assembly reference in 2 places. TIA.
Dave
CodeCompileUnit compileUnit = new CodeCompileUnit();
CodeNamespace myNamespace = new CodeNamespace("MyNamespace");
compileUnit.Namespaces.Add( myNamespace );
compileUnit.ReferencedAssemblies.Add(@"MyDLL.dll");//I declare an assembly
reference here first
myNamespace.Imports.Add( new CodeNamespaceImport("System") );
myNamespace.Imports.Add( new CodeNamespaceImport("MyOtherNamespace") );
[...]
ICodeCompiler compiler = provider.CreateCompiler();
CompilerParameters cp = new CompilerParameters(
new string[] {"System.dll",
"MyDLL.dll" //Now I still have to declare the assembly reference here too.
Why?
},
filepath.Substring(0, filepath.LastIndexOf(".") + 1)+"dll", false);