Skip to content

Target .NET Standard 2.0 #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Runtime.msbuild
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@
<ItemGroup>
<_TestDLLsXunit Include="bin\$(Configuration)\test\*.Test.dll" />
<_TestDLLsXunit Include="bin\$(Configuration)\test\*.Test.*.dll" />
<_TestDLLsXunit Include="bin\$(Configuration)\Test\NetCore\*.Test.dll" />
<_TestDLLsXunit Include="bin\$(Configuration)\Test\NetStandard\*.Test.dll" />
<_TestDLLsXunit Include="bin\$(Configuration)\Test\NetCore\*.Test.dll" Condition="'$(BuildPortable)' == 'true'" />
<_XunitProject Include="tools\WebStack.xunit.targets">
<Properties>TestAssembly=%(_TestDLLsXunit.FullPath);XmlPath=$(TestResultsDirectory)%(_TestDLLsXunit.FileName)-XunitResults.xml</Properties>
</_XunitProject>
Expand All @@ -112,6 +111,12 @@
<MakeDir Directories="$(TestResultsDirectory)" />

<MSBuild Projects="@(_XunitProject)" BuildInParallel="$(TestInParallel)" Targets="Xunit" />

<!-- Failures in this project will fail build. But, results will not be included in test run summary. -->
<MSBuild
Projects="test\System.Net.Http.Formatting.NetStandard.Test\System.Net.Http.Formatting.NetStandard.Test.csproj"
Targets="Test"
Condition="'$(BuildPortable)' == 'true'" />
</Target>

<Target Name="CheckSkipStrongNames" DependsOnTargets="RestoreSkipStrongNames">
Expand Down
4 changes: 2 additions & 2 deletions RuntimePortable.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27019.1
VisualStudioVersion = 15.0.27116.1
MinimumVisualStudioVersion = 15.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A9836F9E-6DB3-4D9F-ADCA-CF42D8C8BA93}"
EndProject
Expand All @@ -15,7 +15,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Net.Http.Formatting.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Net.Http.Formatting.NetStandard", "src\System.Net.Http.Formatting.NetStandard\System.Net.Http.Formatting.NetStandard.csproj", "{636CA76A-C85C-42E2-B4AA-88046279B3CA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Net.Http.Formatting.NetStandard.Test", "test\System.Net.Http.Formatting.NetStandard.Test\System.Net.Http.Formatting.NetStandard.Test.csproj", "{DECB05DF-B33A-44A0-B5DE-B14A8CE0740F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Net.Http.Formatting.NetStandard.Test", "test\System.Net.Http.Formatting.NetStandard.Test\System.Net.Http.Formatting.NetStandard.Test.csproj", "{DECB05DF-B33A-44A0-B5DE-B14A8CE0740F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A72045D4-B048-4697-9535-C3A6EDCA85B9}"
ProjectSection(SolutionItems) = preProject
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<PropertyGroup>
<IsPackable>true</IsPackable>
<IsTestProject>false</IsTestProject>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion Condition="'$(MSBuildProjectName)' != 'System.Net.Http.Formatting.NetStandard'">v4.5</TargetFrameworkVersion>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,39 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory),Runtime.sln))\tools\WebStack.settings.targets" />
<PropertyGroup>
<TargetFramework>netstandard1.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>System.Net.Http</RootNamespace>
<AssemblyName>System.Net.Http.Formatting</AssemblyName>
<OutputPath>$(OutputPath)NetStandard\</OutputPath>
<DocumentationFile>$(OutputPath)$(AssemblyName).xml</DocumentationFile>
<NetStandardImplicitPackageVersion>1.6.0</NetStandardImplicitPackageVersion>
<RunCodeAnalysis>$(CodeAnalysis)</RunCodeAnalysis>
<CodeAnalysisRuleSet>..\Strict.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisAdditionalOptions> /assemblycomparemode:StrongNameIgnoringVersion</CodeAnalysisAdditionalOptions>
<CodeAnalysisSearchGlobalAssemblyCache>false</CodeAnalysisSearchGlobalAssemblyCache>
<DefineConstants>$(DefineConstants);NETFX_CORE;ASPNETMVC;NOT_CLS_COMPLIANT;NETSTANDARD1_1</DefineConstants>
<RunCodeAnalysis>false</RunCodeAnalysis>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FxCop of this project is now completely redundant. In addition, even the newest command-line FxCop tool has trouble with .NET Standard libraries and the even-newer Roslyn analyzers can't load this particular library.

<DefineConstants>$(DefineConstants);ASPNETMVC;NEWTONSOFTJSON10</DefineConstants>
<NoWarn>1591</NoWarn>
<TargetFrameworkVersion></TargetFrameworkVersion>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This oddity goes away with new condition in Directory.Build.props.

