473,804 Members | 3,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Allow to reference to any version of assembly during compiling

VCSE 2005 .NET 2 WinForms

I created assembly at runtime and added mydll.dll reference to it.
mydll.dll is in applicatino startup directory.
When I change mydl.dll to never version, this assembly is not loaded
anymore: error occurs which says that created assembly requires specific
version of mydll.dll

How to add assembly reference at runtime which does not require specific
version ?

Andrus.

My code:

void CompileAssembly (string code, string assemblyName) {

CodeDomProvider provider = CodeDomProvider .CreateProvider ("CSharp");
CompilerParamet ers compilerParamet ers = new CompilerParamet ers();
CompilerResults result =
provider.Compil eAssemblyFromSo urce(compilerPa rameters, code);
// this causes created assembly to require specific version of mydll
// How to allow to use any version on mydll.dll file ?
compilerParamet ers.ReferencedA ssemblies.Add(" mydll.dll");
compilerParamet ers.GenerateInM emory = false;
compilerParamet ers.OutputAssem bly = assemblyName;
CompilerResults compilerResults =
provider.Compil eAssemblyFromSo urce(compilerPa rameters, code);
}
Oct 15 '07 #1
6 15638
Andrus wrote:
VCSE 2005 .NET 2 WinForms

I created assembly at runtime and added mydll.dll reference to it.
mydll.dll is in applicatino startup directory.
When I change mydl.dll to never version, this assembly is not loaded
anymore: error occurs which says that created assembly requires
specific version of mydll.dll

How to add assembly reference at runtime which does not require
specific version ?

Andrus.

My code:

void CompileAssembly (string code, string assemblyName) {

CodeDomProvider provider = CodeDomProvider .CreateProvider ("CSharp");
CompilerParamet ers compilerParamet ers = new CompilerParamet ers();
CompilerResults result =
provider.Compil eAssemblyFromSo urce(compilerPa rameters, code);
// this causes created assembly to require specific version of mydll
// How to allow to use any version on mydll.dll file ?
compilerParamet ers.ReferencedA ssemblies.Add(" mydll.dll");
compilerParamet ers.GenerateInM emory = false;
compilerParamet ers.OutputAssem bly = assemblyName;
CompilerResults compilerResults =
provider.Compil eAssemblyFromSo urce(compilerPa rameters, code);
}
Did you sign mydll.dll ? If so, be sure the assembly version attribute
contains a real version, so not 1.0.*.* (which changes with every
build!) but 1.0.0.0 and version only when you need to (i.e. when the
interface breaks), which means you have to re-compile the clients
anyway.

FB
--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Oct 16 '07 #2
Frans,
Did you sign mydll.dll ? If so, be sure the assembly version attribute
contains a real version, so not 1.0.*.* (which changes with every
build!) but 1.0.0.0 and version only when you need to (i.e. when the
interface breaks), which means you have to re-compile the clients
anyway.
thank you.

The file mydll.dll which I reference is produced by external vendor.
I have no control over its versioning or signing.

So I must reference to any version of this file from my dynamically created
assembly.

Anyh idea how to implement this ?

Andrus.
Oct 16 '07 #3
Andrus wrote:
Frans,
Did you sign mydll.dll ? If so, be sure the assembly version
attribute contains a real version, so not 1.0.*.* (which changes
with every build!) but 1.0.0.0 and version only when you need to
(i.e. when the interface breaks), which means you have to
re-compile the clients anyway.

thank you.

The file mydll.dll which I reference is produced by external vendor.
I have no control over its versioning or signing.

So I must reference to any version of this file from my dynamically
created assembly.

Anyh idea how to implement this ?
This vendor, don't they ship a policy file with thier assembly?

Is the mydll signed (does it have a strong name?)

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Oct 17 '07 #4
>The file mydll.dll which I reference is produced by external vendor.
>I have no control over its versioning or signing.

So I must reference to any version of this file from my dynamically
created assembly.

Anyh idea how to implement this ?

This vendor, don't they ship a policy file with thier assembly?
I have the following files (mydll is actually Castle.ActiveRe cord) :

14.10.2007 16:55 192 512 Castle.ActiveRe cord.dll
14.10.2007 16:55 658 944 Castle.ActiveRe cord.pdb
14.10.2007 16:55 459 779 Castle.ActiveRe cord.xml

So I think I don't have policy file (I have no idea what is policy file)
Is the mydll signed (does it have a strong name?)
Solution explorer shows the following properties for Castle.ActiveRe cord.dll

Strong Name true
Version 1.0.3.0

So it is signed.

Andrus.
Oct 17 '07 #5
Andrus wrote:
The file mydll.dll which I reference is produced by external
vendor. I have no control over its versioning or signing.
>
So I must reference to any version of this file from my
dynamically created assembly.
>
Anyh idea how to implement this ?
This vendor, don't they ship a policy file with thier assembly?

