-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Area-Maintainers-Buildspecific to affecting the buildspecific to affecting the buildIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-ExternalThe issue is caused by external component(s).The issue is caused by external component(s).
Description
Trying to use PowerShell with WindowsForms Application (See attached sample) under .Net Core 3.0 Preview 7. Have issue open with .Net Core Team: dotnet/core#3075 (comment)
The below sample was update to include Microsoft.PowerShell.SDK and the System.Management.Automation.
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.0.0-preview7.19362.4" />
<PackageReference Include="System.Management" Version="4.6.0-preview7.19362.9" />
<PackageReference Include="System.Management.Automation" Version="7.0.0-preview.2" />
<PackageReference Include="Microsoft.PowerShell.SDK" Version="6.1.1" />
<PackageReference Include="Microsoft.PowerShell.Commands.Diagnostics" Version="6.1.1" />
<PackageReference Include="Microsoft.WSMan.Management" Version="6.1.1"/>
</ItemGroup>
VSSolutionDebugTest_2019731_080800_pid20116.log
Error does not show and internal exception though:
[2019-07-31 08:08:04Z] <Non-Published Non-SingleExe Debug Test> (E):
Failed to set PowerShell Enabled Execution Policy to Bypass
Exception Message: Cannot load PowerShell snap-in Microsoft.PowerShell.Diagnostics because of the following error: The PowerShell snap-in module D:\Workspaces\Training\WindowsFormsApp18\WindowsFormsApp18\bin\x64\Debug\netcoreapp3.0\win7-x64\Microsoft.PowerShell.Commands.Diagnostics.dll does not have the required PowerShell snap-in strong name Microsoft.PowerShell.Commands.Diagnostics, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL.
Exception StackTrace: at System.Management.Automation.Runspaces.InitialSessionState.CreateDefault()
at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(PSHost host)
at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace()
at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
at System.Management.Automation.PowerShell.Invoke()
at WindowsFormsApp18.Form1.EnableExecutionPolicy(String executionPolicy) in D:\Workspaces\Training\WindowsFormsApp18\WindowsFormsApp18\Form1.cs:line 227
at WindowsFormsApp18.Form1..ctor() in D:\Workspaces\Training\WindowsFormsApp18\WindowsFormsApp18\Form1.cs:line 98
Internal Exception:
Metadata
Metadata
Assignees
Labels
Area-Maintainers-Buildspecific to affecting the buildspecific to affecting the buildIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-ExternalThe issue is caused by external component(s).The issue is caused by external component(s).