Skip to content

Conversation

@daxian-dbw
Copy link
Member

@daxian-dbw daxian-dbw commented Jan 9, 2020

PR Summary

Fix #9734

Update the packaging script to generate the right reference assembly for Microsoft.PowerShell.ConsoleHost.dll and use that for the NuGet packages Microsoft.PowerShell.ConsoleHost and Microsoft.PowerShell.SDK.

With this fix, the following C# program will build and run as long as it references the Microsoft.PowerShell.SDK package.

using System;
using System.Management.Automation.Runspaces;
using Microsoft.PowerShell;

namespace testConsoleRef
{
    class Program
    {
        static void Main(string[] args)
        {
            InitialSessionState config = InitialSessionState.CreateDefault();
            config.StartupScripts.Add(@"New-TemporaryFile");

            int ret = ConsoleShell.Start(config, "Hello", "", new string[] { "-noprofile", "-c", "exit 23" });
            Console.WriteLine(ret);
        }
    }
}

PR Context

Before this fix, the reference assembly for Microsoft.PowerShell.ConsoleHost.dll is not included in Microsoft.PowerShell.SDK package, so you cannot use ConsoleShell in the above program.

PR Checklist

@daxian-dbw daxian-dbw added this to the GA-consider milestone Jan 9, 2020
@daxian-dbw daxian-dbw added the CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log label Jan 9, 2020
@adityapatwardhan adityapatwardhan merged commit be813a2 into PowerShell:master Jan 13, 2020
@daxian-dbw daxian-dbw deleted the refs branch January 14, 2020 20:23
daxian-dbw added a commit that referenced this pull request Jan 14, 2020
@daxian-dbw daxian-dbw modified the milestones: GA-approved, 7.0.0-rc.2 Jan 14, 2020
@ghost
Copy link

ghost commented Jan 16, 2020

🎉v7.0.0-rc.2 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request - Bring back ConsoleShell functionallity

3 participants