Search code examples
visual-studiopackage-managers

Package Manager Console - init.ps1 is not recognized as the name of a cmdlet


Problem: All of a sudden, my Package Manager Console in Visual Studio 2019 Version 16.4.1 threw these errors at me whenever I opened it up. I attached the errors in the image below.

I use Visual Studio Enterprise 2019 (version 16.4.1)

Init.ps1 is not recognized

I have tried all the available solutions provided on this site and none of them are working.

  • I verified that the init.ps1 exist in the c:\users\.nuget\packages\microsoft.entityframework
  • I uninstalled all the nuget packages and reinstalled them (did not
    work)
  • I deleted all the folder in c:\users\.nuget\packages* and reinstalled the packages (did not work)
  • I manually modified the .csproj files (did not work)
  • I tried to run the init.ps1 via window PowerShell (did not work)

I am going to uninstall Visual Studio 2019 and reinstall it. I hope it will fix the problem.


Solution

  • The issue is resolved. This problem was due to the new PowerShell policy in my company. My language mode was set to "ConstrainLanguage" whereas it should "FullLanguage". Once the security team reset it for me, the Package Manager Console recognized the EF Core commands again.