Question

I am using the asminfo task in NAnt but would like to be able to include an explanatory comment in the generated file (to tell the uninitiated that the file was generated by NAnt, and what its purpose is).

Is this possible?

Was it helpful?

Solution

I'm not aware of any NAnt function to achieve this directly.

What you could do is this: Generate AssemblyInfo file, load its content to a property, overwrite the file with your header, and append the original content.

<asminfo output="${assemblyinfo.path}" language="CSharp">
  <!-- ... -->
</asminfo>
<loadfile
  file="${assemblyinfo.path}"
  property="assemblyinfo.content" />
<echo
  file="${assemblyinfo.path}"
  append="false">
  <![CDATA[//------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="ACME INC.">
//   Copyright (c) ACME INC.
// </copyright>
// <summary>
//   The assembly info.
// </summary>
//------------------------------------------------------------------------------

]]>
</echo>
<echo
  file="${assemblyinfo.path}"
  message="${assemblyinfo.content}"
  append="true" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top