This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Notification

Icon
Error

Options
Go to last post Go to first unread
Alejandro  
#1 Posted : Monday, February 22, 2010 12:26:56 AM(UTC)
Alejandro

Rank: Newbie

Groups: Guest
Joined: 5/28/2008(UTC)
Posts: 6

Well I have an application that will be deployed for 32 ad 64bits OS. The problem is that some users need to install both in the same computer and regarding that the app includes many other large files I'm planning to provide one installer common to both systems.
The user should select one executable or other but not at installation time.

Regarding that the 64bits interop files are named the same as the 32bits, I tried to just rename them and re-reference in my app, they compile fine but it doesn't work because the file "Aurigma.GraphicsMill" is not found.

I know I can deploy one 32 and another 64 and install to program files and program files (x86) ( as suggested in many webs) but I think it's much easier a common folder for both versions sharing all the large files needed for the application.

Any suggestion will be welcome.
Alex Kon  
#2 Posted : Monday, February 22, 2010 4:46:37 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Guest
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
Hello Alejandro,

Hm... All should work in the described configuration! Is it possible, that you just mistaken a little with reference paths? As I understand all should be quite straightforward, something like that:

Code:
%PROGRAMFILES%\CommonAppFolder
   \x64
      main_binary_x64.exe (references to x64 version of Graphics Mill)
      Aurigma.GraphicsMill.dll (x64 version)
   \x86
      main_binary_x86.exe (references to x86 version of Graphics Mill)
      Aurigma.GraphicsMill.dll (x86 version)

And 2 shortcuts somewhere in Start menu: 
      TheApp (x86): %PROGRAMFILES%\CommonAppFolder\x86\main_binary_x86.exe
      TheApp (x64): %PROGRAMFILES%\CommonAppFolder\x64\main_binary_x64.exe


If it doesn't work - could you send more details on errors you got? Please could you also check 'Applications' event log for new records related to your application or Graphics Mill for .NET.
Alejandro  
#3 Posted : Monday, February 22, 2010 10:14:21 PM(UTC)
Alejandro

Rank: Newbie

Groups: Guest
Joined: 5/28/2008(UTC)
Posts: 6

Thanks Alex for your prompt answer.
My application structure is slightly different:
App folder: Bot 32 and 64bits executable and Aurigma libraries
Appfolder\Subfolder_1 : My large data files
Appfolder\Subfolder_2: More large data files
Appfolder\Subfolder_n: Large data files

All Subfolders(1 to n) are shared by both executables and dinamically referenced in the application.

Following your suggestion I could reference them as Parentfolder\Subfolder instead of Appfolder\Subfolder like
\CommonAppFolder
\CommonAppfolder\x64
\CommonAppfolder\x86
\CommonAppfolder\Subfolder_1
\CommonAppfolder\Subfolder_n

but it would be quite easier to have differently named libraries because in the Appfolder I have also some shared files which I would need to duplicate or place in the CommonAppfolder.
The only files different are the executables and Aurigma, executables can be renamed by not the Aurigma ones.

Not sure but probably having the Aurigma renamed to Aurigma.GraphicsMill64.dll ( for sample) would help also to create projects for "Any Cpu" easier.

Thanks,
Alejandro

Alex Kon wrote:
Hello Alejandro,

Hm... All should work in the described configuration! Is it possible, that you just mistaken a little with reference paths? As I understand all should be quite straightforward, something like that:

Code:
%PROGRAMFILES%\CommonAppFolder
   \x64
      main_binary_x64.exe (references to x64 version of Graphics Mill)
      Aurigma.GraphicsMill.dll (x64 version)
   \x86
      main_binary_x86.exe (references to x86 version of Graphics Mill)
      Aurigma.GraphicsMill.dll (x86 version)

And 2 shortcuts somewhere in Start menu: 
      TheApp (x86): %PROGRAMFILES%\CommonAppFolder\x86\main_binary_x86.exe
      TheApp (x64): %PROGRAMFILES%\CommonAppFolder\x64\main_binary_x64.exe


If it doesn't work - could you send more details on errors you got? Please could you also check 'Applications' event log for new records related to your application or Graphics Mill for .NET.
Alex Kon  
#4 Posted : Monday, March 1, 2010 12:41:19 AM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Guest
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
Hello Alejandro,

You cannot rename Aurigma's DLLs (this will broke strong name signing), however you have no need to do this. I suggest you to separate just Aurigma's DLL to different folders. As I understand, your main executables already have different names. So, you just should reference each of them to correct folder (x86 or x64).

There was simple-to-use method (AppDomain.AppendPrivatePath), but it was declared as deprecated in .NET 2.0. One of the alternatives is to use AppDomain.AssemblyResolve event. I wrote a simple app to demonstrate this approach:
Code:
namespace DualPlatformApp
{
	class Program
	{
#if __X64 //this constant is defined in project options for x64 configuration only
		private const string gmAssemblyPath = @"\aurigma_x64\Aurigma.GraphicsMill.dll";
#else
		private const string gmAssemblyPath = @"\aurigma_x86\Aurigma.GraphicsMill.dll";
#endif
		static Program()
		{
			AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(OnAssemblyResolve);
		}

		static Assembly OnAssemblyResolve(object sender, ResolveEventArgs args)
		{
			Assembly result = null;
			if (args.Name.StartsWith(@"Aurigma.GraphicsMill, Version=5.5.2.0, Culture=neutral, PublicKeyToken=af7154c50c505858"))
			{
				result = Assembly.LoadFrom(
					Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + gmAssemblyPath);
			}
			return result;
		}
		
		static void Main(string[] args)
		{
			Assembly gmAssembly = Assembly.GetAssembly(typeof(Aurigma.GraphicsMill.Bitmap));
			System.Console.WriteLine("\nThis binary references: " + gmAssembly.Location);
		}
	}
}
As you can see the code is rather straightforward ;). You can also find full sample project in the attachments. Note that the archive contains 2 folders. DualPlatformApp - it is the sample project itself. And DualPlatformTest - it is how "deployed" app should look. Files are copied to this folder in VS post-build script.

If, by any reasons, it is not acceptable for you to use this way, you can point path to the external assembly in application's .config file. For more detail on all these methods look this article: http://support.microsoft.com/kb/837908

Edited by user Monday, March 1, 2010 12:42:00 AM(UTC)  | Reason: Not specified

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.