DbContext Model menu actions cause FileNotFoundException - Microsoft.VisualStudio.ProjectSystem, Version=16.0.0.0
See original GitHub issueHello, I’m having problems using the diagram building functionality and this library overall for the first time.
Steps to reproduce
Right click the project that contains class inheriting from DbContext -> EF Core Power Tools -> Add DbContext Model Diagram. VS builds the project and then displays an error in output window.
Further technical details
EF Core Power Tools version: latest build from feed (2.2.60)
.NET version: Core 2.2
Error message in output window:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.ProjectSystem, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.VisualStudio.ProjectSystem, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at EFCorePowerTools.Extensions.ProjectExtensions.GetCspProperty(Project project, String propertyName)
at EFCorePowerTools.Handlers.ProcessLauncher.GetOutput(String outputPath, String projectPath, GenerationType generationType, String contextName, String migrationIdentifier, String nameSpace) in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Handlers\ProcessLauncher.cs:line 94
at EFCorePowerTools.Handlers.ModelAnalyzerHandler.Generate(String outputPath, Project project, GenerationType generationType) in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Handlers\ModelAnalyzerHandler.cs:line 62
Database engine: Postgres
Visual Studio version: Visual Studio 2017 15.9.11 (latest).
I’ve tried installing ProjectSystem 16.0.374-pre via NuGet in the project i’ve tried to use EFCorePowerTools with, but to no avail. Same version is used in current EFCorePowerTools code version, but the current version of the source code seems to be different from the one in the latest build from the feed (e.g. line numbers in stack trace don’t match the current code line numbers).
I am very confused at the moment, am I missing something?
Issue Analytics
- State:
- Created 4 years ago
- Comments:29 (15 by maintainers)
Top GitHub Comments
I downloaded your latest daily build an hour back and run it.
I have two class library projects, One is domain and another one is Application layer and these class library projects are added in my asp.net core website(Model-View-Controller).
In application layer, I have a class for DbContext, see below and from Application project I am clicking on Add DbContent Model diagram, getting errors.
System.NullReferenceException: Object reference not set to an instance of an object. at EFCorePowerTools.Extensions.ProjectExtensions.GetCspProperty(Project project, String propertyName) in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Extensions\ProjectExtensions.cs:line 51 at EFCorePowerTools.Handlers.ProcessLauncher.GetOutput(String outputPath, String projectPath, GenerationType generationType, String contextName, String migrationIdentifier, String nameSpace) in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Handlers\ProcessLauncher.cs:line 94 at EFCorePowerTools.Handlers.ModelAnalyzerHandler.Generate(String outputPath, Project project, GenerationType generationType) in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Handlers\ModelAnalyzerHandler.cs:line 62
using Microsoft.EntityFrameworkCore; using Sandbox.Domain; using System;
namespace Sandbox.Application { public class EmployeeDbContext:DbContext { public EmployeeDbContext() { } public DbSet<Person> Person{ get; set; } public DbSet<Employee> Employee { get; set; } } }
I have now force added the dll in the latest daily build.