Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Two version of the same dll file : impossible ?
 

Two version of the same dll file : impossible ?

Hello,

I'm trying to publish my project with click'once and I'm facing a problem.

I'm using in my project the file Microsoft.Practices.ObjectBuilder.dll in version 1.0.51206.0 and the fileMicrosoft.Practices.ObjectBuilder.dll in version 1.0.51205.0.

The problem is that my software must be installed by people who don't have administrative right on their computer and so I can't put this dll in the GAC.

The second problem is that when I reference a file in a project, I set"Copylocal"totrueinorderthatthefileMicrosoft.Practices.ObjectBuilder.dll in version 1.0.51205.0is copied in the bin/debug folder.

The problem is that my application need the file Microsoft.Practices.ObjectBuilder.dll in version 1.0.51206.0 too and I don't know how to add this file to my reference list(becauseI'mgettingan errorsayingmethatareferencetothiscomponentalreadyexist).

Furthemore, both files are named"Microsoft.Practices.ObjectBuilder.dll" and when click once deploy a software, he copy all dll in the same folder as the .exe file so if I try to deploy both files, I'm getting an error when click'once tries to install the software saying me that the file already exist and I get a "Permission denied" error.

Hope someone has a solution ...


Nicolasbolbol  Friday, September 14, 2007 8:33 AM

Hi, Nicolasbolbol,

Based on my understanding, you want to reference to the same dlls of the different versions, don't you?

I think a pratical solution for you is to use reflection technology in .Net.

And you can just add the two dlls into two folders (not reference).

Then load them dynamically.

For example, I have one library class named Class1

Code Snippet

myClass

public class Class1

{

public Class1()

{

System.Windows.Forms.MessageBox.Show("Version1"); //I have another Version2

//System.Windows.Forms.MessageBox.Show("Version2");

}

}

Code Snippet

Assembly assembly1 = Assembly.LoadFile(System.Environment.CurrentDirectory+"/version1/myClass.dll");

Type myClass1 = assembly1.GetType();

object cls = assembly1.CreateInstance("myClass.Class1");

Assembly assembly2 = Assembly.LoadFile(System.Environment.CurrentDirectory + "/version2/myClass.dll");

Type myClass2 = assembly2.GetType();

object cls2 = assembly2.CreateInstance("myClass.Class1");

http://msdn2.microsoft.com/en-us/library/cxz4wk15.aspx

Hope this helps,

Regards

Yu Guo â€?MSFT  Monday, September 17, 2007 10:05 AM

Hi, Nicolasbolbol,

Based on my understanding, you want to reference to the same dlls of the different versions, don't you?

I think a pratical solution for you is to use reflection technology in .Net.

And you can just add the two dlls into two folders (not reference).

Then load them dynamically.

For example, I have one library class named Class1

Code Snippet

myClass

public class Class1

{

public Class1()

{

System.Windows.Forms.MessageBox.Show("Version1"); //I have another Version2

//System.Windows.Forms.MessageBox.Show("Version2");

}

}

Code Snippet

Assembly assembly1 = Assembly.LoadFile(System.Environment.CurrentDirectory+"/version1/myClass.dll");

Type myClass1 = assembly1.GetType();

object cls = assembly1.CreateInstance("myClass.Class1");

Assembly assembly2 = Assembly.LoadFile(System.Environment.CurrentDirectory + "/version2/myClass.dll");

Type myClass2 = assembly2.GetType();

object cls2 = assembly2.CreateInstance("myClass.Class1");

http://msdn2.microsoft.com/en-us/library/cxz4wk15.aspx

Hope this helps,

Regards

Yu Guo â€?MSFT  Monday, September 17, 2007 10:05 AM
Thanks,

That's what I wanted to be able to do !
Nicolasbolbol  Monday, September 17, 2007 11:38 AM

You can use google to search for other answers

Custom Search

More Threads

• Installation of USB Driver via Setup Package
• how to create a debug version install
• Any way to script/automate Orca?
• build error
• Click Once Update Issue for just one developer
• Deploying with a Platform-specific dll
• Unintall clickOnce on Start-Menu
• Visual J# redistributable package and setup program question
• Please help me! ClickOnce application cannot be started. Value does not fall within the expected range. Source: System.Deployment
• Visual Studio 2008 Custom Action BUG