简体   繁体   English

如何在 azure 上部署 api c# 并且发布时没有实体框架迁移?

[英]How to deploy api c# on azure and there is no entity framework migration in publish?

I am trying to publish the api c# on a host service.我正在尝试在主机服务上发布 api c#。 I tried using Microsoft azure.我尝试使用 Microsoft azure。 The api is published but I can get or post the data. api 已发布,但我可以获取或发布数据。 I figured out that I couldn't find the entity framework migration option in the publish, so I thought this might be the problem.我发现我在发布中找不到实体框架迁移选项,所以我认为这可能是问题所在。 I need to know how to find this option.我需要知道如何找到这个选项。

Please check if my workaround helps to fix the issue: when building the Web Application and connecting to the Azure SQL database server, there is a need of connecting SQL Server Entity framework in my project. Please check if my workaround helps to fix the issue: when building the Web Application and connecting to the Azure SQL database server, there is a need of connecting SQL Server Entity framework in my project.

I have run similar command like我已经运行了类似的命令

dotnet tool install --global dotnet-ef

which was not working and throwing the error like that tool package cannot be restored and dotnet-ef failed to install, many other errors.这不起作用并引发错误,例如该tool package cannot be restored并且dotnet-ef安装失败,还有许多其他错误。

When I run the same command again but with explicitly versioning, then it is worked:当我再次运行相同的命令但使用显式版本控制时,它可以工作:

dotnet tool install --global dotnet-ef --version 5.0.1

Similarly, based on your requirement of the entity framework version and the dotnet version in the project, run that command using versioning which helps to fix the issue.同样,根据您对项目中实体框架版本和 dotnet 版本的要求,使用有助于解决问题的版本控制运行该命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM