开发者

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 Syst开发者_StackOverflow社区em.CodeDom.CodeCompileUnit, but always on compiling code Assembly File version and Assembly version remain 0.0.0.0

Any answer will really appreciate.

Thanks


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