.testsettings deployment section gets ignored in TFS build

半腔热情 提交于 2020-01-17 07:45:43

问题


I have a solution with bunch of C# projects with bunch of tests. Some of these tests require few native dlls (provided by related nuget packages). To address this .testsettings file was created that is copying dlls (that nuget coped to $(OutDir)) to test directory before running tests.

All this works fine on local machine, but when executed under TFS Build 'deployment' section of .testsettings file (or maybe entire file) gets ignored -- these dlls never materialize in test directory (nor there are any entries in the logs about them). .testsettings file is mentioned in related section of TFS build configuration.

Any ideas what could be wrong? (MSVC 2015, TFS 2013)


回答1:


For TFS 2013, it only has XAML build. For XAML build, the testsetting file couldn't copy the assemblies from Nuget package $(OutDir) to the C:\Builds\...\builddefinition\...\TestSetting(tst)\...\Out folder before tests run.

I suggest that you could upgrade your TFS to TFS 2015 or upper version to use VNext build. And I have already tested that in Vnext build, it works. This is my build definition example: just add 3 steps.




回答2:


Have you try to see if they are installed on your TFS server? Did you check on GAC of the TFS server if they are registered?

Bellow is an explanation of how I deal with my dependencies, hope it helps.

This is my HMO about this topic. Must of the time I avoid to give the responsibility to the TFS to restore the NuGet packages in a separate folder. How I do that?

1- I create a separate folder at the level of my project. (Common)

If you see on the bottom there is a Nuget.config file. Bellow is the configuration it has

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <config>
    <add key="repositoryPath" value="$\..\Common\Packages" />
  </config>
</configuration>

Now all my Packages are hosted inside Common folder. Now, place all you extra dlls there in a separate folder if you need. If you depend on native dlls that are hosted on the GAC, then you should take a look on the TFS Server if those are installed there. With that said, I put all my project reference pointing to my Common folder, even my Nuget Repository is getting the files from that location also.

The advantage:

  1. you centralize all your dlls(remember if you depend on a Native dlls, you should install on the TFS the version of the Framework you need in order to run the MSBuild correctly)
  2. all projects point to the same dependencies
  3. you just mantain the Common folder.
  4. Once you check-in a package inside the Common folder, you are guaranteeing that the dependency is also hosted on the TFS, and when the MSBuild runs it can find them.


来源:https://stackoverflow.com/questions/42526035/testsettings-deployment-section-gets-ignored-in-tfs-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!