Re: Allow to reference to any version of assembly during compiling
- From: "Frans Bouma [C# MVP]" <perseus.usenetNOSPAM@xxxxxxxxx>
- Date: Tue, 16 Oct 2007 02:00:22 -0700
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");
CompilerParameters compilerParameters = new CompilerParameters();
CompilerResults result =
provider.CompileAssemblyFromSource(compilerParameters, code);
// this causes created assembly to require specific version of mydll
// How to allow to use any version on mydll.dll file ?
compilerParameters.ReferencedAssemblies.Add("mydll.dll");
compilerParameters.GenerateInMemory = false;
compilerParameters.OutputAssembly = assemblyName;
CompilerResults compilerResults =
provider.CompileAssemblyFromSource(compilerParameters, 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#)
------------------------------------------------------------------------
.
- Follow-Ups:
- References:
- Prev by Date: Re: Finally which ORM tool?
- Next by Date: reading xml into database
- Previous by thread: Allow to reference to any version of assembly during compiling
- Next by thread: Re: Allow to reference to any version of assembly during compiling
- Index(es):
Relevant Pages
|