Jump to content
  • Advertisement
Sign in to follow this  
Greg K

[.net] DLL Troubles

This topic is 5473 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

I have a dll that "exports" one managed c++ class (which currently does not do anything) and one c# program that instantiates that class and calls a couple of functions in it. The problem is that after I run the app once I cannot compile the dll again unless I close .NET, delete the DLL and then reopen .NET and recompile. Why is this hapenning? Do I need to be calling a function to release the dll? -Greg

Share this post


Link to post
Share on other sites
Advertisement
I have found that even if I do not run the application I still cannot build the dll more than once without closing, deleting the dll and reopen .NET.
-Greg

Share this post


Link to post
Share on other sites
Greg,

I guess you mean Visual Studio when you write .NET?
It is probably a reference that VS has; I have noticed this too. To me a solution was to not set 'real' references but to use project references (last tab when adding a reference) this does however require the projects to be in the same solution...

When your dll does contain a COM class and you have created a Runtime Callable Wrapper (.NET layer over COM) you should call Marshall.ReleaseComObject. Then again, this does not solve the issue with VS...

Cheers

Share this post


Link to post
Share on other sites
Yes, thank you. I do mean Visual Studio when I said .NET.

I have fixed the problem and for anyone who had this same problem this was the situation and how I fixed it.

I had two projects in my solution. A dll and an app project. The app needed the dll as a reference.
At first I had the dll output itself to the ../bin directory where I was collecting all my binaries for the app and the dll. My project was using the dll from that location (../bin/mydll.dll) with copylocal=false and so it would not let me overwrite it with a new copy.

To fix this:
Have the dll output to it's own debug directory, reference it from there, and set copy local to true.

-Greg

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!