user198552
user198552

Reputation: 431

How to include files in TFS Build Drop Location?

In our solution, we specify the relative paths to a file one of our tests needs as -

../../../TestManager/Stubs/TestData.xml

Now, this works fine when running the tests on local machine. However, on TFS build server it is not able to find the stubbed xml files while running tests.

If I changed the property "Copy to Output Directory" of xml files to "Copy if newer" I get Build failed - The directory is not empty.

Can someone please suggest what can I do to fix this problem?

Upvotes: 1

Views: 3717

Answers (4)

Gang
Gang

Reputation: 446

You can add a copy command In the AfterBuild event in your .csproj file. Example:

<Target Name="AfterBuild" Condition="$(Deploy)=='True'">
    <ItemGroup>
    <Message Text="Copying files to $(WebProjectOutputDir) " />
    <Copy SourceFiles="$(SolutionDir)$(ProjectName)\AutoMapper.dll" DestinationFiles="$(WebProjectOutputDir)\AutoMapper.dll" />
...

Upvotes: 0

user198552
user198552

Reputation: 431

For once, I found an answer on msdn!

My guess is you are sharing the build location so people to inspect build. If so it sounds like someone is viewing the build folders trying to be removed when the CoreClean gets fired. I see this alot (most of the time it's my fault because I'm looking at the build folder and then hit "Build Project" before closing it.) Lock down the build folders so no one can view them and on build failure copy all of the folders to a share so no one has access to the build folders. - Jason Gionta

http://social.msdn.microsoft.com/Forums/en/tfsbuild/thread/6d2fa8f2-4a0d-4d9b-9797-c2f4f5c21e00

Upvotes: 2

acidRain
acidRain

Reputation: 414

Specify drop location:

<DropLocation>\\BuildServer\BuildDrops\TeamProject\Project</DropLocation>

You can then use $(DropLocation)\....

Upvotes: 0

Sevki
Sevki

Reputation: 3682

From what i understand your testdata.xml doesn't get copied to your build directory on your server, you have to drag and drop the file into solution explorer and reference it from there. Its important that your .csproj knows about the file, it will produce something like this in the file body:

  <ItemGroup>
    <Content Include="TestData.xml" />
  </ItemGroup>

so that VS knows that it needs to copy that file to your build dir. I hope this helps...

Upvotes: 0

Related Questions