I recently moved from VS 2017 to VS 2019. Since upgrading I've been unable to open any .sqlproj projects in VS as they all refuse to load with the error -
Could not load file or assembly
'Microsoft.SqlServer.Management.SqlParser, Version=15.100.0.0,
Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its
dependencies. The system cannot find the file specified.
Here's the interesting part. The Fusion Log shows me -
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.SqlServer.Management.SqlParser, Version=15.100.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///c:/program files (x86)/microsoft visual studio/2019/enterprise/common7/ide/extensions/microsoft/sqlcommon/130/Microsoft.SqlServer.Management.SqlParser.dll.
LOG: Assembly download was successful. Attempting setup of file: c:\program files (x86)\microsoft visual studio\2019\enterprise\common7\ide\extensions\microsoft\sqlcommon\130\Microsoft.SqlServer.Management.SqlParser.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: Microsoft.SqlServer.Management.SqlParser, Version=13.100.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: The assembly reference did not match the assembly definition found.
I read this as :
I need to load version 15 of this dll
It's not in the GAC
I am going to look under the ...sqlcommon\130 directory
I've found the dll
It's the wrong version, 13 not 15
I can see the dll under the c:\program files (x86)\microsoft visual studio\2019...\sqlcommon\150 directory which (I think) should be the correct version. Anyone have any idea why is it probing the 'wrong' directory and how can I get it to look in the correct one?
Any pointers in the right direction whould be hugely appreciated.
I got the same problem as Build Error + Creating VSTO addin for excel 2010
After making the change according to the solution, I got the new error:
The "InitializeDefaultProperties" task could not be loaded from the
assembly
Microsoft.VisualStudio.Tools.Office.BuildTasks, Version=11.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Could not load file or
assembly 'Microsoft.VisualStudio.Tools.Office.BuildTasks,
Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one
of its dependencies. The system cannot find the file specified. Confirm
that the <UsingTask> declaration is correct, that the assembly and all its
dependencies are available, and that the task contains a public class that
implements Microsoft.Build.Framework.ITask.
I have installed VS2013 on the same machine so I change version=12.0.0.0 but I got a new error:
Error 2 The "SetInclusionListEntry" task could not be instantiated from
the assembly "Microsoft.VisualStudio.Tools.Office.BuildTasks,
Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Please verify the task assembly has been built using the same version of
the Microsoft.Build.Framework assembly as the one installed on your
computer and that your host application is not missing a binding redirect
for Microsoft.Build.Framework. Unable to cast object of type Micro
soft.VisualStudio.Tools.Office.BuildTasks.SetInclusionListEntry' to type
'Microsoft.Build.Framework.ITask'.
I know it's an old post, but maybe I have a solution for you...
I ran into exactly the same problem and I have to tell you that the "InitializeDefaultProperties" exception is not fix-able for VS2010.
First of all:
Make sure that your Visual Studio 2010 installation is not modified, anyway make a clean install just to be sure.
If you modified the C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets revert your changes.
If you now try to build your VSTO Project the following error should apppear:
The "FindRibbons" task could not be loaded from the assembly
Microsoft.VisualStudio.Tools.Office.BuildTasks, Version=10.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Could not load file
or assembly 'Microsoft.VisualStudio.Tools.Office.BuildTasks,
Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or
one of its dependencies. The system cannot find the file specified.
Confirm that the <UsingTask> declaration is correct, that the
assembly and all its dependencies are available, and that the task
contains a public class that implements
Microsoft.Build.Framework.ITask.
My Solution:
--> Open Visual Studio 2010 (you dont need to load a Project)
--> Go to Help an click About Microsoft Visual Studio
--> Check Version
Microsoft Visual Studio 2010 Version 10.0.40219.1 SP1Rel Microsoft
.NET Framework Version 4.5.51209 SP1Rel
If it says RTMRel download the Microsoft Visual Studio 2010 SP1 from here: http://go.microsoft.com/fwlink/?LinkId=210710
It includes the necessary VSTO and VSTO 4.0 Runtime.
If thats not the Problem, I'm sorry...
As I encountered the same problem upgrading our build server... I am gonna put the solution here in case anyone needs it.
I think the way to solve this is to fix your GAC.
Open the .target file of that tool by notepad and take a look at the UsingTask tag, you should get something like
<UsingTask TaskName="InitializeDefaultProperties" AssemblyName=" Microsoft.VisualStudio.Tools.Office.BuildTasks", Version=11.0.0.0,..., PublicKeyToken=sthsthsth
Then, go to your GAC files, e.g. C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.Tools.Office.BuildTasks
Then, create a new folder: v4.0_11.0.0.0_sthsthsth,
which is:
v<.NETFramework Version, mostly 4.0>_<Assembly Version>_<PublicKeyToken>
And then, put the .dll file of Microsoft.VisualStudio.Tools.Office.BuildTasks in it.
This dll should be obtained when you install VSTO either by directly install (VSTO2010) or by Visual Studio installer
e.g.
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.BuildTasks.dll
for Visual Studio 2017 and then directly place the dll inside the folder created
Then this issue should be fixed. Good luck
Could not load file or assembly 'Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The module was expected to contain an assembly manifest.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\11.0\WebDev.WebServer40.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = TTLWIN2K\miralp
LOG: DisplayName = Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///C:/SVN/temp/components/src/MasterpassProxy/src/Webservice/
LOG: Initial PrivatePath = C:\SVN\temp\components\src\MasterpassProxy\src\Webservice\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\SVN\temp\components\src\MasterpassProxy\src\Webservice\web.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
I just ran into the same problem, and the culprit was my uninstalling of Visual Studio Express 2012. It's possible that it might be any version of Visual Studio, as comments on this answer are indicating the issue still happens with Visual Studio 2019. My overall order of operations was:
Installed Visual Studio Express 2012 (long time ago)
Used Visual Studio Express 2012 happily for many months
Installed Visual Studio 2013 Premium
Used Visual Studio 2013 Premium happily for weeks
Uninstalled Visual Studio Express 2012
ERROR
I'm not 100% certain on the cause of it, or what combinations of Visual Studio versions would exhibit this behavior. But the solution for me was to edit the root web.config files in the framework directories:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config
(For different framework versions you may have different folders.)
And remove the nodes:
<remove assembly="Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
Be careful not to remove any opening/closing parent nodes which are also on the same line(s) as these.
This resolved the issue for me.
No need to remove those lines
Just close and reopen the Visual studio with Admin privileges.
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?
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:
Find the download cache directory
Use Explorer or better to find the AspNetDiagnosticPack.msi within this directory.
Run (double-click) the AspNetDiagnosticPack.msi file (this will force the installation of this MSI).
Workaround found here
I had this issue after installing Visual Studio 2019 (whilst 2017 was still installed). It's caused by a missing component - AspNetDiagnosticPack.msi - that fails to install a required package into C:\ProgramData\Microsoft\VisualStudio\Packages\
The solution that worked for me was this:
Close Visual Studio
Download the package from:
https://download.visualstudio.microsoft.com/download/pr/e13d544f-5a3c-4bb3-9a7c-1e56b1f90e10/f8e5888ff01a7009ef8c2ef16aa02ab9/aspnetdiagnosticpack.msi
Run the installer and install.
This should fix it.
More information can be be found: https://developercommunity.visualstudio.com/content/problem/398640/could-not-load-file-or-assembly-microsoftvisualstu-7.html
For those who might end up here, try removing the following line in the Web.Config file of your Project while debugging
<identity impersonate="true" userName="blah" password="blah">
It took time until I finally came across the following thread:
Could not load file or assembly or one of its dependencies. Access is denied. The issue is random, but after it happens once, it continues
I've ran into this error while trying to run an ASP.NET project in VS2013 after having uninstalled a VS2015 preview. Repairing the VS2013 installation seems to have solved the problem.
I got this answer is perfect for me
No need to remove those lines
Just close and reopen the Visual studio with Admin privileges.
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.
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.
Tools > NuGet Package Manager > Manage NuGet Packages for
Solution...
search for "applicationinsights"
or run
Install-Package Microsoft.ApplicationInsights
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!
If you don't see web.config in both of paths:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config
file "Web" is in "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\" what I really want to show you, It's Web.config, you should open it with: notepad++... and remove:
//<remove assembly="Microsoft.VisualStudio.Web.PageInspector.Loader,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />"
I finish my problem with them.
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.
I opened today a 10 year old project and encounter this issue in VS 2019 (16.9.1), in my case it was
<trust level="Medium"/>
removing above line from the web.config or setting <trust level="Full"/> solved this issue.
I know this is an old one but I ran into this error when debugging with Visual Studio 2010 (I also run 2013, 2017 and 2019 on the same machine...I have a few legacy apps :oP). In my case, I debug using local IIS as webserver (not express) and I ended up having to recycle the websites Application Pool which did the trick to clear the error (after restarting 2010).
Dave
it solved the problem on at my end by applying the approved solution in this thread.
modifying the following two files, and removing Microsoft.VisualStudio.Web.PageInspector.Loader resolved the issue.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config
Edit: My question comes down to, what are all the steps I need to take to build a web app that uses SQL Server CE in medium trust?
I had copied my desktop version into my bin directory before I posted this, but I'm sure there are more steps to take, as that did not work.
Error: Possible file version mismatch detected between ADO.NET Provider and native binaries of SQL Server Compact which could result in an incorrect functionality. This could be due to the presence of multiple instances of SQL Server Compact of different versions or due to wrong binaries with same name as SQL Server Compact binaries. Please install SQL Server Compact binaries of matching version.
Web App: MVC 3 built with VS 2010
Everything works fine on my dev machine.
After reading this post, I got rid of my references and copied SqlServerCE.dll and SqlServerCe.Entity.dll to my bin directory.
That changed the error from
Could not load file or assembly 'System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
to the current one.
I copied SqlServerCE.dll from my desktop folder, so I could run under medium trust.
From my Web.config file:
` <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
<assemblyIdentity name="System.Data.SqlServerCe"
publicKeyToken="89845dcd8080cc91" culture="neutral"/>
<bindingRedirect oldVersion="4.0.0.0-4.0.0.1" newVersion="4.0.0.1"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0" />
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</DbProviderFactories>`
Edit: Thanks everyone.
I do have SqlServerCompact.4.0.8852.1 in my packages directory.
I removed SqlServerCE.dll and SqlServerCe.Entity.dll from my bin directory, as they are in my packages. I copied the Native Binaries into my bin (and they are included in the project), but I still get this message:
Possible file version mismatch detected between ADO.NET Provider and
native binaries of SQL Server Compact which could result in an
incorrect functionality. This could be due to the presence of multiple
instances of SQL Server Compact of different versions or due to wrong
binaries with same name as SQL Server Compact binaries. Please install
SQL Server Compact binaries of matching version.
I was unable to use the nuget package you suggested as I have a newer version of Entity Framework and it rolled back the install.
I'm ready to start over with a new project if anyone can recommend a setup of SQL Server CE that will work in Medium trust on a shared hosting server.
This is what I have been doing (and does not work) when I created my project.
a. Install-Package SqlServerCompact
b. Install-Package System.Web.Providers
c. Install-Package EntityFramework
d. Install-Package EntityFramework.SqlServerCompact
Check at your packages directory if your SqlCompact is this version: SqlServerCompact.4.0.8852.1
If yes, you need to copy the files inside packages\SqlServerCompact.4.0.8852.1\NativeBinaries because they are different.
But this version donĀ“t run at medium trust, because they changed the SqlCompact version to 4.0.0.1 and only the 4.0.0.0 is authorized by default at .NET 4 config file. If you need a version that run at medium trust, try this one https://nuget.org/packages/EntityFramework.SqlServerCompact/4.1.8482.2
I downloaded Firebird 2.5 and read somewhere that it supports Entity Framework. When I add ADO.NET Entity Data Model in my project and try to update database with model, Visual Studio 2010 only displays SQL Server data sources in the list. There is no ODBC or Firebird.NET provider listed.
In that case, how to make Firebird to act as a data source for the Entity Model in my project?
Install Firebird-2.5.0.26074_1_Win32.
Install NETProvider-2.6.0.
And to integrate it in VS2010:
Extract FirebirdDDEXProvider-2.0.5.zip and follow instructions in ReadMe.txt inside.
(the combination of these versions is working - I haven't tried the newer versions)
Update:
A little more details on how I did some of the steps in ReadMe.txt
In Step-1: Register these 2 files in GAC
cd "C:\Program Files\FirebirdDDEXProvider-2.0.5"
"C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\gacutil.exe" /i FirebirdSql.VisualStudio.DataTools.dll
cd "C:\Program Files\FirebirdClient"
"C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\gacutil.exe" /i FirebirdSql.Data.FirebirdClient.dll
In Step-2: Here is the part I added to machine.config
<configuration>
<configSections>
...
<section name="firebirdsql.data.firebirdclient"
type="System.Data.Common.DbProviderConfigurationHandler, System.Data,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
and
<system.data>
<DbProviderFactories>
<add name="FirebirdClient Data Provider" invariant="FirebirdSql.Data.FirebirdClient"
description=".Net Framework Data Provider for Firebird"
type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory,
FirebirdSql.Data.FirebirdClient, Version=2.6.0.0, Culture=neutral,
PublicKeyToken=3750abcc3150b00c" />
Replace "3750abcc3150b00c" in the above with the key from this:
"C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\gacutil.exe" /l Firebirdsql.data.firebirdclient
i did the same, in server explorer Firebird's provider is recognized, but i can't create entity data model, because there is no Firebird's provider in provider's list.
Better to use MSI packages that are now available. For both provider as well as DDEX. It will take care of registering DDEX etc. for you. Don't forgot to click "Advanced" button to select proper versions.