I am using Visual Studio 2008 SP1 on Windows XP SP3 to develop some .NET Compact Framework 3.5 SP1 solution for Windows CE 6.
I want to use SQL Server Compact 3.5 SP2 in my solution, however I notice something very strange with how Visual Studio treats assembly references.
I have installed both "SQL Server Compact 3.5 SP2 for Windows Desktop" (SSCERuntime_x86-ENU.msi) and "SQL Server Compact 3.5 SP2 for Windows Mobile" (SSCEDeviceRuntime-ENU.msi). The former puts two versions of the System.Data.SqlServerCE assembly and one version of the System.Data.SqlServerCe.Entity assembly into Windows XP's GAC, while the latter does not seem to put any assembly into Windows XP's GAC. Here already, it looks strange because GAC reports the versions of the two assemblies to be 3.5.1.0 and 3.5.0.0 for System.Data.SqlServerCE, and 3.5.1.0 for System.Data.SqlServerCE.Entity, whereas in the installation directories of SQL Server Compact 3.5 SP2 ("C:\Program Files\Microsoft SQL Server Compact Edition\v3.5" and "C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Desktop"), Windows Explorer reports both assemblies to be version 3.5.8080.0. Now I know that 3.5.0.0 is supposed to be for vanilla SQL Server Compact 3.5 (i.e. no SP) and 3.5.1.0 is supposed to be for SP1, not SP2. I did not install either vanilla or SP1, so why are they even there?
Furthermore, in Visual Studio 2008 SP1, when I try to add the System.Data.SqlServerCE assembly from the "C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Devices" directory, Visual Studio 2008 SP1 reports a version number of 3.5.1.0 in the Properties panel. This version number seems to be retrieved from the GAC'ed assembly, which shouldn't even be for .NET Compact Framework. The real version number in "C:\Program Files\Mi开发者_开发技巧crosoft SQL Server Compact Edition\v3.5\Devices" is supposed to be 3.5.8080.0, again.
I know that it is possible to use private deployment, as described at http://msdn.microsoft.com/en-us/library/gg213826.aspx, but I'm still bothered by the fact that Visual Studio seems to be referencing the wrong platform-version of the assembly altogether when I don't specifically resort to private deployment.
Maybe I just don't understand how Visual Studio works in conjunction with GAC. Can somebody enlighten me? Is there a way to "fix" this without resorting to private deployment?
The File Version is 3.5.8080.0.
The Assembly Version is 3.5.1.0.
You can confirm this by opening the properties of the file in Explorer, and switching to the "Version" tab (well, you can for the Desktop files which also report themselves as 3.5.8080.0, but are in fact 3.5.1.0. You can't for the Devices files, but the same explanation applies)
Visual Studio doesn't interact with the GAC at all when it comes to referencing assemblies (in fact, see the related question Why does the .NET tab in the 'Add Reference' dialog in Visual Studio not list the contents of the GAC?)
精彩评论