WinForm .NET 4的app.config到私有部署SQL Server CE SP2 [英] app.config for WinForm .NET 4 to Private Deploy SQL Server CE SP2

查看:211
本文介绍了WinForm .NET 4的app.config到私有部署SQL Server CE SP2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Visual Studio 2010(C#)应用程序正在运行,并且本周我一直在尝试使用安装项目来部署它,但没有成功.

My Visual Studio 2010 (C#) application is working, and I've been trying to deploy it using a Setup Project all this week with no success.

我首先在

I started by following Steve Lasker's Web Blog on Privately Deploying SQL Server Compact with the ADO.NET Entity Provider. It had me modify the project's app.config file to include the following:

  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SqlServerCe.3.5"></remove>
      <add name="Microsoft SQL Server Compact Data Provider"
           invariant="System.Data.SqlServerCe.3.5"
           description=".NET Framework Data Provider for Microsoft SQL Server Compact"
           type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.1.50, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
    </DbProviderFactories>  
  </system.data>

该安装仅在已安装SQL Server CE的PC上成功运行(仅 MY PC).

That installation only ran successfully on PCs where SQL Server CE was already installed (like MY PC only).

我必须仔细阅读这篇文章,并注意到它写于2008年,但David V留下了评论,链接到 排查问题:私下部署SQL Server Compact 3.5应用程序文件夹中的SP2 ADO.NET实体框架提供程序(System.Data.SqlServerCe.Entity.dll)不起作用.他们在文章中说,我必须添加程序集绑定重定向"(错误链接),并在我的app.config文件中附加以下信息:

I got to looking closer at the article, and noticed it was written in 2008, but that a David V left a comment linking to the SQL CE Team's article Troubleshooting: Privately deploying the SQL Server Compact 3.5 SP2 ADO.NET Entity Framework provider (System.Data.SqlServerCe.Entity.dll) in the application folder does not work. In their article, they said I had to add "assembly binding redirection" (bad link) and append my app.config file with the following information:

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845dcd8080cc91" culture="neutral"/>
        <bindingRedirect oldVersion="3.5.1.0-3.5.1.50" newVersion="3.5.1.50"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

所以,这里我有一个未安装的安装程序.

So, here I am with an Installer that does not install.

  <?xml version="1.0"?>
  <configuration>
    <appSettings>
      <add key="LastRun" value=""/>
      <add key="UserName" value=""/>
    </appSettings>
    <startup useLegacyV2RuntimeActivationPolicy="true">
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
    </startup>
    <system.data>
      <DbProviderFactories>
        <remove invariant="System.Data.SqlServerCe.3.5"></remove>
        <add name="Microsoft SQL Server Compact Data Provider"
             invariant="System.Data.SqlServerCe.3.5"
             description=".NET Framework Data Provider for Microsoft SQL Server Compact"
             type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.1.50, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
      </DbProviderFactories>  
    </system.data>
    <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
          <assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845dcd8080cc91" culture="neutral"/>
          <bindingRedirect oldVersion="3.5.1.0-3.5.1.50" newVersion="3.5.1.50"/>
        </dependentAssembly>
      </assemblyBinding>
    </runtime>
  </configuration>

我的app.config文件是否损坏?

我的应用程序仍然可以正常运行,但是安装程序无法安装任何程序.更改后的临时文件名的安装程序错误始终为2727:

My application still runs just fine, but the Installer fails to install anything. The Installer's error is always 2727 for a temporary file name that changes:

调试:错误2727:目录表中不存在目录条目'_1083472CD2EB47548297E3336FCD9A58'

DEBUG: Error 2727: The directory entry '_1083472CD2EB47548297E3336FCD9A58' does not exist in the Directory table

我该怎么办?

有人成功为专用实例成功部署了Microsoft SQL CE Server SP2吗?

Has anyone successfully deployed a Microsoft SQL CE Server SP2 for a Private instance?

推荐答案

在代码项目上找到了名为为SQL Compact创建专用安装,可立即解决我的问题.

Found a solution on Code Project called Creating a Private Installation for SQL Compact that fixed my problems right up.

基本上,这似乎可以归结为VS Installer并未创建文件夹或没有复制SSCE所需文件的事实.上面的链接详细介绍了如何做到这一点.

Basically, it looks like it all boiled down to the fact that the VS Installer was not creating the folders or copying over the files required by SSCE. The link above goes into detail about how to do just that.

我希望这对其他人有帮助.

I hope this helps others.

这篇关于WinForm .NET 4的app.config到私有部署SQL Server CE SP2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