Jeff
Jeff

Reputation: 522

Test DLL already loaded when building multiple solutions in TFS

I'm building 2 solutions in a loop in TFS, and in both of them I have the same test DLL (targeted for 2.0 in the 1st solution, and for 3.5 in the second). Everything is fine on the first pass, but in the second, I get this:

API restriction: The assembly 'file:///D:\Builds\1\Project\Main\Binaries\FF3.5\Potato.dll' has already loaded from a different location. It cannot be loaded from a new location within the same appdomain.

How can I work around this, can I force the unloading of the DLL? Can I do something about the appdomain?

Thanks,

Upvotes: 1

Views: 1196

Answers (1)

Eva Lacy
Eva Lacy

Reputation: 1317

You could try this solution, it just involves changing the expression that finds all the test dlls http://geekswithblogs.net/jakob/archive/2010/06/08/tfs-2010-build-dealing-with-the-api-restriction-error.aspx

Edit:

I investigated this further, it seems that the Test Assembly Filespec (2. Basic -> Automated Tests -> Test Assembly -> Test Assembly Filespec on the default template) is using the FindMatchingFiles activity. So you will have to write a pattern with that that will only match the files you think should be loaded. I couldn't find a guide to using the pattern but stuff like this works:

  1. _PublishedWebsites***test*.dll (Find all the dlls the name of which contains the word test in the folder _PublishedWebsites)
  2. test.dll (Find all the dlls the name of which contains the word test in the base folder)
  3. **test.dll (Find all the dlls the name of which contains the word test in all folders below the base folder)

Where as stuff like this does not:

  1. _PublishedWebsites**\bin*test*.dll
  2. *\bin*test.dll
  3. _PublishedWebsites*test****test*.dll

Upvotes: 1

Related Questions