During my build process I'm trying to copy a folder to the artifacts folder (\myserver\d$\TFBuild-Agent01\66\a).

So I put this in the .csproj file:

```xml
<Target Name="BeforeBuild">
  <Exec 
    Command="xcopy.exe  Databases &quot;$(Build.ArtifactStagingDirectory)\Databases&quot; /i /e /y /d" />
</Target>

```

This gets me 

> 
> Error MSB4184: The expression """.ArtifactStagingDirectory" cannot be evaluated. Method 'System.String.ArtifactStagingDirectory' not found\*
> 
> 
> 

Everything I can find online says that $(Build.ArtifactStagingDirectory) is the way to do it. But it doesn't work.

Building with Visual Studio 2015 on TFS 2015

This doesn't work either:

```
<Exec 
Command="xcopy.exe  Databases &quot;$($Env:BUILD_ARTIFACTSTAGINGDIRECTORY)\Databases&quot; /i /e /y /d" />

```

> 
> The expression "$Env:BUILD\_ARTIFACTSTAGINGDIRECTORY" cannot be evaluated.\*
> 
> 
> 

This doesn't error, but it looks like %BUILD\_ARTIFACTSTAGINGDIRECTORY% gets replaced as an empty string:

```
 <Exec Command="xcopy.exe  Databases &quot;%BUILD_ARTIFACTSTAGINGDIRECTORY%\Databases&quot; /i /e /y /d" /> 

```