Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Can we use "dotnet ef database update" on published version?

$
0
0

I have created a web application using ASP.Net Core 3.1, entity frame work core, code-first, on VS-2019. I used the following code in my windows 10 shell (CMD)  to make it published and ready to be used on my Ubuntu 20.04 VM-ware (all are on local machine):

dotnet publish -r linux-x64 /p:EnvironmentName=Production  --framework netcoreapp3.1    -c Release -o d:\Production-linux   --self-contained false

After publishing my web-app on windows , I move my published version to my Ubuntu system, but before first run I need to make my database (it is code first using EF-Core and database needs to be created before first run of application) but the following code :

dotnet ef database update

results in : No project was found. Change the current working directory or use the --project option. I know it is looking for   .csproj file. Good to say that I ran the code inside the main folder of my published version and there is no.csproj file inside published folder!!

I know that if I copy the original (not published version) of my app to my ubuntu system and inside main project folder if I run the code  `dotnet ef database update` , my database will be created successfully and after first use of non-published version, I can use my published version and I can delete non-published version. I need to know :

Should I have to spare and have a copy of my original web application all the time for first run and for creating my data base? 

In the other hand, is there any way to create my tables/database and run my app from start , just with my published version without any need to original web application (non-published) or I have to have the main project with me all the times for first run and for creating database??


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>