FileNotFoundException: Could not load file or assembly

Visto 319 veces
Saltar al primer mensaje no leído

corydeppen

no leída,
2 oct 2010, 22:47:132/10/10
a FluentMigrator Google Group
I've been trying to use FluentMigrator in an MVC 2 project but
continue to get an error when Migrate attempts to load a few
assemblies. What confuses me is that the migrations actually run, but
there is something that is trying to load the assemblies after the
migrations run. Interestingly, it looks like it's trying to find the
assemblies inside the lib\fluentmigrator directory instead of the
app's bin directory.

I've included one of the load failures below as generated using the
Assembly Binding Log Viewer.


*** Assembly Binder Log Entry (10/2/2010 @ 10:33:33 PM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file
specified.

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework
\v4.0.30319\clr.dll
Running under executable c:\Projects\MvcMigrations\lib\fluentmigrator
\Migrate.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = WIN7-VS2010-VM\Cory
LOG: DisplayName = RestfulRouting, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/Projects/MvcMigrations/lib/fluentmigrator/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = Migrate.exe
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Projects\MvcMigrations
\lib\fluentmigrator\Migrate.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET
\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private,
custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL
file:///C:/Projects/MvcMigrations/lib/fluentmigrator/RestfulRouting.DLL.
LOG: Attempting download of new URL
file:///C:/Projects/MvcMigrations/lib/fluentmigrator/RestfulRouting/RestfulRouting.DLL.
LOG: Attempting download of new URL
file:///C:/Projects/MvcMigrations/lib/fluentmigrator/RestfulRouting.EXE.
LOG: Attempting download of new URL
file:///C:/Projects/MvcMigrations/lib/fluentmigrator/RestfulRouting/RestfulRouting.EXE.
LOG: All probing URLs attempted and failed.

Sean Chambers

no leída,
3 oct 2010, 7:34:463/10/10
a fluentmigrato...@googlegroups.com
By default, it will look for assemblies where ever the Migrate.exe is located. You can specify a different location to look for migration assemblies by using the --workingdirectory commandline option.

Fact of the matter is, there's no way for migrate.exe to know where your bin folder is. If you copy migrate.exe to your bin folder and then execute it, it should find all of your migration assemblies. If not, then there is a bug.

Can you confirm that migrate.exe is under your lib/fluentmigrator folder?

Sean


--
You received this message because you are subscribed to the Google Groups "FluentMigrator Google Group" group.
To post to this group, send email to fluentmigrato...@googlegroups.com.
To unsubscribe from this group, send email to fluentmigrator-goog...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/fluentmigrator-google-group?hl=en.


corydeppen

no leída,
3 oct 2010, 10:52:373/10/10
a FluentMigrator Google Group
Yes, migrate.exe is under lib\fluentmigrator.

Specifying the bin path using the --workingdirectory option doesn't
seem to work and the output from the assembly binding log viewer
doesn't show that directory is being probed. One thing I did try was
to include the following in the Migrate.exe.config file.

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="../../MvcMigrations.Web\bin" />
</assemblyBinding>
</runtime>

Unfortunately, I get warnings that it doesn't probe outside the
Appbase directory, which is the lib\fluentmigrator directory.

If I put Migrate.exe inside the bin directory the rest of the
fluentmigrator assemblies are not found because the Appbase is now the
bin directory. This is essentially the same issue I'm having with my
app's assemblies when I call Migrate.exe from the fluentmigrator
directory.

The only thing that seems to work for me right now is if I move
migrate.exe to the solution root, then specify the fluentmigrator and
bin paths in the migrate.exe.config in the assemblybinding section
(i.e. <probing privatePath="lib\fluentmigrator;MvcMigrations.Web\bin" /
>).

-- Cory
> > fluentmigrator-goog...@googlegroups.com<fluentmigrator-goo gle-group%2Bunsu...@googlegroups.com>
> > .

Sean Chambers

no leída,
4 oct 2010, 0:39:294/10/10
a fluentmigrato...@googlegroups.com
Can you file a bug under the issues list on github (http://github.com/schambers/fluentmigrator/issues) so I can track this. I will take a look when I have a chance later in the week.

If you happen to come up with a fix please send me a pull request. Thanks

Sean

To unsubscribe from this group, send email to fluentmigrator-goog...@googlegroups.com.
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos