Team Build and Test Config Deployment Item Issue
When we add a deployment folder to a test config the items will deploy without any issue locally. However, when we use the same test run config in a team build the build fails to deploy the items correctly and the build fails to run the tests. To reproduce this create a solution with a test project and a DB project. Add some files to the Create Scripts folder in the DB project. Add a unit test to the test project that passes. Under Solution Items right click on the test run config and choose properties. Add the Create Scripts folder from the DB project to the deployment items (Note: add the folder not the individual items). Run the unit test to see if it passes and check the output folder for the test result to see that the files were deployed. Now create a test list In the test manager and add the unit test to the list. Save all and check in to VSTF. Add a team build and include the test list from the solution. Run the build and it will fail. Any help is appreciated.
Answers
- dotnetwizkid,I was having the same problem and i guess that is a bug in the msbuild ???Anyway here is how to solve this issue:1. Checkout the localtestrun.testrunconfig config file from Source Control window2. Open the localtestrun.testrunconfig with a text (code) editor3. Find your (script) folder in the file<deploymentItems type="Microsoft.VisualStudio.TestTools.Common.DeploymentItemCollection">
<m_container type="System.Collections.Hashtable">
<key type="Microsoft.VisualStudio.TestTools.Common.DeploymentItem">
<path type="System.String">MyProject\DBScriptFolder\</path>
<outputDirectory type="System.String" />
</key>
<value />
</m_container>
</deploymentItems>4. Delete the '\' (backslash) from the end of that string5. Save and check-inThis should solve the problem of folders not being copied on the build machine. This solution is also working locally when you run the unit tests.Cheers,Damir We fixed this issue. The fix is going to be in Visual Studio SP1.
Thank you,
Michael Koltachev
VSTS
All Replies
- dotnetwizkid,I was having the same problem and i guess that is a bug in the msbuild ???Anyway here is how to solve this issue:1. Checkout the localtestrun.testrunconfig config file from Source Control window2. Open the localtestrun.testrunconfig with a text (code) editor3. Find your (script) folder in the file<deploymentItems type="Microsoft.VisualStudio.TestTools.Common.DeploymentItemCollection">
<m_container type="System.Collections.Hashtable">
<key type="Microsoft.VisualStudio.TestTools.Common.DeploymentItem">
<path type="System.String">MyProject\DBScriptFolder\</path>
<outputDirectory type="System.String" />
</key>
<value />
</m_container>
</deploymentItems>4. Delete the '\' (backslash) from the end of that string5. Save and check-inThis should solve the problem of folders not being copied on the build machine. This solution is also working locally when you run the unit tests.Cheers,Damir - Yup, that did it. Thanks so much!

We fixed this issue. The fix is going to be in Visual Studio SP1.
Thank you,
Michael Koltachev
VSTS

