# [.net] Assembly reference problems

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

## Recommended Posts

im trying to use assemblies for my maps in a game. but the problem is that those map-assemblies must reference the game library. now when my game loads the map, an exception is raised, that says that it cant find the referenced game library. it seams it searches for the assembly file, which is not in the same directory as the map-dll. i think that is stupid, as the game-library is already loaded anyway. i there a way to solve this problem, for example by modifiying the system how references are resolved?

##### Share on other sites
You can specify the location(s) to search for referenced assemblies. In your app.Config add the following:
<?xml version="1.0" encoding="utf-8" ?>     <configuration>          <runtime>               <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" >                    <probing privatePath="PathHere" />               </assemblyBinding>          </runtime></configuration>

That will certainly work but I would be worried about two things. 1. The inability under .NET to programatically unload an assembly; 2. The duplication of assemblies in memory.

You might check out the AppDomain FAQ for more mind numbing details.

Disclaimer: I've not yet had to deal with AppDomains outside the context of ASP.NET and COM interop, so I may be incorrect in my suggestions. I don't think I am, but.. take it with a grain of salt.

##### Share on other sites

this is how i do it now:
i use the AppDomain.AssemblyResolve event to return the library assembly when needed. so there should be no duplication in memory or something like that.

problem is of course, that i cant unload it right now, but i dont really need to. the maps just consist of code to place objects in the scene and maybe some logic. no more than a few kilobytes.

1. 1
2. 2
3. 3
4. 4
frob
20
5. 5
JoeJ
20

• 11
• 11
• 12
• 13
• 9
• ### Forum Statistics

• Total Topics
632214
• Total Posts
3004853

×