Visual Studio 2008 C# Project - Could not load type 'System.Runtime.InteropServices.HandleRef'

Clash Royale CLAN TAG#URR8PPP
Visual Studio 2008 C# Project - Could not load type 'System.Runtime.InteropServices.HandleRef'
I have been struggling with a Visual Studio 2008 issue for a couple of days now. Everything was working just fine few weeks back, but now when I try to deploy the project to a Windows CE device, I get the following error message
Could not load type 'System.Runtime.InteropServices.HandleRef' from assembly 'mscorlib, Version=3.5.0.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC'.
On line
this.label1.Font = new System.Drawing.Font("Tahoma", 14F, System.Drawing.FontStyle.Regular);
So far I have tried reinstalling the .net Compact Framework, removing all references and adding them again. Neither solution seemed to have worked.
The Import Project line in the .csproj file looks as follows
<Import Project="$(MSBuildBinPath)Microsoft.CSharp.targets" />
Any suggestion why I would be getting this error?
So is the solution as simple as installing the full framework package? I don't think I have ever used the full framework package in my build but I will give it a go
– artlemaks
Aug 8 at 9:31
No, you have to get rid of that bad assembly. There is no cue in the question to help you do this, consider using source control to see what changes might have triggered this problem.
– Hans Passant
Aug 8 at 9:34
But that's my point, there were no changes done to the build in the last few months, probably since the start of the year, and I was still able to deploy it to the device to check few bits and pieces. I only started getting this error very recently.
– artlemaks
Aug 8 at 9:44
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
The error is accurate, HandleRef does not exist in .NET Compact. Typically caused when you have an assembly in your solution that was built to target the full framework instead of compact.
– Hans Passant
Aug 8 at 9:27