程序集属性的Visual Studio 2013运行时文本模板



我正在尝试使用运行时文本模板在AssemblyCopyright属性上设置年份(到目前为止没有成功)。我想这样做是为了自动化这个过程,这样我们就不必考虑它(老板希望我们在新的一年每次发布时都更新它)。文件内容如下:

<#@ template language="C#" #>
using System;
using System.Reflection;
[assembly: AssemblyCopyright("Copyright (c) <#=year#> My Company, Inc.")]
<#+
    String year = DateTime.Now.Year.ToString();
#>

我使用了这个文件,并从AssemblyInfo.cs中注释掉了相应的行。当编译项目时,程序属性只显示版权为空。有什么建议吗?

如果您使用的是运行时文本模板(自定义工具=TextTemplateingFilePreprocessor),其中文本在运行时进行转换,则需要将其更改为仅文本模板

最新更新