无法检索元数据项目。确保它的SDK风格项目
dbContext在newkyc.data项目中。启动项目是newkyc
启动的配置方法。CS包含以下块
services.AddDbContext<AppDbContext>(
dbContextOptions => dbContextOptions
.UseMySql(Configuration["ConnectionStrings:MySQLConnection"],
new MySqlServerVersion(new Version(mysql_version[0], mysql_version[1], mysql_version[2])), b=>b.MigrationsAssembly("NewKyc")
以添加迁移,我编写以下内容
dotnet ef migrations add EntityRelationshipsReview --startup-project "../NewKyc.csproj" --context AppDbContext --verbose
,然后收到以下消息
msbuild:错误msb1009:项目文件不存在。 switch:/users/mac/documents/projects/folder/subfolder/subsubfolder/newkyc.csproj
and shise
无法检索项目元数据。确保它是一个SDK风格的项目。如果您使用的是自定义的baseinteriateOutputpath或msbuildProjectExtensionsPath值,请使用-MSBuildProjectExtensenspath选项。
我在哪里弄错了?
它是一个.NET Core 3.1项目升级到.NET 6
I have a solution that is made up of 4 projects as shown in the screenshot
The DbContext is inside NewKyc.Data project. The startup project is NewKyc
The ConfigureServices method of the Startup.cs contains the following block
services.AddDbContext<AppDbContext>(
dbContextOptions => dbContextOptions
.UseMySql(Configuration["ConnectionStrings:MySQLConnection"],
new MySqlServerVersion(new Version(mysql_version[0], mysql_version[1], mysql_version[2])), b=>b.MigrationsAssembly("NewKyc")
To add migrations, I write the following
dotnet ef migrations add EntityRelationshipsReview --startup-project "../NewKyc.csproj" --context AppDbContext --verbose
and I get the following messages
MSBUILD : error MSB1009: Project file does not exist.
Switch: /Users/mac/Documents/Projects/folder/subfolder/subsubfolder/NewKyc.csproj
And this
Unable to retrieve project metadata. Ensure it's an SDK-style project. If you're using a custom BaseIntermediateOutputPath or MSBuildProjectExtensionsPath values, Use the --msbuildprojectextensionspath option.
Where am I getting it wrong?
It is a .NET Core 3.1 project upgraded to .NET 6
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于您已从Net Core 3.1升级到6.0,因此您的dotnet-ef Cli工具可能已过时,因此您可以在全球上进行更新,根据 docs ,使用以下命令:
dotnet工具更新-g dotnet-ef
或本地:
dotnet工具更新-Local dotnet-local dotnet -ef
Since you've upgraded from Net Core 3.1 to 6.0 it's possible your dotnet-ef CLI tool is out of date, you can update it globally, according to the docs, using the following command:
dotnet tool update -g dotnet-ef
Or locally:
dotnet tool update --local dotnet-ef
确保您包含到下面的文件夹的完整路径:
尝试。
Make sure you include the full paths to the folders as below:
Try that.