Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Application does not find assemblies

 
Post new topic   Reply to topic    Infralution Support Forum Index -> .NET Encryptor Support
View previous topic :: View next topic  
Author Message
hs2



Joined: 27 Jan 2014
Posts: 3

PostPosted: Mon Jan 27, 2014 7:55 pm    Post subject: Application does not find assemblies Reply with quote

Hi!

I use the encryptor for encrypting my application. My bootstrapper is compiled in any cpu mode (the encrypted assembly too).

In the application directory there is only the exefile and the exefile.config. The directory also includes two folders (x86 and x64 with the propper dll files).

The config-File looks like this:


<?xml version="1.0"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="x86;x64"/>
</assemblyBinding>
</runtime>
</configuration>



On x86 systems everything is running fine. But on x64 systems the application does not find any dll located in the x64 folder (HRESULT: 0x8007007E). When I insert the exefile into the x64 folder and start the application from this location, everything runs fine.
It searches the dll files only in the application directory (I used process monitor to figure this out).

Can you please tell me what I'm doing wrong?

Thanks you in advance!
Back to top
View user's profile Send private message
hs2



Joined: 27 Jan 2014
Posts: 3

PostPosted: Mon Jan 27, 2014 9:37 pm    Post subject: Reply with quote

Found a solution:

Code:

        [DllImport("kernel32.dll", CallingConvention = CallingConvention.Cdecl)]
        internal static extern bool SetDllDirectory(string pathName);

                // Manually set the DLL load path depending on the process.
                var path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
                if (Environment.Is64BitProcess)
                {
                    path = Path.Combine(path, "x64");
                }
                else
                {
                    // X32
                    path = Path.Combine(path, "x86");
                }
                SetDllDirectory(path);
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue Jan 28, 2014 10:26 pm    Post subject: Reply with quote

Great thanks for posting the solution.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> .NET Encryptor Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group