I have the following files (mydll is actually Castle.ActiveRe cord) :

14.10.2007 16:55 192 512 Castle.ActiveRe cord.dll
14.10.2007 16:55 658 944 Castle.ActiveRe cord.pdb
14.10.2007 16:55 459 779 Castle.ActiveRe cord.xml

So I think I don't have policy file (I have no idea what is policy
file)
Is the mydll signed (does it have a strong name?)

Solution explorer shows the following properties for
Castle.ActiveRe cord.dll

Strong Name true
Version 1.0.3.0

So it is signed.
But if you reference that dll in YOUR application, every build of your
application shoudl be able to load that particular dll with that
particular version.

If you then place 1.0.4.0 in the bin folder, you won't be able to load
that file. But, if you add an assembly redirect in your application's
config file to redirect bindings to 1.0.3.0 to 1.0.4.0, you will be
able to load that file. Of course, if 1.0.4.0 has newer interfaces and
breaking changes, it's not wise to do so, but you can.

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Oct 18 '07 #6
But if you reference that dll in YOUR application, every build of your
application shoudl be able to load that particular dll with that
particular version.
Yes, I can rebuild my solution and this works OK.
However the issue occurs in customer sites when I upgrade referenced dll
file but my dynamically generated assembly contains reference to old
version.
If you then place 1.0.4.0 in the bin folder, you won't be able to load
that file. But, if you add an assembly redirect in your application's
config file to redirect bindings to 1.0.3.0 to 1.0.4.0, you will be
able to load that file. Of course, if 1.0.4.0 has newer interfaces and
breaking changes, it's not wise to do so, but you can.
As I understand at application startup I need to check assembly version and
dynamically update app.config file by adding assembly redirect.

Vista UAC prevents my application changing app.config file.
How to create dynamic assembly redirect without writing to restricted
directories ?
Or is there better solution ?

Andrus.
Oct 18 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
346
by: Rui Macdonald | last post by:
I working with some samples from angGoGo PhotoControl and when I start it I receive always the following message, can you help me please? :-( -------------------- The located assembly's manifest definition with name 'System' does not match the assembly reference. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it...
4
1876
by: dhnriverside | last post by:
HI guys I've just written my first independent namespace for my library (yay me!). However, on trying to add it to my website project, it causes an error when I look at the website. It compiles ok though... The error message is... "The located assembly's manifest definition with name 'HudsonNash.Utils.Security' does not match the assembly reference"
16
2096
by: Kent | last post by:
We have created several Assemblies that we add to the GAC on our web servers. In an ASP.NET app in VS2003, Adding a reference to strong named GAC'd Assembly meant that the web app would use whatever version was in the GAC. Now in an ASP.NET app in VS 2005, adding a reference to a GAC'd assembly actually adds a version specific reference to the web.config. That means that we would have to change the assembly reference in every single...
0
1483
by: stic | last post by:
Hi, After a few hours of asp. net configuration, ACL, web service specifications digging and of course extensive googling, I finally came to you… and as usually I need help… I need to add specific dll files as reference to my WS. At this project for some reason we use ‘copy local = false’. And that is what makes a lot of problems with WS references.
5
4598
by: John A Grandy | last post by:
How to use the .NET Reflector to determine which .NET version and assembly was compiled in ?
0
1994
by: =?Utf-8?B?SmFtZXM=?= | last post by:
I'm stuck with the following error... Does anyone know how to correct the reference? I've not idea why it is referencing 'Copy of...' Server Error in '/Client1' Application. -------------------------------------------------------------------------------- Configuration Error Description: An error occurred during the processing of a configuration file
7
10088
by: chage | last post by:
Hi, I have been searching around to try adding reference assembly to another assembly during runtime, programatically. Is this possible in .Net? The reason for this is because i am having trouble using a library that creates an instance of a Type that i specified, and it failed the locate the Type during runtime, if i do not reference it during compile time.
0
1391
by: JB | last post by:
I have an ASP project written years ago that I have recently started to try and update. It was written by someone who used to work here before me, and the source code I have is in a major mess. There is just one (of many) DLL file that once I recompile I get the error mentioned above. The located assembly's manifest definition with name '.....' does not match the assembly reference (see snippet for full detail).
2
5146
by: Febria | last post by:
Dear, all... I have some problem with my application. I used UltraWebGrid component in my web application. Unfortunately, when I tried to run the web, the error page displayed: The located assembly's manifest definition with name 'Infragistics.WebUI.UltraWebGrid.v3' does not match the assembly reference. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for...
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10076
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9144
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4297
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3816
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.