Richard Ev
Richard Ev

Reputation: 54117

Adding a comment to the file generated by an asminfo NAnt task

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?

Upvotes: 2

Views: 895

Answers (1)

The Chairman
The Chairman

Reputation: 7187

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" />

Upvotes: 2

Related Questions