I'm using Umbraco 7.4.3 and had been randomly getting YSOD saying
Could not load file or assembly 'Microsoft.CodeAnalysis.CSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
The stack trace shows the following error not sure why.
Stack Trace:
[FileLoadException: Could not load file or assembly 'Microsoft.CodeAnalysis.CSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
Umbraco.ModelsBuilder.Umbraco.LiveModelsProvider.get_IsEnabled() in C:\Users\Stéphane\Documents\Development\Umbraco\Zbu\Zbu.ModelsBuilder\Umbraco.ModelsBuilder\Umbraco\LiveModelsProvider.cs:27
Umbraco.ModelsBuilder.Umbraco.LiveModelsProviderModule.Install() in C:\Users\Stéphane\Documents\Development\Umbraco\Zbu\Zbu.ModelsBuilder\Umbraco.ModelsBuilder\Umbraco\LiveModelsProvider.cs:134
[InvalidOperationException: The pre-application start initialization method Install on type Umbraco.ModelsBuilder.Umbraco.LiveModelsProviderModule threw an exception with the following error message: Could not load file or assembly 'Microsoft.CodeAnalysis.CSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040).]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +874
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +169
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +133
System.Web.Compilation.BuildManager.ExecutePreAppStart() +176
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +734
[HttpException (0x80004005): The pre-application start initialization method Install on type Umbraco.ModelsBuilder.Umbraco.LiveModelsProviderModule threw an exception with the following error message: Could not load file or assembly 'Microsoft.CodeAnalysis.CSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040).]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +579
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +112
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +716
Anyone got any idea? Can't figure out what triggered the error. It happens randomly.
I've done a search around and someone mentioned to delete the package folder of Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0 and then restore the nuget package. That fixes the problem.
But from time to time it happens again which is not that great.
If the reinstall fixes the package then it could be that you've got only part of the nuget package in version control (so it doesn't restore any missing file).
Same here. Just done a NUGET upgrade to 7.5.6 on a 7.4.3 Fanoe test site and carefully checked the config dir files and web.config, all ok. Already have a reference to Microsoft.CodeAnalysis.CSharp but still get YSOD: Could not load file or assembly 'Microsoft.CodeAnalysis.CSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Seems a common issue this, am on 7.7.4 updated some code done a rebuild and boom it went lol, seem the nuget re-install fixed it. I actually had to un install it first then re-install it again as i already had it installed and was picking up any update required.
ModelsBuilder Microsoft.CodeAnalysis.CSharp Error
Hi All,
I'm using Umbraco 7.4.3 and had been randomly getting YSOD saying
The stack trace shows the following error not sure why.
Stack Trace:
Anyone got any idea? Can't figure out what triggered the error. It happens randomly.
I've done a search around and someone mentioned to delete the package folder of Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0 and then restore the nuget package. That fixes the problem.
But from time to time it happens again which is not that great.
Thanks
Stupid question perhaps, but I take it that you actually have a reference to Microsoft.CodeAnalysis.CSharp in your project references?
If it is as simple as that then type this in to your package manager console:
had just got it checked, yup got Microsoft.CodeAnalysis.CSharp reference in my project. Will try to reinstall the package.
Any idea why a reinstall on the package?
Thanks David
If the reinstall fixes the package then it could be that you've got only part of the nuget package in version control (so it doesn't restore any missing file).
I'm getting the same error at runtime, but when I use that command, Nuget says it already exists in the project, how do I reinstall it?
Same here. Just done a NUGET upgrade to 7.5.6 on a 7.4.3 Fanoe test site and carefully checked the config dir files and web.config, all ok. Already have a reference to Microsoft.CodeAnalysis.CSharp but still get YSOD:
Could not load file or assembly 'Microsoft.CodeAnalysis.CSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Fixed by doing a NUGET Update on the Microsoft.CodeAnalysis.
HTH
Fixed the issue by running following command in NuGet Package Manager Console:
Seems a common issue this, am on 7.7.4 updated some code done a rebuild and boom it went lol, seem the nuget re-install fixed it. I actually had to un install it first then re-install it again as i already had it installed and was picking up any update required.
is working on a reply...