Category: visual studio unittest
Gayan19911212 on Thu, 09 Apr 2020 12:19:46
I have a project names 'A' and it was originally developed in .Net Framework 4.7.1. For this project, there is a unit test project 'Test A' was coded in .Net Framework as well.
Later We have converted this Project A into .Net Standard 2.0 to support Azure functions but Unit Test project remained the same. However, if I run test methods in Project Test A, I get assembly issues.
For example :
Exception thrown: 'System.IO.FileNotFoundException' in A.dll
An exception of type 'System.IO.FileNotFoundException' occurred in A.dll but was not handled in user code
Could not load file or assembly 'System.Drawing.Common, Version=188.8.131.52, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
One of the online forum suggested that adding following propertise into the unit test project helps, but it didn't.
I want to somehow run this .Net Framework unit test project rather than creating new project. I have tried downgrading .Net Framework in Test A project to 4.6.1. I have also tried to download nuget package for System.Drawing.Common in A Project and that also did not work.
Another assbemly failed to load is SVG.
Please help me out. Thanks
Dylan Zhu-MSFT on Fri, 10 Apr 2020 05:33:12
Welcome to MSDN forum.
I try to create a .net standard project with System.Drawing.Common package, and the dll file is referenced into a unit test project. The test can run normally.
Please try to update your visual studio to latest version and install latest .NET core 3.1.
If this issue is not solved, we will appreciate that you can provide some steps to help us reproduce it, or share a sample using one drive.
Look forward to your reply.
Gayan19911212 on Mon, 13 Apr 2020 07:51:59
Hi Dylan Zhu-MSFT,
I am using latest visual studio build and projects are in .Net core 3.1. but the unit test are in .Net framework 4.7.1. In the end, I had to recreate unit test projects in .Net core 3.1
Dylan Zhu-MSFT on Mon, 13 Apr 2020 08:29:21
Thank you for reply.
Since the problem could not be reproduced on my side, I’m sorry that I didn't provide useful help for you.
If you have other issues about unit testing in the future, please feel free to contact us.