.net Npgsql v5.0.0 GAC安装
正如Npgsql 5.0版发行说明(突破性更改)中所述,MSI GAC安装程序已停止使用。发行说明中的声明如下:.net Npgsql v5.0.0 GAC安装,.net,npgsql,gac,.net,Npgsql,Gac,正如Npgsql 5.0版发行说明(突破性更改)中所述,MSI GAC安装程序已停止使用。发行说明中的声明如下: gacutil.exe /i Npgsql.dll gacutil.exe /i Microsoft.Bcl.AsyncInterfaces.dll gacutil.exe /i System.Buffers.dll gacutil.exe /i System.Memory.dll gacutil.exe /i System.Numerics.Vecto
gacutil.exe /i Npgsql.dll
gacutil.exe /i Microsoft.Bcl.AsyncInterfaces.dll
gacutil.exe /i System.Buffers.dll
gacutil.exe /i System.Memory.dll
gacutil.exe /i System.Numerics.Vectors.dll
gacutil.exe /i System.Runtime.CompilerServices.Unsafe.dll
gacutil.exe /i System.Text.Encodings.Web.dll
gacutil.exe /i System.Text.Json.dll
gacutil.exe /i System.Threading.Channels.dll
gacutil.exe /i System.Threading.Tasks.Extensions.dll
gacutil.exe /i System.ValueTuple.dll
Npgsql不再以.NETFramework 4.6.1为目标。自.NET标准2.0以来
如果有针对性,仍然可以使用.NET Framework中的Npgsql
应用;但是,我们不再在.NET上运行回归测试
框架,并且只会在尽最大努力的基础上修复bug。此外
VisualStudio扩展(VSIX)和MSI GAC安装程序已安装
停产
由于此更改,我面临的问题是,我的客户端使用MSI安装程序在GAC中安装Npgsql,我的应用程序使用.Net framework的System.Data.Common.DbProviderFactorys动态加载其工厂。这使我能够灵活地让客户机根据其数据库版本选择所需的提供程序版本
切换到nuget软件包安装将增加在我的应用程序中更新Npgsql软件包的开销。因此,我想避开这条路线。有没有办法像MSI安装程序那样在GAC中安装最新的Npgsql 5.0版本
如果是,请告诉我操作步骤。Npgsql 5.0不再针对.NET Framework(net461TFM),只针对
netstandard2.0
TFM(以及一些较新的)。因此,无法再将其安装到GAC中
DbProviderFactorys仍然可以在没有GAC的情况下使用(使用.NET Framework或.NET Core),但是Npgsql程序集必须与应用程序一起分发,或者作为“插件”放入其目录中。最后,我使用gacutil.exe在GAC中注册了所有程序集,使其正常工作 我在应用程序中使用.Net framework 4.6.1,并已执行以下步骤在GAC中安装Npgsql 5.0.0.0版:
gacutil.exe /i Npgsql.dll
gacutil.exe /i Microsoft.Bcl.AsyncInterfaces.dll
gacutil.exe /i System.Buffers.dll
gacutil.exe /i System.Memory.dll
gacutil.exe /i System.Numerics.Vectors.dll
gacutil.exe /i System.Runtime.CompilerServices.Unsafe.dll
gacutil.exe /i System.Text.Encodings.Web.dll
gacutil.exe /i System.Text.Json.dll
gacutil.exe /i System.Threading.Channels.dll
gacutil.exe /i System.Threading.Tasks.Extensions.dll
gacutil.exe /i System.ValueTuple.dll
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.Config
位置2:C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.Config
配置条目:
<system.data>
<DbProviderFactories><add name="Npgsql Data Provider" invariant="Npgsql" description=".NET Data Provider for PostgreSQL" type="Npgsql.NpgsqlFactory, Npgsql, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5D8B90D52F46FDA7"/></DbProviderFactories>
</system.data>
部分下添加以下行:
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
</dependentAssembly>
现在,我可以轻松地在应用程序中获得DbProviderFactory实例,而不会出现任何问题。这是我主要关心的问题,我希望避免将Npgsql与我的应用程序捆绑在一起,否则我可以使用Nuget.AFAIK轻松地将其捆绑在一起,使用Npgsql 5.0.0,无法将其安装到GAC中。与应用程序捆绑(或允许用户以某种方式将其安装到应用程序中)是您唯一的选择。由于您是Npgsql的所有者,我必须相信没有其他方法:)很高兴知道您在这里很活跃,直接从您那里得到答案当然是值得赞赏的。非常感谢你的时间和帮助。谢谢。。。我可以肯定的是,NPGSQL5.0.0不再针对任何.NET框架,只针对TFM的.NET标准和.NET核心。我不太确定的是,是否可以在GAC中安装netstandard2.0程序集-您可以使用gacutil手动尝试-iYes我会尝试一下,再次感谢。