Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts

Saturday, January 21, 2017

Where did my unit tests go? X64


Yesterday I added some native X64 libraries to my project and got a lot of BadImageFormatException  so I decided to google a little on it and found that I should change my build configuration from AnyCPU to X64 as well. And it just works.



Today I noticed that my unit tests are not loading nor running. Just an empty list in the test explorer. After a bit of an headache I finally found the correct options to change to get them to work in X64 mode.


In Visual Studio 2015:
Go to the menu: Test>Test Settings>Default Processor Architecture
select X64

Rebuild your solution and the test explorer should be populated.

Hope this helps someone out there :)


Thursday, June 9, 2011

SGEN: Could not load file or assembly 'xxx' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

Always nice to see our old friend HRESULT in an error message.

Ran into this today when converting some .NET3.5 projects to .NET4.0 and at the same time upgrading some 3rd party libraries.

Seems that downloaded files get a blocked attribute set on them that prevents the usage of them. In Visual Studio 2010, the HRESULT: 0x80131515 is shown when linking to dll’s that are blocked.

To come around this, open Windows Explorer, navigate to the folder hosting the dll. Right click on it and select properties. There should be a Unblock button in the dialog window. Click on it and SGEN should stop complaining.

Hope this helps : )