from internal bug: 368394 & 372378 & 378413
REPRO STEPS
聽聽聽 public class Movie
聽聽聽 {
聽聽聽聽聽聽聽 public int ID { get; set; }
聽聽聽聽聽聽聽 public string Title { get; set; }
聽聽聽聽聽聽聽 public DateTime ReleaseDate { get; set; }
聽聽聽聽聽聽聽 public string Genre { get; set; }
聽聽聽聽聽聽聽 public decimal Price { get; set; }
聽聽聽 }
@jainaashish has additional context here.
I think it's is due to ExecutionPolicy, Nuget can't execute the init.ps in entityframeworkcore.tool, if user log in VS as admin, nuget will set executionPolicy and run init.ps well
@zhili1208 - have you investigated default windows installations vs different VM environments to help find the cause of this?
the default windows powershell execution policy is restricted both on vm and real machine, but nuget will set executionPolicy to RemoteSigned, I tested xlab and azure vm, found out I can't repro it every time, looks like nuget can set executionPolicy correctly, but I hit this randomly, will look at it more
added new dupe bug number in first entry in this issue. 372378 - please read and confirm dupe. use that extra info (and/or the bug filer) to help reproduce the problem.
added new dupe in first entry: 378413
Feb 2018, VS2017 v15.5.6, and this problem is still alive and kicking.
However, what eventually fixed it for me was to go into VS2017, click on ToolsNuGet Package ManagerPackage Manager Settings, then, in the General tab, click on "Clear all NuGet Cache(s)". Then I quit VS2017, restarted VS2017, right-clicked on my Solution, and "Restore NuGet Packages".
After jumping through all of these hoops, the Add-Migration command was finally recognised.
(Sigh.)
all of this ^^^
Exact same error message.
Walked through MikeInSwitzerland's fix, but on the "Restore NuGet Packages" part, getting error message, "Error occurred while restoring Nuget packages: Access to path 'CUsers ... microsoft.codeanalysis.workspaces.common2.6.1' is denied."
hi all for this you have to go to tools-> nugetpackagemanager -> manage nuGut Package for solution
and install
Microsoft.AspNetCore.App
Microsoft.EntityFrameworkCore.Tools"
Microsoft.VisualStudio.Web.CodeGeneration.Design
then close vs and open it again .
reference
https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/powershell
hi all for this you have to go to tools-> nugetpackagemanager -> manage nuGut Package for solution
and install
Microsoft.AspNetCore.App
Microsoft.EntityFrameworkCore.Tools"
Microsoft.VisualStudio.Web.CodeGeneration.Design
then close vs and open it again .
reference
https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/powershell
already with have it but still same issue there.
Please help me i got error when runing console Update-Database
Error Number:5123,State:1,Class:16
CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file 'C:\Users\l-maninventory-management-codecanyon.mdf'.
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
Most helpful comment
hi all for this you have to go to tools-> nugetpackagemanager -> manage nuGut Package for solution
and install
Microsoft.AspNetCore.App
Microsoft.EntityFrameworkCore.Tools"
Microsoft.VisualStudio.Web.CodeGeneration.Design
then close vs and open it again .
reference
https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/powershell