Error using toolbox with managed C++

Oystein Bjorke 6 years ago 0
This discussion was imported from CodePlex

AaronJohnson wrote at 2013-12-19 23:40:

I have a managed C++ WinForm application that I am trying to drop a plot into. When I do so, I get the following error dialog:
Microsoft Visual Studio
Value does not fall within the expected range.
Helpful, right?

I am using the latest .NET 4.5 binaries. I added the plot control to the toolbox manually by browsing for OxyPlot.WindowsForms.DLL.

Any ideas? Is there any other information from me that would be helpful?

AaronJohnson wrote at 2013-12-20 16:16:

Figured it out. I wasn't able to add the winforms class library to the project references because my project was targeting .NET version 4.0. It will add the core OxyPlot library, but it will throw an error when you try to reference the winforms DLL.

You have to manually set the project's targeted framework to version 4.5. You do this by manually editing the project file and adding <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> to the globals section.

Once you've done this, you'll actually be able to reference all of the required class libraries and the toolbox will now be usable.