PowerShell Version on Package Manager Console - visual-studio

Hello guys I am new at this so please bear with me, I have just installed Visual Studio 2015 on my windows 10 pro machine.
Am having problems with the version of PowerShell. It wants me to use version 3.0 or above but I cant seem to upgrade the Package Manager Console to the latest version.
I do have PowerShell Version 5 installed but somehow the Package Manager Console is refusing to use it. I have done a full uninstall and re-install be hasn’t sort the problem. Can you help please
I Am currently working on this tutorial
when i run this code
[Scaffold-DbContext " 'Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True; '" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models]
It errors, saying Powershell 3.0 or above is required:
[The Entity Framework Core Package Manager Console Tools don't support PowerShell version 2.0. Upgrade to PowerShell version 3.0 or higher, restart Visual Studio, and try again.]
I run $PSVersionTable it returns
Name Value
---- -----
PSVersion ----------------------------2.0
PSCompatibleVersions -----------{1.0, 2.0}
BuildVersion -------------------------6.1.7600.16385
CLRVersion ------------------------- 4.0.30319.42000
WSManStackVersion --------------2.0
PSRemotingProtocolVersion-----2.1
SerializationVersion----------------1.1.0.1
Thanks

Since you upgraded powershell just reboot your windows machine so that registry updates may be applied, then check if it does not work or you did already then i suspect it requires a older version of powershell that is known to work ok with that version of visual studio, so then you could use a newer version of VS say 2017.

Related

Could not install microsoft.netcore.hostpath 2019

I am trying to install Visual Studio 2019 but unfortunately every time I get this error
could not install Microsoft.NetCore.HostPath
Here is an image of the same:
Solution worked for me (nothing else helped)
Install PowerShell v7 (https://aka.ms/pscore6)
Backup original PowerShell v1 from C:\Windows\SysWOW64\WindowsPowerShell\v1.0
Copy "C:\Program Files\PowerShell\7" to C:\Windows\SysWOW64\WindowsPowerShell\v1.0
Rename pwsh.exe to powershell.exe
Now VS installer is using PowerShell v7 thinking it is v1, works fine!
So, I believe it is kid of bug in old version of PowerShell
Probably there is better way to mimic version, I just did old school brutal magic after loosing a day for that
If you have .Net 5 on your system and updating to 16.11.8 then you may face this issue. Till now only work around is to downgrade to 16.11.7.
And you may have in uninstall and then reinstall VS 2019. You can get 16.11.7 or other older version of VS from following URL:
https://learn.microsoft.com/en-us/visualstudio/releases/2019/history
Similar issue has been reported here too: Revert Visual Studio 2019 Update
Activate the PowerShell privilege's, run gpupdate then restart the machine. then reinstall the setup again.
Set powershell execution policy to unrestricted. Open privileged powershell console and type
Set-ExecutionPolicy Unrestricted
re-execute setup.
Getting Windows PowerShell access worked for me.
I was not able to install VS2019 and VS2022.

Visual Studio not recognizing installed Core SDKs

I have three versions of .NET Core installed on my machine:
However, both VS2017 and VS 2019 return the following error when I execute dotnet --version command:
PM> dotnet --version
dotnet : Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
I can create a solution targeting .NET Core but when I create a Console App targeting .NET Core, for example, the Debug button is labeled Attach instead of Start as usual, and Start Debugging and Start Without Debugging commands in the Debug menu are disabled.
What I tried so far:
Added "C:\ProgramFiles\dotnet" to system PATH variable.
Modified VS2019 using VS Installer.
Restarted several times.
I did have several other version of .NET Core but uninstalled them since I had no solutions targeting these versions and wanted to clean up.
I only left 2.2.300 and 3.0.100 and when I used VS Installer to modify VS2019 it added SDK 2.1.700.
Any ideas on how to resolve this issue without completely removing Visual Studio and installing from scratch?
Apparently x86 version(s) of .NET Core SDKs must be installed as well. After installing 3.0.100 x86 dotnet --version command works fine and I can build and debug .NET Core projects...

Unable to create visual studio 2015 project for mvc 6 in windows10

When I want to create a project in visual studio I get:
DNX SDK version 'dnx-clr-win-x86.1.0.0-beta5' failed to install. The
solution will use DNX SDK version ‘dnx-clr-win-x86.1.0.0-beta5
According to this article and tgis support page I need to install powershell 3 or 4, but I do have powershell 5 in windows 10.
when I do $PSVersionTable I get:
Name Value
---- -----
PSVersion 5.0.10240.16384
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.42000
BuildVersion 10.0.10240.16384
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
When I try to install both powershell 3 and 4 and I'm getting another error:
The certificate for the signer of the message is invalid or not found
In both cases and I already have installed Windows identity foundation 3.5 in my machine, but it doesn't fix the issue, so I'm stuck on this any hint will be appreciated.
The article says: Install Windows Powershell 3.0 (or higher)
Look at PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0 It means that you already have Powershell 3.0.

Visual Studio 2012 Beta - Error when deploying the app

I have installed Windows 8 OS RP version and visual Studio 2012 beta version. But i'm getting the following error when deploying the package.
Error:
Windows cannot install package xxxxx, because this package requires a
higher Windows version. The package requested Windows version 6.2 with
AppModel version 1, while the current Windows version is 6.2 with
AppModel version 0. (0x80073cfd).
How can I resolve this issue?
Any help would be appreciated.
Thanks in advance
Did you try creating new project and the carrying old files to the new project?

Why is Powershell 2.0 installed in the same location as Powershell 1.0?

Does anyone know why Powershell 2.0 is installed in C:\Windows\System32\WindowsPowerShell\v1.0 on a Windows 7 box?
It's actually an interesting story in side-effects.
Visual Studio has a fixed list of assemblies in their "Add Reference" dialog.
Anything else has to be browsed for.
Developers tended to browse for this location in the Windows directory, where System.Management.Automation.dll (the assembly that runs most of PowerShell lives)
This made an absolute reference to this location.
Since there wasn't going to be a side-by-side install option with PowerShell (as there is with the .NET framework), the best choice available was to allow people to keep referencing the same assembly, both by path and by StrongName, as they did before.
If this story hadn't have stayed this way, all applications written on top of PowerShell V1 would have to be re-released for V2.
I just think that, at the very begining, Microsoft team plan to deploy PowerShell versions side by side, just as it's done for the Framework .NET versions. But with the time they decided to support only one PowerShell at the time.
There something even more strange when you use the -version parameter of the command line to choose version 1.0 the var $PSVersionTable is present with PSVersion valued to 2.0. $PSVersionTable is not present in PowerShell 1.0
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>powershell -version 1.0
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. Tous droits réservés.
PS C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC> cd \
PS C:\> $PSVersionTable
Name Value
---- -----
CLRVersion 2.0.50727.4952
BuildVersion 6.1.7600.16385
PSVersion 2.0
WSManStackVersion 2.0
PSCompatibleVersions {1.0, 2.0}
SerializationVersion 1.1.0.1
PSRemotingProtocolVersion 2.1
If you have a look on var $host which exists on both versions
PowerShell V2.0 (vith version 1.0 or 2.0)
PS > $host
Name : ConsoleHost
Version : 2.0
InstanceId : b6ae2582-c1f4-422a-b057-16458b387f7d
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : fr-FR
CurrentUICulture : fr-FR
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
PowerShell V1.0
PS > $Host
Name : ConsoleHost
Version : 1.0.0.0
InstanceId : b55940f2-b3b2-4f99-b895-98aac4752369
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : fr-FR
CurrentUICulture : fr-FR
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
My opinion is that PowerShell V2.0 is able to run almost all PowerShell V1.0 scripts. Microsoft add some vars and you can get troubles if you have these vars present in you scripts but it's peanuts.
JP
I think because PowerShell 2.0 is extremely compatible with 1.0, there was no need to have two different versions on the same machine. So they put 2.0 over top of 1.0 on XP and Vista systems and most likely decided to keep the same directory for Windows 7. This is also the same reason the extension is still .ps1 (and .psm1, .psd1).
You could ask the same for Windows 7 x64. Why are the 64-bit system dlls in a dir called System32 and why do those same 64-bit dlls' names end with "32" e.g. user32.dll, kernel32.dll, etc. :-)

Resources