tags:

views:

178

answers:

2

I'm having trouble getting an ItemGroup to store the files on a Windows share. If I use a local folder ItemGroup contains the list of files, if I use an address in the form of \\machine\share the ItemGroup is empty.

My target includes the following:

<ItemGroup>
    <FilesToDelete Include="$(WebServer)\**\*" />
</ItemGroup>
<Delete Files="@(FilesToDelete)" />

where

<WebServer>\\localhost\website</WebServer>

With the above, FilesToDelete will be empty. If I use a local path for the WebServer property the files get enumerated correctly.

Any ideas?

A: 

What version of your MSBuild? The following script displays list of files from network share in MSBuild 3.5.30729.4926:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" 
    DefaultTargets="Build">

    <ItemGroup>
        <xx Include="\\server\share\rootfolder\**\*" />
    </ItemGroup>

    <Target Name="Build">
        <Message Text="@(xx)" />
    </Target>
</Project>
Andrey Shvydky
A: 

Does the user running msbuild have the correct authorizations on the shared folder ? A lack of access rights won't provoke an error, but will make your ItemGroup empty...

Hope it helps !

Cédric

Cédric Rup
One of those d'oh moments. I had assumed since I had created the share I had permissions on it...
JamesK