[英]How to use FluentMigrator.Runner for selected type of database only
Currently when I add FluentMigrator.Runner nuget package into c# project it automatically installs all other related nuget packages: FluentMigrator.Runner.Db2 , FluentMigrator.Runner.Firebird , etc. 目前,当我将FluentMigrator.Runner nuget包添加到c#项目中时,它会自动安装所有其他相关的nuget包: FluentMigrator.Runner.Db2 , FluentMigrator.Runner.Firebird等。
But I only need SqlServer support. 但我只需要SqlServer支持。 I can't uninstall all this secondary packages because FluentMigrator.Runner depends on them. 我无法卸载所有这些辅助包,因为FluentMigrator.Runner依赖于它们。
If I force remove references I just got runtime errors: 如果我强制删除引用,我只会遇到运行时错误:
Could not load file or assembly 'FluentMigrator.Runner.Db2, Version=3.0.0.0,
Culture=neutral, PublicKeyToken=aacfc7de5acabf05' or one of its dependencies.
The system cannot find the file specified.
This makes my c# project to reference a lot of useless dlls. 这使我的c#项目引用了很多无用的dll。 Especially Sql Server Ce native files. 特别是Sql Server Ce本机文件。 Is there a way to get rid of Db2, Firebird and other implementations if I only need SqlServer? 如果我只需要SqlServer,有没有办法摆脱Db2,Firebird和其他实现?
I use Fluent Migrator version 3 and .Net 4.7.1 我使用Fluent Migrator版本3和.Net 4.7.1
Here is a workaround to this problem: 以下是此问题的解决方法:
<Import Project="..\\packages\\FluentMigrator.Runner.SqlServerCe.3.1.3\\build\\netstandard2.0\\FluentMigrator.Runner.SqlServerCe.targets" Condition="Exists('..\\packages\\FluentMigrator.Runner.SqlServerCe.3.1.3\\build\\netstandard2.0\\FluentMigrator.Runner.SqlServerCe.targets')" /> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <PropertyGroup> <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> </PropertyGroup> <Error Condition="!Exists('..\\packages\\FluentMigrator.Runner.SqlServerCe.3.1.3\\build\\netstandard2.0\\FluentMigrator.Runner.SqlServerCe.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\\packages\\FluentMigrator.Runner.SqlServerCe.3.1.3\\build\\netstandard2.0\\FluentMigrator.Runner.SqlServerCe.targets'))" /> </Target>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.