Converted samples and test projects to run on netcoreapp2.0

This commit is contained in:
Kiran Challa 2017-03-23 00:04:04 -07:00 committed by Kiran Challa
parent 55507de7dd
commit bb7b58321c
18 changed files with 45 additions and 26 deletions

View File

@ -5,6 +5,7 @@
<MoqVersion>4.7.1</MoqVersion> <MoqVersion>4.7.1</MoqVersion>
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion> <NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
<RedisVersion>1.1.605</RedisVersion> <RedisVersion>1.1.605</RedisVersion>
<RuntimeFrameworkVersion>2.0.0-*</RuntimeFrameworkVersion>
<TestSdkVersion>15.0.0</TestSdkVersion> <TestSdkVersion>15.0.0</TestSdkVersion>
<XunitVersion>2.2.0</XunitVersion> <XunitVersion>2.2.0</XunitVersion>
<WindowsAzureStorageVersion>7.2.1</WindowsAzureStorageVersion> <WindowsAzureStorageVersion>7.2.1</WindowsAzureStorageVersion>

View File

@ -3,7 +3,7 @@
<Import Project="..\..\build\dependencies.props" /> <Import Project="..\..\build\dependencies.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework> <TargetFramework>netcoreapp2.0</TargetFramework>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81</PackageTargetFallback> <PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81</PackageTargetFallback>
</PropertyGroup> </PropertyGroup>

View File

@ -3,7 +3,7 @@
<Import Project="..\..\build\dependencies.props" /> <Import Project="..\..\build\dependencies.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net451;netcoreapp1.1</TargetFrameworks> <TargetFrameworks>net451;netcoreapp2.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,7 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\build\dependencies.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net451;netcoreapp1.1</TargetFrameworks> <TargetFrameworks>net451;netcoreapp2.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,7 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\build\dependencies.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net451;netcoreapp1.1</TargetFrameworks> <TargetFrameworks>net451;netcoreapp2.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -3,7 +3,7 @@
<Import Project="..\..\build\dependencies.props" /> <Import Project="..\..\build\dependencies.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net451</TargetFrameworks> <TargetFrameworks>netcoreapp2.0;net451</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -3,10 +3,10 @@
<Import Project="..\..\build\common.props" /> <Import Project="..\..\build\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net452</TargetFrameworks> <TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp1.1</TargetFrameworks> <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">$(PackageTargetFallback);dnxcore50;portable-net451+win8</PackageTargetFallback> <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(PackageTargetFallback);dnxcore50;portable-net451+win8</PackageTargetFallback>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -3,8 +3,8 @@
<Import Project="..\..\build\common.props" /> <Import Project="..\..\build\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net452</TargetFrameworks> <TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp1.1</TargetFrameworks> <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>

View File

@ -3,8 +3,8 @@
<Import Project="..\..\build\common.props" /> <Import Project="..\..\build\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net452</TargetFrameworks> <TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp1.1</TargetFrameworks> <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -3,10 +3,10 @@
<Import Project="..\..\build\common.props" /> <Import Project="..\..\build\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net452</TargetFrameworks> <TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp1.1</TargetFrameworks> <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">$(PackageTargetFallback);dnxcore50;portable-net451+win8</PackageTargetFallback> <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(PackageTargetFallback);dnxcore50;portable-net451+win8</PackageTargetFallback>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -106,7 +106,7 @@ namespace Microsoft.AspNetCore.DataProtection
}); });
} }
#if !NETCOREAPP1_1 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml #if NET452 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml
[ConditionalFact] [ConditionalFact]
[ConditionalRunTestOnlyIfLocalAppDataAvailable] [ConditionalRunTestOnlyIfLocalAppDataAvailable]
[ConditionalRunTestOnlyOnWindows] [ConditionalRunTestOnlyOnWindows]
@ -149,6 +149,9 @@ namespace Microsoft.AspNetCore.DataProtection
} }
}); });
} }
#elif NETCOREAPP2_0
#else
#error Target framework needs to be updated
#endif #endif
/// <summary> /// <summary>

View File

@ -3,8 +3,8 @@
<Import Project="..\..\build\common.props" /> <Import Project="..\..\build\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net452</TargetFrameworks> <TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp1.1</TargetFrameworks> <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -3,8 +3,8 @@
<Import Project="..\..\build\common.props" /> <Import Project="..\..\build\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net452</TargetFrameworks> <TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp1.1</TargetFrameworks> <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -86,4 +86,7 @@ namespace Microsoft.AspNetCore.DataProtection
} }
} }
} }
#elif NETCOREAPP2_0
#else
#error Target framework needs to be updated
#endif #endif

View File

@ -3,8 +3,8 @@
<Import Project="..\..\build\common.props" /> <Import Project="..\..\build\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net452</TargetFrameworks> <TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp1.1</TargetFrameworks> <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>

View File

@ -159,10 +159,12 @@ namespace Microsoft.AspNetCore.DataProtection.Repositories
private static string GetLocalApplicationData() private static string GetLocalApplicationData()
{ {
#if NETCOREAPP1_1 #if NETCOREAPP2_0
return Environment.GetEnvironmentVariable("LOCALAPPDATA"); return Environment.GetEnvironmentVariable("LOCALAPPDATA");
#else #elif NET452
return Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); return Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
#else
#error Target framework needs to be updated
#endif #endif
} }

View File

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#if !NETCOREAPP1_1 #if NET452
using System; using System;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Security.Cryptography.Xml; using System.Security.Cryptography.Xml;
@ -61,5 +61,8 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption
} }
} }
} }
#elif NETCOREAPP2_0
#else
#error Target framework needs to be updated
#endif #endif

View File

@ -34,7 +34,7 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption
XmlAssert.Equal(originalXml, roundTrippedElement); XmlAssert.Equal(originalXml, roundTrippedElement);
} }
#if !NETCOREAPP1_1 #if NET452
[ConditionalFact] [ConditionalFact]
[ConditionalRunTestOnlyOnWindows] [ConditionalRunTestOnlyOnWindows]
public void Encrypt_CurrentUser_Decrypt_ImpersonatedAsAnonymous_Fails() public void Encrypt_CurrentUser_Decrypt_ImpersonatedAsAnonymous_Fails()
@ -53,6 +53,9 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption
ExceptionAssert2.ThrowsCryptographicException(() => ExceptionAssert2.ThrowsCryptographicException(() =>
AnonymousImpersonation.Run(() => decryptor.Decrypt(encryptedXmlInfo.EncryptedElement))); AnonymousImpersonation.Run(() => decryptor.Decrypt(encryptedXmlInfo.EncryptedElement)));
} }
#elif NETCOREAPP2_0
#else
#error Target framework needs to be updated
#endif #endif
} }
} }