Repository: microsoft/terminal (language: cpp)

Issue:
Importing the `OpenConsole.psm1` module should display an error message when used on Windows PowerShell 5
### Windows Terminal version

1.20.11381.0

### Windows build number

10.0.22631.0

### Other Software

_No response_

### Steps to reproduce

Under **Developer Guidance**, I made sure that I had the prerequisites:
- Running Windows 11 Home, 10.0.22631 N/A Build 22631
- Developer Mode has been enabled
- Powershell build: 22621, revision: 3672
- Windows 11 (10.0.22621.0) SDK is installed
- Installed Build Tools for Visual (VS without the IDE)
- Skipped .NET framework targeting pack

I updated the repository with `git submodule update --init --recursive`

In Powershell, `Import-Module .\tools\OpenConsole.psm1` works since I updated the Execution policy for my LocalMachine to run scripts. However, `Set-MsBuildDevEnvironment` and `Invoke-OpenConsoleBuild` don't work and return a `CommandNotFoundException`.

### Expected Behavior

The following commands from [Building the Code](https://github.com/microsoft/terminal/tree/2fa7445b003068cf433a388015cc1f1b01a0a6cd?tab=readme-ov-file#building-the-code) should build the application
```
Import-Module .\tools\OpenConsole.psm1
Set-MsBuildDevEnvironment
Invoke-OpenConsoleBuild
```

### Actual Behavior

Instead both return:
```
Set-MsBuildDevEnvironment : The term 'Set-MsBuildDevEnvironment' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Set-MsBuildDevEnvironment
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Set-MsBuildDevEnvironment:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
```

```
Invoke-OpenConsoleBuild : The term 'Invoke-OpenConsoleBuild' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Invoke-OpenConsoleBuild
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Invoke-OpenConsoleBuild:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
```


Discussion / hints:
Which version of PowerShell are you using? "Windows PowerShell" (`powershell.exe`), version 5? Or PowerShell "Core" (`pwsh.exe`), version 7+/? (you can find this with `$PSVersionTable.PSVersion`)
@zadjii-msft, I am using Windows PowerShell version 5:
```
Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      22621  3672
```
Well yep that explains it. You need to use PowerShell 7+. 

I'll convert this issue to "the powershell module should display an error if you try to import it in Powershell 5"
I've installed PowerShell 7+. So I reattempted these commands:
```
Import-Module .\tools\OpenConsole.psm1
Set-MsBuildDevEnvironment
Invoke-OpenConsoleBuild
```

When I use `Import-Module .\tools\OpenConsole.psm1`, it works fine. However, `Set-MsBuildDevEnvironment` returns
```
Import-Module: The specified module '\Common7\Tools\Microsoft.VisualStudio.DevShell.dll' was not loaded because no valid module file was found in any module directory.
```
. I've included to my environment variables `C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools` and `C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\` for MSBuild. But, still, I don't know why the above error is happening.

`Invoke-OpenConsoleBuild` returns
```
Error parsing solution file at C:\Users\<user>\Desktop\v1-logic\options-tactical\eng-cmp--dev_sec_ops\.desktop-instance\4-projects-workflow\dev_sec_ops__native\_terminal\OpenConsole.sln: Exception has been thrown by the target of an invocation.
The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
msbuild.exe: The term 'msbuild.exe' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
```

Fix patch:
diff --git a/tools/OpenConsole.psm1 b/tools/OpenConsole.psm1
index ba87033007b..07ab54f3b86 100644
--- a/tools/OpenConsole.psm1
+++ b/tools/OpenConsole.psm1
@@ -1,3 +1,4 @@
+#Requires -Version 7
 
 # The project's root directory.
 $script:OpenConsoleFallbackRoot="$PSScriptRoot\.."


Test patch: