How can I change Assembly Version,Assembly File Ve

2019-08-19 23:09发布

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

标签: c# .net
1条回答
我想做一个坏孩纸
2楼-- · 2019-08-19 23:49

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

查看更多
登录 后发表回答