Hi 
I found the solution :-)

I changed the get assembly name of the xml file to:

var xmlFile = $"{Assembly.GetAssembly(typeof(Startup)).GetName().Name}.xml";

in stead of 

var xmlFile = $"{Assembly.GetEntryAssembly().GetName().Name}.xml";



Op maandag 7 mei 2018 16:00:37 UTC+2 schreef Anders Kjaer Pedersen:
>
> Hi,
>
> I have implemented the Swagger UI in an Asp.Net core 2.0 API application. 
> It works as expected.
>
> But now I try to add migration - entity framework and I get this errors  
>
> "An error occurred while calling method 'BuildWebHost' on class 'Program'. 
> Continuing without the application service provider. Error: Could not find 
> file 
> 'C:\Users\anders\Source\Repos\Mobility\MobilityWebApi\Mobility.WebApi\bin\Debug\netcoreapp2.0\ef.xml'."
>  
> and "Unable to create an object of type 'MobilityDbContext'. Add an 
> implementation of 'IDesignTimeDbContextFactory<MobilityDbContext>' to the 
> project, or see https://go.microsoft.com/fwlink/?linkid=851728 for 
> additional patterns supported at design time."
>
> If comment out this row in the Configure methode:
> app.UseSwagger();
>
> I get the normal behavior from add-migration
>
> Any suggestion?
>
> Anders Pedersen
>

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to