8000 Hosted PS core in ASP.Net core The system cannot find the file specified · Issue #5084 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content
Hosted PS core in ASP.Net core The system cannot find the file specified #5084
@Qowy

Description

@Qowy

ASP.NET core 2.0 app.

.csproj:

    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" PrivateAssets="All" />
    <PackageReference Include="Microsoft.PowerShell.Commands.Diagnostics" Version="6.0.0-beta.8" />
    <PackageReference Include="Microsoft.PowerShell.SDK" Version="6.0.0-beta.8" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" PrivateAssets="All" />
    <PackageReference Include="Microsoft.WSMan.Management" Version="6.0.0-beta.8" />

controller code:

    using (PowerShell ps = PowerShell.Create())
            {
                var result = ps.AddScript(@"New-Item -Path 'C:\Programming\' -Type Directory -Name TestFolder").Invoke();
            }

Results in an exeption:

System.Management.Automation.RuntimeException: The following errors occurred when updating the assembly list for the runspace:
Could not load file or assembly 'C:\Programming\Intranet\Intranet\Microsoft.PowerShell.Commands'. The system cannot find the file specified.
Could not load file or assembly 'C:\Programming\Intranet\Intranet\Microsoft.PowerShell'. The system cannot find the file specified.
Could not load file or assembly 'C:\Programming\Intranet\Intranet\Microsoft.PowerShell.Commands'. The system cannot find the file specified.
Could not load file or assembly 'C:\Programming\Intranet\Intranet\Microsoft.PowerShell.Commands'. The system cannot find the file specified.
Could not load file or assembly 'C:\Programming\Intranet\Intranet\Microsoft.PowerShell'. The system cannot find the file specified.
Could not load file or assembly 'C:\Programming\Intranet\Intranet\Microsoft.WSMan'. The system cannot find the file specified..

at System.Management.Automation.ExecutionContext.UpdateAssemblyCache()

at System.Management.Automation.Runspaces.RunspaceConfigurationEntryCollection`1.Update(Boolean force)

at System.Management.Automation.Runspaces.RunspaceConfiguration.Bind(ExecutionContext executionContext)

at System.Management.Automation.AutomationEngine..ctor(PSHost hostInterface, RunspaceConfiguration runspaceConfiguration, InitialSessionState iss)

at System.Management.Automation.Runspaces.LocalRunspace.DoOpenHelper()

at System.Management.Automation.Runspaces.LocalRunspace.OpenHelper(Boolean syncCall)

at System.Management.Automation.Runspaces.RunspaceBase.CoreOpen(Boolean syncCall)

at System.Management.Automation.Runspaces.RunspaceBase.Open()

at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)

at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection1 input, PSDataCollection1 output, PSInvocationSettings settings)

at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection1 input, PSDataCollection1 output, PSInvocationSettings settings)

at System.Management.Automation.PowerShell.CoreInvoke[TOutput](IEnumerable input, PSDataCollection`1 output, PSInvocationSettings settings)

at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)

at System.Management.Automation.PowerShell.Invoke()

at Intranet.Controllers.PowershellController.Test() in C:\Programming\Intranet\Intranet\Controllers\PowershellController.cs:line 30

Metadata

Metadata

Assignees

Labels

Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0