OK - next problem. How do you do a 'foreach' in msbuild?
 
I want to call this task:
    <GetAssemblyVersion AssemblyInfoFilename="%(AssemblyInfos.FullPath)">
      <Output TaskParameter="AssemblyVersion" PropertyName="AssemblyVersion"/>
    </GetAssemblyVersion>
 
For each assembly, then use the $(AssemblyVersion) property that it outputs to 
feed into the <AssemblyInfo> task for each file.
 
So in pseudocode, the flow would look like this:
  Find all AssemblyInfo.cs files
  foreach $file in AssemblyInfos
  {
    $version = GetAssemblyVersion($file) 
    Call AssemblyInfo($file, $version)
  }
 
Any ideas?

________________________________

From: [EMAIL PROTECTED] on behalf of Grant Holliday
Sent: Mon 15/01/2007 1:23 PM
To: [email protected]
Subject: RE: [OzTFS] MSBuild AssemblyInfo community task


Thanks Chris - this did the trick. I suspected it was something like this.
 
Thanks also William - It's actually just a string.

________________________________

From: [EMAIL PROTECTED] on behalf of Chris Burrows
Sent: Mon 15/01/2007 1:13 PM
To: [email protected]; [email protected]
Subject: RE: [OzTFS] MSBuild AssemblyInfo community task


Grant,
 
If you replace the 
 
  <AssemblyInfo CodeLanguage="CS"
   OutputFile="@(AssemblyInfos)"
   AssemblyTitle="$(BuildType)"

with 
 
  <AssemblyInfo CodeLanguage="CS"
   OutputFile=%(AssemblyInfos.FullPath)"
   AssemblyTitle="$(BuildType)"

It should cause it call the task to be called multiple times.
 
Cheers

Chris
 
Chris Burrows
Readify | Senior Consultant
 
Suite 206 Nolan Tower | 29 Rakaia Way | Docklands | VIC 3008 | Australia 
M: +61 404 254 654 | E: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>  | C: 
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>  | W: www.readify.net 
<http://www.readify.net/> 

________________________________

From: [EMAIL PROTECTED] on behalf of William Bartholomew
Sent: Mon 15/01/2007 12:59 PM
To: [email protected]
Subject: RE: [OzTFS] MSBuild AssemblyInfo community task



Grant,

 

Have a look at the definition of OutputFile in their documentation (or 
Reflector), if it's a TaskItem then MSBuild will call the task once for each 
AssemblyInfo, if it's a TaskItem array then MSBuild will only call it once.

 

William

 

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Grant Holliday
Sent: Monday, 15 January 2007 11:51 AM
To: [email protected]
Subject: [OzTFS] MSBuild AssemblyInfo community task

 

Has anybody had any experience with the AssemblyInfo task from the 
msbuildtasks.com guys?

 

I'm trying to run the task for all AssemblyInfo.cs's in the BeforeCompile 
override.

 

<Target Name="BeforeCompile">
 <Target Name="AssemblyInfo">
    <CreateItem Include="$(SolutionRoot)\**\AssemblyInfo.cs">
      <Output ItemName="AssemblyInfos" TaskParameter="Include"/>
    </CreateItem>

    <Attrib ReadOnly="false" Files="@(AssemblyInfos)" />

    <AssemblyInfo CodeLanguage="CS"
   OutputFile="@(AssemblyInfos)"
   AssemblyTitle="$(BuildType)"
    />  
</Target>

 

But I'm getting an error:

error MSB4018: The "AssemblyInfo" task failed unexpectedly.
error MSB4018: System.IO.PathTooLongException: The specified path, file name, 
or both are too long. The fully qualified file name must be less than 260 
characters, and the directory name must be less than 248 characters.

 

After checking the contents of @(AssemblyInfos), none of the individual paths 
are more than about 120chars. But the total string would be much longer.

 

I suspect the OutputFile attribute doesn't like outputting multiple files.

 

How would I call the AssemblyInfo task for each AssemblyInfo.cs in 
@(AssemblyInfos) ?

 

 

Grant

OzTFS.com - to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.
Powered by mailenable.com - List managed by www.readify.net OzTFS.com - to 
unsubscribe from this list, send a message back to the list with 'unsubscribe' 
as the subject.
Powered by mailenable.com - List managed by www.readify.net 
OzTFS.com - to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.
Powered by mailenable.com - List managed by www.readify.net 



OzTFS.com - to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.

Powered by mailenable.com - List managed by www.readify.net

<<winmail.dat>>

Reply via email to