I'm specifying "Specific version"=false on all my added assembly references but when I try to deploy the solution with an assembly with different version than the referenced I get an exception: "Could not load file or assembly...".
Example:
Project1 with version 1.0.0.0 specified is compiled into Project1.dll
Project2 references Project1.dll with "Copy Local"=true and
"Specific version"=false and is compiled into Project2.dll
MyWebApplication references Project2.dll
On deployment of MyWebApplication I replace Project1.dll (which has been copied into the bin-catalog since Project2 references it) with a recompiled Project1.dll with
version 1.1.0.0. This results in the exception mentioned above, telling me that Project1.dll version 1.0.0.0 couldn't be found.
Analyzing Project2.dll with Reflector shows that the version number is included in the reference-string, even though I specified "Specific version"=false. Shouldn't the version number be omitted under this circumstances?
Are you seeing the error when you browse a page of the deployed website? Or are you seeing the error when you perform the "build" step, or the "publish" step?
What do you have In your web.config in the <assemblies> section?
==============================================
If you get the answer to your question, please mark it as the answer.
On deployment of MyWebApplication I replace Project1.dll (which has been copied into the bin-catalog since Project2 references it) with a recompiled Project1.dll with
version 1.1.0.0. This results in the exception mentioned above, telling me that Project1.dll version 1.0.0.0 couldn't be found.
Hi Richard,
You may have some confusing about the “Specific version” property. “Specific Version” property is only a build-time directive (for Visual Studio). It has no effect on the runtime version resolution of the referenced assembly.
Please check the following link for detailed informaiton.
Sincerely,
Benson Yu
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. This can be beneficial to other community members reading the thread.
Ok, the "Specific version" property only comes in play during compilation. I understand.
I probably should explain my real scenario for you; I'm working on a website that uses the same application layers (DLLs) as a winforms application.
The problem is that the website is hosted on a shared location where a recompiled version of MySQL is required (which is provided by the host and rarely the latest version) since the original won't run under Medium Trust.
I work with / develop the two applications, keeping them in sync with changes, and I want to use the latest version of MySQL in the winforms application and the recompiled version on the website. Since the website uses basic functionality from the MySQL
reference the risk of having breaking changes between the versions are slim. The winforms application on the other hand uses the MySQL reference extensively and therefore bugfixes from MySQL is essential.
But I don't want to recompile the whole "tree" with different references each time I make a change. I would like to compile the application layers with the latest version from MySQL and replace the copied DLL with the provided DLL on deployment and let the
runtime on the website ignore the fact that the version is incorrect (older).
The application is built in many layers, where the lowest level (assemblies) references the MySQL assembly, kind of like this.
WinForm-application Website-application
Application.dll
Datalayer.dll
MySQL.Data.dll
I've read that adding the following section in the web.config might help, but will it work when the reference is indirectly references through many layers of references?
RichardBladh
Member
28 Points
10 Posts
Specific version assembly reference
Apr 23, 2008 07:18 AM|LINK
Good morning to you all!
I'm specifying "Specific version"=false on all my added assembly references but when I try to deploy the solution with an assembly with different version than the referenced I get an exception: "Could not load file or assembly...".
Example:
Project1 with version 1.0.0.0 specified is compiled into Project1.dll
Project2 references Project1.dll with "Copy Local"=true and "Specific version"=false and is compiled into Project2.dll
MyWebApplication references Project2.dll
On deployment of MyWebApplication I replace Project1.dll (which has been copied into the bin-catalog since Project2 references it) with a recompiled Project1.dll with version 1.1.0.0. This results in the exception mentioned above, telling me that Project1.dll version 1.0.0.0 couldn't be found.
Analyzing Project2.dll with Reflector shows that the version number is included in the reference-string, even though I specified "Specific version"=false. Shouldn't the version number be omitted under this circumstances?
Best regards,
Richard
hongping
Contributor
3403 Points
635 Posts
Microsoft
Re: Specific version assembly reference
Apr 23, 2008 06:15 PM|LINK
Are you seeing the error when you browse a page of the deployed website? Or are you seeing the error when you perform the "build" step, or the "publish" step?
What do you have In your web.config in the <assemblies> section?
If you get the answer to your question, please mark it as the answer.
Benson Yu - ...
All-Star
34797 Points
2497 Posts
Re: Specific version assembly reference
Apr 28, 2008 07:32 AM|LINK
Hi Richard,
You may have some confusing about the “Specific version” property. “Specific Version” property is only a build-time directive (for Visual Studio). It has no effect on the runtime version resolution of the referenced assembly.
Please check the following link for detailed informaiton.
What you need to know about referenced assemblies in VS2005
http://blogs.msdn.com/irenak/archive/2005/12/13/503105.aspx
Benson Yu
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. This can be beneficial to other community members reading the thread.
RichardBladh
Member
28 Points
10 Posts
Re: Specific version assembly reference
Apr 28, 2008 09:30 AM|LINK
Ok, the "Specific version" property only comes in play during compilation. I understand.
I probably should explain my real scenario for you; I'm working on a website that uses the same application layers (DLLs) as a winforms application.
The problem is that the website is hosted on a shared location where a recompiled version of MySQL is required (which is provided by the host and rarely the latest version) since the original won't run under Medium Trust.
I work with / develop the two applications, keeping them in sync with changes, and I want to use the latest version of MySQL in the winforms application and the recompiled version on the website. Since the website uses basic functionality from the MySQL reference the risk of having breaking changes between the versions are slim. The winforms application on the other hand uses the MySQL reference extensively and therefore bugfixes from MySQL is essential.
But I don't want to recompile the whole "tree" with different references each time I make a change. I would like to compile the application layers with the latest version from MySQL and replace the copied DLL with the provided DLL on deployment and let the runtime on the website ignore the fact that the version is incorrect (older).
The application is built in many layers, where the lowest level (assemblies) references the MySQL assembly, kind of like this.
WinForm-application Website-application
Application.dll
Datalayer.dll
MySQL.Data.dll
I've read that adding the following section in the web.config might help, but will it work when the reference is indirectly references through many layers of references?
<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="MySql.Data" publicKeyToken="C5687FC88969C44D" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-5.2.1.0" newVersion="5.0.8.1"/> </dependentAssembly> </assemblyBinding> </runtime>Thanks!
/ Richard