tabs ↹ over ␣ ␣ ␣ spaces

by Jiří {x2} Činčura

Problem “Could not load file or assembly ’<assembly>’ or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)" when using Entity Framework’s migrate.exe

16 Apr 2012 1 mins Entity Framework

When you use migrate.exe from Entity Framework’s Migrations (in time of writing 4.3.1) you might get the error saying:

Could not load file or assembly ’’ or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

That’s nice, but nothing special, right? The reason is simple and as lot of magic execution errors it is current/working directory related. To fix it, simply explicitly specify path (relative works) to your assembly using StartUpDirectory parameter. And there’s another one gotcha. This parameter works only with :. Let me explain.

migrate.exe /StartUpDirectory C:\Foo\Bar\Baz

Doesn’t work (and no error). But this one.

migrate.exe /StartUpDirectory:C:\Foo\Bar\Baz

Does.

Hope it saves you some time hunting what’s wrong.

Profile Picture Jiří Činčura is .NET, C# and Firebird expert. He focuses on data and business layers, language constructs, parallelism, databases and performance. For almost two decades he contributes to open-source, i.e. FirebirdClient. He works as a senior software engineer for Microsoft. Frequent speaker and blogger at www.tabsoverspaces.com.