[英]How Do I Add Custom Properties To CodeDOM Output
我正在嘗試向CodeDOM輸出添加自定義屬性,例如文件版本,作者等。我不確定如何。
對於文件版本,必須使用AssemblyFileVersion
屬性。 參見示例。
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);
至於作者,您可以做類似的事情。 請參閱MSDN程序集屬性 。
編輯:
您需要添加引用。
using System.CodeDom;
using System.CodeDom.Compiler;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.