For example – convert visual studio 2013 project to visual studio 2015 or take project source code from source control.
You will see the following screen with yellow mark on the assembly that means assembly reference is missing and visual studio not able to find .dll files.
“Package” is the folder which mainly stores all assembly which using by project and visual studio store and takes reference of the assembly from this folder.
Sometimes you will see the package folder with sub folder with assembly names but .dll files are missing inside the folder.
Have a look at the following screens. Today I am showing you how to resolve missing an assembly reference in Visual Studio.
Solution -1 – Change framework version to fix Missing an assembly reference problem in Visual Studio.
Right click on the project and select properties then click on build and change framework version and then build a project.
Solution -2 – “Restore NuGet Packages” options to fix Missing an assembly reference problem in Visual Studio.
It’s an easy to step to restore Nuget packages.
<Target Name=”EnsureNuGetPackageBuildImports” BeforeTargets=”PrepareForBuild”>
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition=”!Exists(‘..packagesMicrosoft.Net.Compilers.1.0.0buildMicrosoft.Net.Compilers.props’)” Text=”$([System.String]::Format(‘$(ErrorText)’, ‘..packagesMicrosoft.Net.Compilers.1.0.0buildMicrosoft.Net.Compilers.props’))” />
<Error Condition=”!Exists(‘..packagesMicrosoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0buildMicrosoft.CodeDom.Providers.DotNetCompilerPlatform.props’)” Text=”$([System.String]::Format(‘$(ErrorText)’, ‘..packagesMicrosoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0buildMicrosoft.CodeDom.Providers.DotNetCompilerPlatform.props’))” />
</Target>
Solution – 4 – Remove packages folder to fix Missing an assembly reference problem in Visual Studio.
In this step remove packages folder and go to package manager and run following command.
After successful installation of packages close project and restart project.
Update-Package -reinstall