Skip to content

Instantly share code, notes, and snippets.

@ctaggart
Created November 11, 2016 16:11
Show Gist options
  • Save ctaggart/1a26510e92ea215528829a76c9a9becd to your computer and use it in GitHub Desktop.
Save ctaggart/1a26510e92ea215528829a76c9a9becd to your computer and use it in GitHub Desktop.
dotnet cli test 2016-11-10

I downloaded the latest dotnet cli and renamed the directory that I extracted it to.

https://github.com/dotnet/cli https://dotnetcli.blob.core.windows.net/dotnet/Sdk/rel-1.0.0/dotnet-dev-win-x64.latest.zip

PS C:\Users\c\tmp\aaa> cmd /c where dotnet
C:\dotnet\dotnet-dev-win-x64.1.0.0-preview4-004071\dotnet.exe

I created a directory and did a dotnet new in that directory.

PS C:\Users\c\tmp\aaa> dotnet new
Created new C# project in C:\Users\c\tmp\aaa.

I like that the project is named after the folder that you are in.

PS C:\Users\c\tmp\aaa> ls


    Directory: C:\Users\c\tmp\aaa


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        11/8/2016   6:06 PM            833 aaa.csproj
-a----        11/4/2016   8:20 PM            133 Program.cs

In troubleshooting a Docker for Windows issue, I wanted to run some C# WMI code I found. I got it compiling with the attached wmi.csproj. I noticed that a Microsoft.NetCore.App references the NETStandard.Library. I don't understand what Microsoft.NET.Sdk is for yet. What is Microsoft.NET.Sdk for? Is <reference> the right way to add the additional net46 libraries that are not a part of the NETStandard?

https://www.nuget.org/packages/Microsoft.NETCore.App/ https://www.nuget.org/packages/NETStandard.Library/

<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" />
<EmbeddedResource Include="**\*.resx" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.NET.Sdk">
<Version>1.0.0-alpha-20161104-2</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
using System;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net461</TargetFramework>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" />
<EmbeddedResource Include="**\*.resx" />
</ItemGroup>
<ItemGroup>
<!--<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.1</Version>
</PackageReference>-->
<PackageReference Include="NETStandard.Library">
<Version>1.6.0</Version>
</PackageReference>
<!--<PackageReference Include="Microsoft.NET.Sdk">
<Version>1.0.0-alpha-20161104-2</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>-->
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Management" />
<!--<Reference Include="System.ComponentModel" />-->
<!--<PackageReference Include="System.Management">
<Version>4.0.0</Version>
</PackageReference>
<PackageReference Include="System.ComponentModel">
<Version>4.0.1</Version>
</PackageReference>-->
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment