Jump to content
  • Advertisement
Sign in to follow this  
Wrathnut

[.net] Using a C# dll in CLI / C++ VS 2010

This topic is 2557 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

I have a dll created in C# that I am trying to use in my visual studio 2010 project. When I try to access a function from the DLL I get this exception thrown:


ystem.IO.FileLoadException was unhandled
Message=Mixed mode assembly is built against version 'v1.1.4322' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.
Source=OpenLayers.Base
StackTrace:
at q.a(Boolean A_0)
at q.a()
InnerException:


The DLL is built against an older version of the .NET framework.
I have seen some posts on the internet that say to modify a configuration file.(LINK-> MSDN Posting ) But it seems that this configuration file is only generated if you are creating a VB or C# program. Does anyone know how to modify this 'additional configuration information' for the CLI / C++ framework in VS 2010?

Any insight or help would be greatly appreciated!

Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Write
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
</configuration>[/quote]into filename.exe.config file, where "filename" is name of your executable.

Share this post


Link to post
Share on other sites
Martin,

Thanks for the response. There doesn't seem to be a config file with the project name generated from VS 2010. I finally able to get the app.config file created within the IDE. Although the compiler throws out these warnings:


Message 1 Could not find schema information for the attribute 'useLegacyV2RuntimeActivationPolicy'. C:\Users\user\Documents\Visual Studio 2010\Projects\Traveling Magnetics 2\Traveling Magnetics 2\app.config 4 12 Traveling Magnetics 2

Message 2 Could not find schema information for the element 'supportedRuntime'. C:\Users\user\Documents\Visual Studio 2010\Projects\Traveling Magnetics 2\Traveling Magnetics 2\app.config 5 6 Traveling Magnetics 2

Message 3 Could not find schema information for the attribute 'version'. C:\Users\user\Documents\Visual Studio 2010\Projects\Traveling Magnetics 2\Traveling Magnetics 2\app.config 5 23 Traveling Magnetics 2


It seems like these attributes are not supported at all. I tried to compile are run it anyway, but still received the same error when trying to use the DLL.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!