NoMigrationFoundException on Debug in Visual Studio
Cular opened this issue · 4 comments
I would like to use your solution for mongo migration. But I've got the problem.
I've downloaded your demo and run it. It works perfectly as expected.
But when you remove all references to src(Mongo.Migration) and try to run demo.core with installed nuget pkg, you will get an error in Visual Studio.
P.S. If you publish project, it works perfect.
Is this problem with VS (Community 2017 Version 15.8.8)? Or i miss some steps?
Mongo.Migration-master.Test.zip
UPD:
For some reason in class MigrationLocator
var assemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
Does not touch assembly with "*.MongoMigrations.dll", despite that run assembly (Main project) has reference on "*.MongoMigrations" project.
And
var migrationAssemblies = Directory.GetFiles(path, "*.MongoMigrations.dll").Select(Assembly.LoadFile);
can't find assembly because Directory is nuget cache folder.
That is why nuget pkg does not working in debug mode, but published assembly works correctly.
Solution:
var location = AppDomain.CurrentDomain.BaseDirectory;
instead
var location = Assembly.GetExecutingAssembly().Location;
Hi, can we have the update that Cular is proposing?
LE: As a workaround you can put <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> in the project.
Hey Cular and CSharpBender,
sry for the late answer. I dindt get the email from github with the issue. I will have a look on the problem and make a new release. Thank you for the feedback. :)
Cheers, Sean
Hey Guys,
I changed the code to use
var location = AppDomain.CurrentDomain.BaseDirectory;
everything works as expected.
If you have any further feedback let me know. Otherwise I will close the issue next week.
Please dont forget to star the project if you like the library.
Cheers,
Sean Roddis