[Solved] Could not load file or assembly ‘Microsoft.CodeAnalysis, version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependenc

An update occurred last night and now I find myself unable to do a ctrl + ‘.’ for code suggestions in VS 2015. An error message comes up saying the following:

Could not load file or assembly ‘Microsoft.CodeAnalysis, version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.

I can still build and develop but this will be really annoying without this feature. I admit it, I am getting soft!

Anyone have a suggestion for fixing this bug?

Solution #1:

I had the same problem with Visual Studio 2015 Update 2, to solve the problem globally for all solutions, update to Visual Studio 2015 Update 3. Here is a link: Download from here

Respondent: shopOFF

Solution #2:

As pointed out by @CaptainAmerica the solution is to update the CodeDom assembly from NuGet. One should point out how to do this in Visual Studio.
I found the solution here:


Basically, in the Visual Studio menu select:

Tools-> Nuget Package Manager -> Package Manager Console

In the console that appears at the bottom of Visual Studio run this command:

Install-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform
Respondent: Vilhelm H.

Solution #3:

If any of the options doesn’t work, here is the detailed guide to handle this scenario….

First of all version is important. Notice the version mentioned in the error…

Could not load file or assembly 'Microsoft.CodeAnalysis, version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

If you see above error it means that it’s not able to find version 1.3.1. Now please create new VS project. No preferences, it can be just simple console application. Now once project template is ready, go to Package Manager and run following command with your specified version…

Install-Package Microsoft.CodeAnalysis -Version 1.3.1

This will install all packages. Let it complete. Once it’s done. We don’t need this newly created project at all. You can delete it completely. Seriously! you can delete it. We did this because we wanted that package installed at global nuget level. When you install something, nuget stores it at global level of your machine as well. Path will be something like this…

C:Users<<Your Windows User>>.nugetpackages

You can know your path by following…


Now you will see your required Microsoft.CodeAnalysis.dll there in following folder…

C:Users<<Your Windows User>>.nugetpackagesMicrosoft.CodeAnalysis.Common1.3.1lib

Please note that above path contains version number (1.3.1). If your version is different, look into that version folder.

Now that you have dll with you, all that you need to do is add that dll to GAC. For that you will need GacUtil.exe

This file get installed along with Visual Studio already. You can search “GacUtil” in C drive. For me it’s there on below path…

C:Program Files (x86)Microsoft SDKsWindowsv10.0AinNETFX 4.6.1 Tools

Now run command prompt as Administrator and navigate current directory to your path containing GacUtil. The run below command to install that dll in GAC.

 -i C:Users<<You Windows User>>.nugetpackagesMicrosoft.CodeAnalysis.Common1.3.1lib

Basically providing path to dll we installed globally. It will show message on successful installation.

That’s all! Now start your Visual Studio again and you will get this issue fixed.

Respondent: Dhrumil Bhankhar

Solution #4:

I found this page and at the bottom of the page under “Compatibility with ASP.NET” it says that ASP.NET uses the nuget package Microsoft.CodeDom.Providers.DotNetCompilerPlatform to update the Microsoft.CodeAnalysis assemblies. So I updated the DotNetCompilerPlatform package from 1.0.0 to 1.0.3 and it works again! Yeah, life is good again!

Respondent: Captain America

Solution #5:

To solve this problem for all solutions, I needed to install the assembly Microsoft.CodeAnalysis.dll directly to the GAC – Global Assemblies Cache.

I got the file Microsoft.CodeAnalysis.dll from C:/Users/[user]/.nuget/packages/Microsoft.CodeAnalysis.Common/1.3.2/lib/portable-net45+win8/Microsoft.CodeAnalysis.dll.

To install the assembly to the GAC, I used a PowerShell script from https://github.com/LTruijens/powershell-gac.

Finally, I managed to install the assembly to the GAC with the following command from PowerShell:

Add-GacAssembly [myPath]Microsoft.CodeAnalysis.dll
Respondent: Marcello

Solution #6:

I was also facing same issue. My visual studio 2015 version was 2.0. I upgraded it to version 3.

Issue got solved !!!

Respondent: AbhijeetGaikwad

Solution #7:

I have solved the problem this way:

Update Visual studio 2015 to Update 3

from the menu chose View => Notifications => Visual Studio Update 3 and clicked the update button.

Respondent: MarianNikolov

Solution #8:

Today ! i got the same problem and i resolve it by restarting visual studio 2015 🙂

Respondent: Don Simo

Solution #9:

I was also facing same issue, Try installing Microsoft.CodeAnalysis.CSharp nuget package. And if its not resolved, check version of Microsoft.Net.Compilers in your project, I was having version as 1.0.0 which was causing issue so updated Microsoft.Net.Compilers nuget to v1.3.2.

Found solution here : Github discussion

Respondent: Priyank Kotiyal

Solution #10:

I fixed this issue by updating all Nuget Microsoft dependencies to v2.0.0. This was using VS 2017. I was using a preview version.

Respondent: Wilkoteq

Solution #11:

In my case, the error occurred after turning off Live Unit Testing and running tests manually.Some tests would fail with the above error message.

Going into Test –> Live Unit Testing –> Options and issuing “Delete Persisted Data” resolved the problem.

Respondent: MonteChristo

Solution #12:

I fixed similar issue by deleting the .vs folder located inside the solution.

Respondent: HonzaCZE

Solution #13:

I found the missing assemblies in the NuGet package (After the first one was resolved there were mulitple otheres): https://www.nuget.org/packages/Microsoft.Net.Compilers/1.3.1-rc

Installed them using GacUtil from the Dev console.

Respondent: CoolMcGrrr

Solution #14:

Unfortunately the extensive solution with “nuget install/gacutil” here above couldn’t work as the exact version of the dependency dll was not available.

The following solved my issue in our complex webform application was to perform within the solution in Visual Studio -> Tools -> Nuget -> console package manager

Update-Package -reinstall 
Respondent: jpb

Solution #15:

In my case, I was getting this error because my Visual Studio Solution was trying to use TextTransform.exe during a pre-build step in one of the projects, but my local machine didn’t have the TextTransform.exe at the path specified by my pre-build step and my first attempt at fixing that was to just copy TextTransform.exe from some other location to where Visual Studio expected it to be. That appears to have caused this problem, because TextTransform.exe has other silent dependencies.

My fix was to change the pre-build steps so instead of looking for the file at

C:Program Files (x86)Common Filesmicrosoft sharedTextTemplating14.0TextTransform.exe

it would instead look in the Visual Studio install folder which had a bunch of other files, presumably one of which was a peer dependency of TextTransform.exe

C:Program FilesVisual StudioCommon7IDETextTransform.exe

That seemed to fix things for me.

Respondent: MostlyArmless

Solution #16:

I got the same problem, I am using VS2017 and installed Microsoft.EntityFrameworkCore.SqlServer 3.1.8, while in my VS2017 .Net core version is 2.1
So I downgraded my Microsoft.EntityFrameworkCore.SqlServer to 2.1.1 and restarted the solution.

The warning was gone !!

Respondent: Ashvani mishra

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.