Resharper shadow copies assemblies before test runs

Search for a command to run...

No comments yet. Be the first to comment.
Phew, that was a lot. I'm always surprised how simple solutions contain so much detail and nuance when I try to explain them. I hope I conveyed the message that A-Frame simplifies code within a module or class by separating the infrastructure compone...

No architecture is complete without an easy way to test the functionality. My recommended strategy is to use two types of tests: unit and integration. As far as test setup goes, there is no clear winner for a test framework. xUnit.NET, NUnit and the ...

The examples in the previous posts seem really nice for simple scenarios. How do I approach more advanced use cases? The big scenarios are: I need multiple pieces of data from different sources I need to perform an infrastructure call in the middle...

I’ve shown how I write code using the A-Frame architecture without help. Yet I find a library or framework very convenient when using advanced techniques. Wolverine is at its core a messaging framework, but goes well beyond that. It has an in-memory ...

Now the expected structure is clear, let's take a look at the code. I will start with a minimal API implementation to demonstrate that there is no need for a framework to implement this architecture. I do know of a framework that makes A-Frame effort...

While writing an XML parser I customised, my unit tests all failed with an error message along the lines of "Could not load file 'C:\Users[username]\AppData\Local\Temp[guid]\Data\test.xml' or one of its dependencies. The system cannot find the file specified.".
My test solution contains a folder Data in which I put a test.xml file that contains an example of the data I need to parse. This allows me to test both reading and parsing the file in a single test. The problem is that the test can't find the xml file on my laptop and on a colleagues laptop all tests are green.
So after a bit of googling, I found out that Resharper is doing some clever shenanigans. Resharper copies the assemblies to a test folder in the '~\AppData\Local\Temp[guid]\'. So if the tests run from that location, you won't see errors that the assemblies are in use by another process when you build the solution while tests are running.
To prevent Resharper from shadow copying the assemblies to the temporary location, open the Resharpers options, go to the Tools > Unit Tests page and under the Unit Test Runner chapter, disable the Shadow copy assemblies being tested.
In most test scenarios, this won't cause any problems and is a rather useful feature to have. Whenever this isn't convenient, I hope my bumbling around will save somebody else an hour of their time.