<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Configurations>$(Configurations);CodeAnalysis</Configurations>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
<PackageReference Include="System.ComponentModel.EventBasedAsync" Version="4.0.11" />
<PackageReference Include="System.Diagnostics.Contracts" Version="4.0.1" />
<PackageReference Include="System.Runtime.Serialization.Xml" Version="4.1.1" />
<PackageReference Include="System.Xml.XmlSerializer" Version="4.0.11" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.1" />
<PackageReference Include="Newtonsoft.Json.Bson" Version="1.0.1" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\CommonAssemblyInfo.cs">
<Link>Properties\CommonAssemblyInfo.cs</Link>
</Compile>

<Compile Include="..\Common\CollectionExtensions.cs">
<Link>Common\CollectionExtensions.cs</Link>
</Compile>
<Compile Include="..\Common\Error.cs">
<Link>Common\Error.cs</Link>
</Compile>
<Compile Include="..\Common\ListWrapperCollection.cs">
<Link>Common\ListWrapperCollection.cs</Link>
</Compile>
<Compile Include="..\Common\TaskHelpers.cs">
<Link>Common\TaskHelpers.cs</Link>
</Compile>
Expand All @@ -43,197 +40,9 @@
<Compile Include="..\Common\UriQueryUtility.cs">
<Link>Common\UriQueryUtility.cs</Link>
</Compile>
<Compile Include="..\Common\CollectionExtensions.cs">
<Link>Common\CollectionExtensions.cs</Link>
</Compile>
<Compile Include="..\Common\ListWrapperCollection.cs">
<Link>Common\ListWrapperCollection.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\FormattingUtilities.cs">
<Link>FormattingUtilities.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\BaseJsonMediaTypeFormatter.cs">
<Link>Formatting\BaseJsonMediaTypeFormatter.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\BsonMediaTypeFormatter.cs">
<Link>Formatting\BsonMediaTypeFormatter.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\DelegatingEnumerable.cs">
<Link>Formatting\DelegatingEnumerable.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\FormDataCollection.cs">
<Link>Formatting\FormDataCollection.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\FormUrlEncodedJson.cs">
<Link>Formatting\FormUrlEncodedJson.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\FormUrlEncodedMediaTypeFormatter.cs">
<Link>Formatting\FormUrlEncodedMediaTypeFormatter.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\IFormatterLogger.cs">
<Link>Formatting\IFormatterLogger.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\JsonMediaTypeFormatter.cs">
<Link>Formatting\JsonMediaTypeFormatter.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\MediaTypeConstants.cs">
<Link>Formatting\MediaTypeConstants.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\MediaTypeFormatter.cs">
<Link>Formatting\MediaTypeFormatter.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\MediaTypeFormatterCollection.cs">
<Link>Formatting\MediaTypeFormatterCollection.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\MediaTypeHeaderValueExtensions.cs">
<Link>Formatting\MediaTypeHeaderValueExtensions.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\MediaTypeHeaderValueRange.cs">
<Link>Formatting\MediaTypeHeaderValueRange.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\ParsedMediaTypeHeaderValue.cs">
<Link>Formatting\ParsedMediaTypeHeaderValue.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\Parsers\FormUrlEncodedParser.cs">
<Link>Formatting\Parsers\FormUrlEncodedParser.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\Parsers\HttpRequestHeaderParser.cs">
<Link>Formatting\Parsers\HttpRequestHeaderParser.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\Parsers\HttpRequestLineParser.cs">
<Link>Formatting\Parsers\HttpRequestLineParser.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\Parsers\HttpResponseHeaderParser.cs">
<Link>Formatting\Parsers\HttpResponseHeaderParser.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\Parsers\HttpStatusLineParser.cs">
<Link>Formatting\Parsers\HttpStatusLineParser.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\Parsers\InternetMessageFormatHeaderParser.cs">
<Link>Formatting\Parsers\InternetMessageFormatHeaderParser.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\Parsers\MimeMultipartBodyPartParser.cs">
<Link>Formatting\Parsers\MimeMultipartBodyPartParser.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\Parsers\MimeMultipartParser.cs">
<Link>Formatting\Parsers\MimeMultipartParser.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\Parsers\ParserState.cs">
<Link>Formatting\Parsers\ParserState.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\StringComparisonHelper.cs">
<Link>Formatting\StringComparisonHelper.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Formatting\XmlMediaTypeFormatter.cs">
<Link>Formatting\XmlMediaTypeFormatter.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\HttpContentFormDataExtensions.cs">
<Link>HttpContentFormDataExtensions.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Internal\HttpValueCollection.cs">
<Link>Internal\HttpValueCollection.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\UriExtensions.cs">
<Link>UriExtensions.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting.NetCore\GlobalSuppressions.cs">
<Link>GlobalSuppressions.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Handlers\HttpProgressEventArgs.cs">
<Link>Handlers\HttpProgressEventArgs.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Handlers\ProgressContent.cs">
<Link>Handlers\ProgressContent.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Handlers\ProgressMessageHandler.cs">
<Link>Handlers\ProgressMessageHandler.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Handlers\ProgressStream.cs">
<Link>Handlers\ProgressStream.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\HttpClientExtensions.cs">
<Link>HttpClientExtensions.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\HttpClientFactory.cs">
<Link>HttpClientFactory.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\HttpContentExtensions.cs">
<Link>HttpContentExtensions.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\HttpContentMessageExtensions.cs">
<Link>HttpContentMessageExtensions.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\HttpContentMultipartExtensions.cs">
<Link>HttpContentMultipartExtensions.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\HttpHeaderExtensions.cs">
<Link>HttpHeaderExtensions.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\HttpMessageContent.cs">
<Link>HttpMessageContent.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\HttpUnsortedHeaders.cs">
<Link>HttpUnsortedHeaders.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\HttpUnsortedRequest.cs">
<Link>HttpUnsortedRequest.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\HttpUnsortedResponse.cs">
<Link>HttpUnsortedResponse.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Internal\AsyncResult.cs">
<Link>Internal\AsyncResult.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Internal\DelegatingStream.cs">
<Link>Internal\DelegatingStream.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Internal\ReadOnlyStreamWithEncodingPreamble.cs">
<Link>Internal\ReadOnlyStreamWithEncodingPreamble.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Internal\TypeExtensions.cs">
<Link>Internal\TypeExtensions.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\MimeBodyPart.cs">
<Link>MimeBodyPart.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\MultipartFileData.cs">
<Link>MultipartFileData.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\MultipartMemoryStreamProvider.cs">
<Link>MultipartMemoryStreamProvider.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\MultipartRelatedStreamProvider.cs">
<Link>MultipartRelatedStreamProvider.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\MultipartStreamProvider.cs">
<Link>MultipartStreamProvider.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\ObjectContent.cs">
<Link>ObjectContent.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\ObjectContentOfT.cs">
<Link>ObjectContentOfT.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\PushStreamContent.cs">
<Link>PushStreamContent.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Properties\AssemblyInfo.cs">
<Link>Properties\AssemblyInfo.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\Properties\Resources.Designer.cs">
<Link>Properties\Resources.Designer.cs</Link>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="..\System.Net.Http.Formatting\UnsupportedMediaTypeException.cs">
<Link>UnsupportedMediaTypeException.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting.NetCore\Internal\ConcurrentDictionary.cs">
<Link>Internal\ConcurrentDictionary.cs</Link>
</Compile>
<Compile Include="..\System.Net.Http.Formatting.NetCore\MediaTypeHeaderValueExtensions.cs">
<Link>MediaTypeHeaderValueExtensions.cs</Link>

