Could not load file or assembly \'Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\' or one of its depen
Our project had (incorrectly) reference to the PageInspector.Loader.dll in the GAC for a long time:
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.Web.PageInspector.Loader">
<HintPath>..\..\..\..\..\..\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.Web.PageInspector.Loader\v4.0_1.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Web.PageInspector.Loader.dll</HintPath>
</Reference>
</ItemGroup>
It worked for some time, but recently deployment to Azure caused the error "Can not find compilation library location for package Microsoft.VisualStudio.Web.PageInspector.Loader".
We found and deleted the reference from .csproj file and the problem was fixed.
Update: fixed in Visual Studio 2019 Version 16.0.3 according to this page.
If this happens after upgrading to Visual Studio 2019 RC, the following workaround helped:
Workaround found here
Had a similar problem (another assembly) and for me it was a missing line in the web.config on the machine. A line that I think lets the web server load (any?) dll. I had to add "*" to the compilation-assemblies list in the web.config:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config
Like this
<compilation>
<assemblies>
...
<add assembly="*" />
</assemblies>
</compilation>
To find it I had to compare the file with one from a working server. So it seems to me that It really is a load failure, but to determine why it fails, we need to be Sherlook H.. Normally I use a tool like ProcessMonitor to find out why I get a Load Failure, but this time, of course, it gave me no useful output.. IIS never tried to load the assembly!
I got the same problem but not on my development machine but on hosting server.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config
I was able to fix it by adding below code to my web.config
<compilation targetFramework="4.5">
<assemblies>
<remove assembly="Microsoft.VisualStudio.Web.PageInspector.Loader,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</assemblies>
</compilation>
or by removing reference to this assembly from web.config files in framework directories.
I never installed VS there and i never had PageInspector installed there. Any idea why those configs reference them?
Try updating your Microsoft.ApplicationInsights nuget package. This also installs other dependencies. I ran into this problem when I had to change my Target Framework.
or run
Install-Package Microsoft.ApplicationInsights
I removed the dll from gac and it started working. I am not sure where those dlls came from. If you have 2 or more versions of visual studio, reinstall the last version.