Politics, Weather, Photography, and the Dog
Friday 7 March 2014

One of my tasks at my day job today is to get continuous integration running on a Jenkins server. It didn't take too long to wrestle MSBuild to the ground and get the build working properly, but when I added an MSTest task, a bunch of unit tests failed with this error:

System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

The System.Web.Providers assembly is properly referenced in the unit test project (it's part of a NuGet package), and the assembly's Copy Local property is set to True.

When the unit tests run from inside Visual Studio 2013, they all work. When ReSharper runs them, they all work. But when I execute the command line:

MSTest.exe /resultsfile:MSTestResults.trx /testcontainer:My.Stupid.Test\bin\My.Stupid.Test.dll /test:MyFailingTest

...it fails with the error I noted above.

I'll spare you the detective work, because I have to get back to work, but I did find the solution. I marked the failing test with a DeploymentItemAttribute:

[TestMethod]
[DeploymentItem("System.Web.Providers.dll")]
public void MyFailingTest()
{
	try
	{
		DoSomeTestyThings();
	}
	finally
	{
		CleanUp();
	}
}

Now, suddenly, everything works.

And people wonder why I hate command line crap.

Friday 7 March 2014 14:15:00 CST (UTC-06:00)  |  | Software#
Search
On this page....
Could not find assembly in command-line MSTest execution
Countdowns
The Daily Parker +3476d 19h 42m
Italy 7d 02h 16m
IDTWHQ move 24d 02h 31m
Parker's 9th birthday 24d 17h 31m
My next birthday 105d 21h 36m
Categories
Aviation (366) Baseball (110) Best Bars (10) Biking (46) Chicago (999) Cubs (199) Duke (134) Geography (368) Higher Ground (5) Jokes (284) Kitchen Sink (709) London (70) Parker (203) Daily (204) Photography (155) Politics (307) US (1147) World (286) Raleigh (21) Readings (8) Religion (68) San Francisco (94) Software (217) Blogs (83) Business (249) Cloud (91) Cool links (152) Security (105) Travel (259) Weather (755) Astronomy (94) Windows Azure (64) Work (101) Writing (15)
Links
Archive
<May 2015>
SunMonTueWedThuFriSat
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456
Full archive
Blogroll
About
David Braverman and Parker
David Braverman is the Chief Technology Officer of Holden International in Chicago, and the creator of Weather Now. Parker is the most adorable dog on the planet, 80% of the time.
Legal
All content Copyright ©2015 David Braverman.
Creative Commons License
The Daily Parker by David Braverman is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License, excluding photographs, which may not be republished unless otherwise noted.
Admin Login
Sign In
Blog Stats
Total Posts: 4812
This Year: 198
This Month: 33
This Week: 9
Comments: 0