<Compile Include="..\System.Net.Http.Formatting\**\*.cs">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirmed desktop project includes every source file in its folder.

<Link>%(RecursiveDir)\%(Filename).cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
Expand All @@ -243,15 +52,18 @@
<DesignTime>True</DesignTime>
<DependentUpon>CommonWebApiResources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\Common\CommonWebApiResources.resx">
<Link>Properties\CommonWebApiResources.resx</Link>
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>CommonWebApiResources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Update="..\System.Net.Http.Formatting\Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<EmbeddedResource Include="..\System.Net.Http.Formatting\Properties\Resources.resx">
<Link>Properties\Resources.resx</Link>
<Generator>ResXFileCodeGenerator</Generator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
using System.Threading.Tasks;
using System.Web.Http;
using Newtonsoft.Json;
#if NEWTONSOFTJSON10
using BsonReader = Newtonsoft.Json.Bson.BsonDataReader;
using BsonWriter = Newtonsoft.Json.Bson.BsonDataWriter;
#else
using Newtonsoft.Json.Bson;
#endif

namespace System.Net.Http.Formatting
{
Expand Down
6 changes: 3 additions & 3 deletions src/System.Net.Http.Formatting/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System.Reflection;
using System.Runtime.CompilerServices;
#if !NETFX_CORE || NETSTANDARD1_1
#if !NETFX_CORE
using System.Runtime.InteropServices;
#endif

Expand All @@ -14,11 +14,11 @@
[assembly: AssemblyTitle("System.Net.Http.Formatting")]
[assembly: AssemblyDescription("")]

#if !NETFX_CORE || NETSTANDARD1_1 // GuidAttibute is not supported in portable libraries but is in .NET Standard.
#if !NETFX_CORE // GuidAttibute is not supported in portable libraries.
[assembly: Guid("7fa1ae84-36e2-46b6-812c-c985a8e65e9a")]
#endif

#if NETSTANDARD1_1
#if NETSTANDARD2_0
[assembly: InternalsVisibleTo("System.Net.Http.Formatting.NetStandard.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
#elif NETFX_CORE
[assembly: InternalsVisibleTo("System.Net.Http.Formatting.NetCore.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
Expand Down
2 changes: 1 addition & 1 deletion test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<PropertyGroup>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion Condition="'$(MSBuildProjectName)' != 'System.Net.Http.Formatting.NetStandard.Test'">v4.5.2</TargetFrameworkVersion>
</PropertyGroup>
</Project>
Loading