开发者

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

开发者 https://www.devze.com 2023-01-03 01:50 出处:网络
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 Assem

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

精彩评论

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