Resolve Version Error (CS1705) Through Package Manager Console - CodeProject
Resolve Version Error (CS1705) Through Package Manager Console - CodeProject
13,906,223
Sign up formembers
our free weekly Web Dev Newsletter. Sign in
×
How to handle 'Which has higher version than referenced assembly' error (Error CS1705) through Package Manager Console
Introduction
Where there are multiple project within the solution and one project is dependent on other, and versions introduce breaking
changes, we sometimes encounter package version conflict and Visual Studio solution does not build. It may return the following
error:
Error CS1705 Assembly 'WebAPI' with identity 'WebAPI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses
'Microsoft.AspNetCore.Mvc.Core, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' which has a higher version
than referenced assembly 'Microsoft.AspNetCore.Mvc.Core' with identity 'Microsoft.AspNetCore.Mvc.Core, Version=2.1.0.0,
Culture=neutral, PublicKeyToken=adb9793829ddae60' WebApiTest C:\...
The above error can be produced on a solution that uses two projects, namely WebApi and WebApiTest.
Background
The error above shows that the test project and API project are using a different version of Microsoft.AspNetCore.Mvc.Core. For
example, the test project is using version 2.1.0.0 while the API project is using 2.1.1.0.
We can resolve this issue by updating the package reference in either of the projects to match. For example, we can update the
WebApiTest project to use the higher version of the assembly (i.e., at 2.1.1.0) or downgrade the assembly version in the WebApi
project to 2.1.0.0 depending on the need.
Resolution Example
We can issue a command like below in the package manager console targetting the right project. For example, the code below will
update the assembly reference for Microsoft.AspNetCore.Mvc.Core on WebApiTest test to use version 2.1.1.0. This will then match
the version of the same assembly in the WebApi project. The following code
https://www.codeproject.com/Tips/1280404/Resolve-version-error-CS1705-through-Package-Manag 1/4
27/03/2019 Resolve version error (CS1705) through Package Manager Console - CodeProject
The argument '- ProjectName WebApiTest' name can be omitted if the correct project is selected in the dropdown that is available
in the Package Manager Console window in the Visual Studio. An example of screen shot is shown in the figure below:
Figure: Package Manager Console window in Visual Studio 2017 running on Windows machine.
Likewise, to update the WebApi project instead, the following command will do the trick:
History
03/21/2019. Added an image of a package manager console.
License
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
Share
https://www.codeproject.com/Tips/1280404/Resolve-version-error-CS1705-through-Package-Manag 2/4
27/03/2019 Resolve version error (CS1705) through Package Manager Console - CodeProject
Benktesh Sharma
United States
Benktesh is member of an amazing IT Lending development team at Cuna Mutual Financial Group (CMFG) in Madison WI where
he is a software developer/architect. His main focus when coding is quality, simplicity and scalability and he is experienced in a
broad range of subjects (software design, software development process, project management, testing, UI, multithreading,
database, mobile development, and more).
Outside of professional work, there is always some side projects he is working on such as simulation modeling of forest
management and carbon quantification and writing articles both technical and non-technical. While not coding, he is occupied
with reading, watching tv shows, trading stocks, and discuss climate change, global warming, emission trading, and traveling to
meet people, place and culture.
Search Comments
https://www.codeproject.com/Tips/1280404/Resolve-version-error-CS1705-through-Package-Manag 3/4
27/03/2019 Resolve version error (CS1705) through Package Manager Console - CodeProject
https://www.codeproject.com/Tips/1280404/Resolve-version-error-CS1705-through-Package-Manag 4/4