The first idea that came to mind was to fully qualify the name of the attributes yourself like:
ccu.AssemblyCustomAttributes.Add (new CodeAttributeDeclaration
("System.Reflection.AssemblyKeyFile", new CodeAttributeArgument (new
CodePrimitiveExpression
("CICSBank.snk"))));Russ
At 06:15 PM 7/26/2003 -0400, you wrote:
Hi,
I've been creating a DLL on the fly using CodeDOM. Now I would like to assign a version and a strong name.
The code below adds the attributes, but the compilation fails. I'm missing an import.
If I add the imports, it still does not work.
The code being generated 'imports' inside the namespace, whereas the Assembly attributes are specified outside the namespace (as they should).
Anybody any ideas on how to do this ?
Thanks in advance.
Michel.
CodeCompileUnit ccu = new CodeCompileUnit();
ccu.AssemblyCustomAttributes.Add (new CodeAttributeDeclaration ("AssemblyKeyFile", new CodeAttributeArgument (new CodePrimitiveExpression ("CICSBank.snk"))));
ccu.AssemblyCustomAttributes.Add (new CodeAttributeDeclaration ("AssemblyVersion", new CodeAttributeArgument (new CodePrimitiveExpression ("1.1.0"))));
m_ns = new CodeNamespace (t.Namespace); ccu.Namespaces.Add (m_ns); m_ns.Imports.Add (new CodeNamespaceImport ("System")); m_ns.Imports.Add (new CodeNamespaceImport ("System.Reflection"));
