BreakHead
BreakHead

Reputation: 10672

How can I change Assembly Version,Assembly File Version by compliling code using System.CodeDom.CodeCompileUnit

Hi I dnt have Assembly Info file I have a code generator that copile the code using System.CodeDom.CodeCompileUnit, but always on compiling code Assembly File version and Assembly version remain 0.0.0.0

Any answer will really appreciate.

Thanks

Upvotes: 0

Views: 1579

Answers (1)

ralf.w.
ralf.w.

Reputation: 1696

CodeCompileUnit unit = new CodeCompileUnit();

// ...

CodeTypeReference attr = new CodeTypeReference(typeof(AssemblyVersionAttribute));

CodeAttributeDeclaration decl = new CodeAttributeDeclaration(attr, new CodeAttributeArgument(new CodePrimitiveExpression("1.0.2.42")));

unit.AssemblyCustomAttributes.Add(decl);

should work with AssemblyFileVersion as well. see here

Upvotes: 2

Related Questions