Merge pull request #7941 from wli3/add-CsWinRT-to-known-framework-list

Add cs win rt to known framework list
This commit is contained in:
William Li 2020-07-08 10:30:03 -07:00 committed by GitHub
commit ceb129f345
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 110 additions and 8 deletions

View file

@ -1,6 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), testAsset.props))\testAsset.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>$(CliTargetFramework)</TargetFramework>

View file

@ -1,6 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), testAsset.props))\testAsset.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<OutputType>Exe</OutputType>

View file

@ -1,6 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), testAsset.props))\testAsset.props" />
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>

View file

@ -1,6 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), testAsset.props))\testAsset.props" />
<PropertyGroup>
<TargetFramework>$(CliTargetFramework)</TargetFramework>
</PropertyGroup>

View file

@ -0,0 +1,14 @@
using System;
using Windows.Data.Json;
namespace consolecswinrt
{
class Program
{
static void Main(string[] args)
{
var rootObject = JsonObject.Parse("{\"greet\": \"Hello\"}");
Console.WriteLine(rootObject["greet"]);
}
}
}

View file

@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetPlatformIdentifier>Windows</TargetPlatformIdentifier>
</PropertyGroup>
</Project>

View file

@ -122,6 +122,11 @@
<DotnetDebToolVersion>2.0.0</DotnetDebToolVersion>
<MicrosoftNETTestSdkVersion>15.8.0</MicrosoftNETTestSdkVersion>
</PropertyGroup>
<PropertyGroup>
<MicrosoftWindowsSDKNETRef10_0_17763PackageVersion>10.0.17763.1-preview</MicrosoftWindowsSDKNETRef10_0_17763PackageVersion>
<MicrosoftWindowsSDKNETRef10_0_18362PackageVersion>10.0.18362.2-preview</MicrosoftWindowsSDKNETRef10_0_18362PackageVersion>
<MicrosoftWindowsSDKNETRef10_0_19041PackageVersion>10.0.19041.1-preview</MicrosoftWindowsSDKNETRef10_0_19041PackageVersion>
</PropertyGroup>
<PropertyGroup>
<!-- pinned dependency. This package is not being produced outside of the 2.0 branch of corefx and should not change. -->
<CLI_NETStandardLibraryNETFrameworkVersion>2.0.1-servicing-26011-01</CLI_NETStandardLibraryNETFrameworkVersion>

View file

@ -280,6 +280,45 @@ Copyright (c) .NET Foundation. All rights reserved.
RuntimePackRuntimeIdentifiers="@(AspNetCoreRuntimePackRids, '%3B')"
/>
<KnownFrameworkReference Include="Microsoft.Windows.SDK.NET.Ref"
TargetFramework="net5.0-windows10.0.17763"
RuntimeFrameworkName="Microsoft.Windows.SDK.NET.Ref"
DefaultRuntimeFrameworkVersion="$(MicrosoftWindowsSDKNETRef10_0_17763PackageVersion)"
LatestRuntimeFrameworkVersion="$(MicrosoftWindowsSDKNETRef10_0_17763PackageVersion)"
TargetingPackName="Microsoft.Windows.SDK.NET.Ref"
TargetingPackVersion="$(MicrosoftWindowsSDKNETRef10_0_17763PackageVersion)"
RuntimePackAlwaysCopyLocal="true"
RuntimePackNamePatterns="Microsoft.Windows.SDK.NET.Ref"
RuntimePackRuntimeIdentifiers="any"
IsWindowsOnly="true"
/>
<KnownFrameworkReference Include="Microsoft.Windows.SDK.NET.Ref"
TargetFramework="net5.0-windows10.0.18362"
RuntimeFrameworkName="Microsoft.Windows.SDK.NET.Ref"
DefaultRuntimeFrameworkVersion="$(MicrosoftWindowsSDKNETRef10_0_18362PackageVersion)"
LatestRuntimeFrameworkVersion="$(MicrosoftWindowsSDKNETRef10_0_18362PackageVersion)"
TargetingPackName="Microsoft.Windows.SDK.NET.Ref"
TargetingPackVersion="$(MicrosoftWindowsSDKNETRef10_0_18362PackageVersion)"
RuntimePackAlwaysCopyLocal="true"
RuntimePackNamePatterns="Microsoft.Windows.SDK.NET.Ref"
RuntimePackRuntimeIdentifiers="any"
IsWindowsOnly="true"
/>
<KnownFrameworkReference Include="Microsoft.Windows.SDK.NET.Ref"
TargetFramework="net5.0-windows10.0.19041"
RuntimeFrameworkName="Microsoft.Windows.SDK.NET.Ref"
DefaultRuntimeFrameworkVersion="$(MicrosoftWindowsSDKNETRef10_0_19041PackageVersion)"
LatestRuntimeFrameworkVersion="$(MicrosoftWindowsSDKNETRef10_0_19041PackageVersion)"
TargetingPackName="Microsoft.Windows.SDK.NET.Ref"
TargetingPackVersion="$(MicrosoftWindowsSDKNETRef10_0_19041PackageVersion)"
RuntimePackAlwaysCopyLocal="true"
RuntimePackNamePatterns="Microsoft.Windows.SDK.NET.Ref"
RuntimePackRuntimeIdentifiers="any"
IsWindowsOnly="true"
/>
<!-- .NET Core 3.1 -->
<KnownFrameworkReference Include="Microsoft.NETCore.App"
TargetFramework="netcoreapp3.1"

View file

@ -0,0 +1,45 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.IO;
using System.Xml.Linq;
using FluentAssertions;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Test.Utilities;
using Xunit;
namespace EndToEnd
{
public class GivenWindows50App : TestBase
{
[WindowsOnlyTheory]
[InlineData("10.0.17763")]
[InlineData("10.0.18362")]
[InlineData("10.0.19041")]
public void ItCanBuildAndRun(string targetPlatformVersion)
{
var testInstance = TestAssets.Get(TestAssetKinds.TestProjects, "UseCswinrt")
.CreateInstance("UseCswinrt" + targetPlatformVersion)
.WithSourceFiles();
var projectPath = Path.Combine(testInstance.Root.FullName, "consolecswinrt.csproj");
var project = XDocument.Load(projectPath);
var ns = project.Root.Name.Namespace;
// Update TargetFramework to the right version of .NET Core
project.Root.Element(ns + "PropertyGroup")
.Add(new XElement(ns + "TargetPlatformVersion", targetPlatformVersion));
project.Save(projectPath);
new BuildCommand()
.WithProjectFile(new FileInfo(testInstance.Root.FullName))
.Execute()
.Should().Pass();
new RunCommand().WithWorkingDirectory(testInstance.Root.FullName)
.Execute("--no-build")
.Should().Pass().And.HaveStdOutContaining("Hello");
}
}
}