Sign in to follow this  

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

This topic is 2340 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:

[code]
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:
[/code]

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-> [url="http://social.msdn.microsoft.com/Forums/pl-PL/vcgeneral/thread/5d1186ec-ad55-4929-b1e4-8806cdc758af%20"]MSDN Posting[/url] ) 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
Write[quote]<?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:

[code]
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
[/code]

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

This topic is 2340 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this