Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Hosted PS core in ASP.Net core The system cannot find the file specified #5084

Copy link
Copy link
@Qowy

Description

@Qowy
Issue body actions

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

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

Issue-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-FixedThe issue is fixed.The issue is fixed.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.