Friday, April 15, 2011

MSBuild: ReadLinesFromFile query

Hi,

I am using ReadLinesFromFile for reading multiple lines from a txt file and appending it to the path in sql.execute. The problem is its reading all the lines and appending them at once:

Text File Contents:

a.sql
b.sql

Sql.Execute ServerName="$(ServerName)" DatabaseName="CDRCntroller" path="..\DB\CDRController\BROKER\@(Prop1).

MSBuild is taking the path as : .....\BROKER\a.sql;b.sql

Any way I can use Prop1 as an array and refer the contents in the file one by one?

I tried using StringToItemList also but no luck :(

Thanks.

From stackoverflow
  • Use metadata notation instead. Like this :

    Sql.Execute ServerName="$(ServerName)" DatabaseName="CDRCntroller" path="..\DB\CDRController\BROKER\%(Prop1.Identity)
    
  • You should try this

    Sql.Execute ServerName="$(ServerName)" DatabaseName="CDRCntroller" path="..\DB\CDRController\BROKER\%(Prop1.Identity)

    The % tells Msbuild to repeat the task for each item. Identity is a Metadata containing the item itself.

    Hope it helps !

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.