Home > Software engineering >  Adding inherited form to solution with test project causes error "Could not load file or assemb
Adding inherited form to solution with test project causes error "Could not load file or assemb

Time:10-08

I have a solution with multiple projects. The main output project is a Windows Forms application and there is also a Test project. The test project references the winform project. When I try to add an inherited form, I get the following error:

Could not load load file or assembly 'Microsoft.VisualStudioTestPlatform.TestFramework' version=14.0.0.0 ... invalid pointer (exception from hresult 0x80004003 (E_POINTER))

I don't understand why it's looking for that file since the winforms project is not referencing the test project. Error

CodePudding user response:

I had this issue many times. I'm not sure why it happens but I found the following workaround to work:

  1. Click Build -> Rebuild Solution
  2. Try to add the inherited form again. This time you might receive an "object reference not set to an instance of an object". Click OK, if you get this error.
  3. Add the inherited form. Should work at this point.
  • Related