Reputation: 1039
I'm trying to add custom properties to CodeDOM output, such as file version, author, etc. I'm unsure how.
Upvotes: 1
Views: 403
Reputation: 675
For the file version, you have to use AssemblyFileVersion
attribute.
See the example.
CodeCompileUnit unit = CreateMyUnit();
var attribute = new CodeAttributeDeclaration(
new CodeTypeReference(typeof(AssemblyFileVersionAttribute)));
attribute.Arguments.Add(
new CodeAttributeArgument(
new CodePrimitiveExpression("1.1.1.1")));
unit.AssemblyCustomAttributes.Add(attribute);
As for the author, you may do the similar thing. See the MSDN assembly attribute.
EDIT:
You need add the references.
using System.CodeDom;
using System.CodeDom.Compiler;
Upvotes: 1