SDK/README.txt

Create C# Project in Visual Studio 2015
 
The Microsoft.PowerShell.NanoServer.SDK module includes the CoreCLR and PowerShell Core references assemblies in a subfolder under the module's root folder at <module root>\SDK\vX.X. It also includes two Targets files in a subfolder under the module's root folder at <module root>\SDK.
 
Prerequisites: Please make sure the following Visual Studio prerequisites are installed prior to using the cmdlets:
    - Visual Studio 2015 Update 2 [or higher]
    - Windows and Web Development -> Universal Windows App Development Tools -> Tools (1.3.1 [or higher]) and Windows 10 SDK
    - If you don't have Visual Studio 2015 installed, you can install Visual Studio Community 2015 from
           https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx
 
Follow these steps to create a C# project in Visual Studio 2015 that targets the PowerShell Core reference assemblies on Nano Server.
 
1. Copy the SDK version folder (for example, SDK\v0.1) to "%SystemDrive%\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore".
2. In Visual Studio 2015, create a new project: File -> New -> Project -> Templates/Visual C#/Windows/ -> Class Library
3. Copy the two Targets files "Microsoft.Coresys.Common.Targets" and "Microsoft.CoreSys.CSharp.Targets" into your project folder alongside the .csproj file.
4. Unload the project, and open the .csproj file of the project to edit.
   - To unload or reload the project, right click the project item in the Solution Explorer window, and then select 'Unload Project' or 'Reload Project'.
   - To open the .csproj file after unloading the project, right click the project item in the Solution Explorer window, and then select 'Edit <ProjectName>.csproj'.
5. Edit the value of the TargetFrameworkVersion element to match the SDK version.
�� <Project>
���� <PropertyGroup>
������ <TargetFrameworkVersion>v0.1</TargetFrameworkVersion>
6. Change the value of the Import element at the bottom of the .csproj file to remove the MSBuildToolsPath and point to "Microsoft.CoreSys.CSharp.Targets". After the change, it should look like the following:
     "<Import Project="Microsoft.CoreSys.CSharp.targets" />"
7. Remove the "ItemGroup" section that only contains "Reference" elements:
   <ItemGroup>
     <Reference Include="System"/>
     ...
   </ItemGroup>
8. Save and close the .csproj file.
9. Reload the project.
 
Your project should now be targeting the CoreCLR and PowerShell Core reference assemblies for Windows Server 2016 Nano Server. Expand 'Reference' and you will see ".NET for Server". If you check its properties, you will see the "Path" property points to "%SystemDrive%\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v0.1\".