我有一個項目,有一堆的遷移。我可以使用migrator.exe手動運行它,但是我很難讓它與NAnt一起工作,我更喜歡它。設置NAnt&FluentMigrator
我有以下內容的* .build文件:
<project name="Migrations" xmlns="http://nant.sf.net/release/0.85/nant.xsd" default="migrate">
<loadtasks assembly="../packages/FluentMigrator.1.0.3.0/tools/FluentMigrator.NAnt.dll" />
<target name="migrate" description="Migrate the database">
<property name="version" value="-1" overwrite="false" />
<migrate
provider="sqlserver2008"
connectionstring="data source=*********; Initial Catalog=*****;User Id=*******; Password=********;"
target="./Migrations/bin/Debug/Migrations.dll"
directory="Migrations"
task="migrate"
to="${version}" />
</target>
</project>
在運行此我得到以下輸出: 構建失敗
C:\projects\ThisProject\Migrations\migrations.build(3,3):
Failure scanning "C:\projects\packages\FluentMigrator.1.0.3.0\tools\FluentMigrator.NAnt.dll" for extensions.
Could not load file or assembly 'file:///C:\projects\packages\FluentMigrator.1.0.3.0\tools\FluentMigrator.NAnt.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.
我去尋找,但的Depends.exe該網站似乎失敗了,關於如何得到這個工作的任何想法?如果我全都做錯了,我會接受全新的想法。
======更新了完整的解決方案======
主席和armen.shimoon是在一些與他們的答案。
第一步,我更新了我的FluentMigrator和FluentMigrator.Tools到1.0.5.0。這些工具仍然在1.0.3.0。
第二步是更新我的構建文件以引用.NET 4.0 dll。兩者的結合解決了這個問題,但直到我引用.NET 4.0 dll時才顯示出改進。
這裏是供將來參考我目前.build文件:
<project name="Migrations" xmlns="http://nant.sf.net/release/0.85/nant.xsd" default="migrate">
<loadtasks assembly="../packages/FluentMigrator.Tools.1.0.5.0/tools/anycpu/40/FluentMigrator.Nant.dll" />
<target name="migrate" description="Migrate the database">
<property name="version" value="-1" overwrite="false" />
<migrate
database="sqlserver2008"
connection="data source=******; Initial Catalog=*****;User Id=*****; Password=*****;"
target="../Migrations/bin/Debug/Migrations.dll"
verbose="true"
/>
</target>
</project>
最終給你答案,因爲這是我需要採取的最後一步。 –