Skip to content

Commit

Permalink
Netstandard1.3 Support (#18)
Browse files Browse the repository at this point in the history
NetStandard 1.3 Support
  • Loading branch information
jaredpar authored Sep 2, 2021
1 parent 745c190 commit 391edad
Show file tree
Hide file tree
Showing 57 changed files with 1,106 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
- name: Pack NetCoreApp31
run: dotnet pack --no-build -p:IncludeSymbols=false -p:RepositoryCommit=${GITHUB_SHA} -p:PackageVersion="${{ github.event.inputs.version }}" -c Release Basic.Reference.Assemblies.NetCoreApp31/Basic.Reference.Assemblies.NetCoreApp31.csproj -o .

- name: Pack NetStandard13
run: dotnet pack --no-build -p:IncludeSymbols=false -p:RepositoryCommit=${GITHUB_SHA} -p:PackageVersion="${{ github.event.inputs.version }}" -c Release Basic.Reference.Assemblies.NetStandard13/Basic.Reference.Assemblies.NetStandard13.csproj -o .

- name: Pack NetStandard20
run: dotnet pack --no-build -p:IncludeSymbols=false -p:RepositoryCommit=${GITHUB_SHA} -p:PackageVersion="${{ github.event.inputs.version }}" -c Release Basic.Reference.Assemblies.NetStandard20/Basic.Reference.Assemblies.NetStandard20.csproj -o .

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<IsPackable>true</IsPackable>
</PropertyGroup>

<Import Project="Generated.targets" />

</Project>
298 changes: 298 additions & 0 deletions Basic.Reference.Assemblies.NetStandard13/Generated.cs

Large diffs are not rendered by default.

176 changes: 176 additions & 0 deletions Basic.Reference.Assemblies.NetStandard13/Generated.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
<Project>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\Microsoft.Win32.Primitives.dll">
<LogicalName>netstandard13.Microsoft.Win32.Primitives</LogicalName>
<Link>Resources\netstandard13\Microsoft.Win32.Primitives.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.AppContext.dll">
<LogicalName>netstandard13.System.AppContext</LogicalName>
<Link>Resources\netstandard13\System.AppContext.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Collections.Concurrent.dll">
<LogicalName>netstandard13.System.Collections.Concurrent</LogicalName>
<Link>Resources\netstandard13\System.Collections.Concurrent.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Collections.dll">
<LogicalName>netstandard13.System.Collections</LogicalName>
<Link>Resources\netstandard13\System.Collections.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Console.dll">
<LogicalName>netstandard13.System.Console</LogicalName>
<Link>Resources\netstandard13\System.Console.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Diagnostics.Debug.dll">
<LogicalName>netstandard13.System.Diagnostics.Debug</LogicalName>
<Link>Resources\netstandard13\System.Diagnostics.Debug.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Diagnostics.Tools.dll">
<LogicalName>netstandard13.System.Diagnostics.Tools</LogicalName>
<Link>Resources\netstandard13\System.Diagnostics.Tools.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Diagnostics.Tracing.dll">
<LogicalName>netstandard13.System.Diagnostics.Tracing</LogicalName>
<Link>Resources\netstandard13\System.Diagnostics.Tracing.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Globalization.Calendars.dll">
<LogicalName>netstandard13.System.Globalization.Calendars</LogicalName>
<Link>Resources\netstandard13\System.Globalization.Calendars.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Globalization.dll">
<LogicalName>netstandard13.System.Globalization</LogicalName>
<Link>Resources\netstandard13\System.Globalization.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.IO.Compression.dll">
<LogicalName>netstandard13.System.IO.Compression</LogicalName>
<Link>Resources\netstandard13\System.IO.Compression.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.IO.Compression.ZipFile.dll">
<LogicalName>netstandard13.System.IO.Compression.ZipFile</LogicalName>
<Link>Resources\netstandard13\System.IO.Compression.ZipFile.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.IO.dll">
<LogicalName>netstandard13.System.IO</LogicalName>
<Link>Resources\netstandard13\System.IO.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.IO.FileSystem.dll">
<LogicalName>netstandard13.System.IO.FileSystem</LogicalName>
<Link>Resources\netstandard13\System.IO.FileSystem.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.IO.FileSystem.Primitives.dll">
<LogicalName>netstandard13.System.IO.FileSystem.Primitives</LogicalName>
<Link>Resources\netstandard13\System.IO.FileSystem.Primitives.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Linq.dll">
<LogicalName>netstandard13.System.Linq</LogicalName>
<Link>Resources\netstandard13\System.Linq.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Linq.Expressions.dll">
<LogicalName>netstandard13.System.Linq.Expressions</LogicalName>
<Link>Resources\netstandard13\System.Linq.Expressions.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Net.Http.dll">
<LogicalName>netstandard13.System.Net.Http</LogicalName>
<Link>Resources\netstandard13\System.Net.Http.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Net.Primitives.dll">
<LogicalName>netstandard13.System.Net.Primitives</LogicalName>
<Link>Resources\netstandard13\System.Net.Primitives.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Net.Sockets.dll">
<LogicalName>netstandard13.System.Net.Sockets</LogicalName>
<Link>Resources\netstandard13\System.Net.Sockets.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.ObjectModel.dll">
<LogicalName>netstandard13.System.ObjectModel</LogicalName>
<Link>Resources\netstandard13\System.ObjectModel.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Reflection.dll">
<LogicalName>netstandard13.System.Reflection</LogicalName>
<Link>Resources\netstandard13\System.Reflection.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Reflection.Extensions.dll">
<LogicalName>netstandard13.System.Reflection.Extensions</LogicalName>
<Link>Resources\netstandard13\System.Reflection.Extensions.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Reflection.Primitives.dll">
<LogicalName>netstandard13.System.Reflection.Primitives</LogicalName>
<Link>Resources\netstandard13\System.Reflection.Primitives.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Resources.ResourceManager.dll">
<LogicalName>netstandard13.System.Resources.ResourceManager</LogicalName>
<Link>Resources\netstandard13\System.Resources.ResourceManager.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Runtime.dll">
<LogicalName>netstandard13.System.Runtime</LogicalName>
<Link>Resources\netstandard13\System.Runtime.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Runtime.Extensions.dll">
<LogicalName>netstandard13.System.Runtime.Extensions</LogicalName>
<Link>Resources\netstandard13\System.Runtime.Extensions.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Runtime.Handles.dll">
<LogicalName>netstandard13.System.Runtime.Handles</LogicalName>
<Link>Resources\netstandard13\System.Runtime.Handles.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Runtime.InteropServices.dll">
<LogicalName>netstandard13.System.Runtime.InteropServices</LogicalName>
<Link>Resources\netstandard13\System.Runtime.InteropServices.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Runtime.InteropServices.RuntimeInformation.dll">
<LogicalName>netstandard13.System.Runtime.InteropServices.RuntimeInformation</LogicalName>
<Link>Resources\netstandard13\System.Runtime.InteropServices.RuntimeInformation.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Runtime.Numerics.dll">
<LogicalName>netstandard13.System.Runtime.Numerics</LogicalName>
<Link>Resources\netstandard13\System.Runtime.Numerics.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Security.Cryptography.Algorithms.dll">
<LogicalName>netstandard13.System.Security.Cryptography.Algorithms</LogicalName>
<Link>Resources\netstandard13\System.Security.Cryptography.Algorithms.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Security.Cryptography.Encoding.dll">
<LogicalName>netstandard13.System.Security.Cryptography.Encoding</LogicalName>
<Link>Resources\netstandard13\System.Security.Cryptography.Encoding.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Security.Cryptography.Primitives.dll">
<LogicalName>netstandard13.System.Security.Cryptography.Primitives</LogicalName>
<Link>Resources\netstandard13\System.Security.Cryptography.Primitives.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Security.Cryptography.X509Certificates.dll">
<LogicalName>netstandard13.System.Security.Cryptography.X509Certificates</LogicalName>
<Link>Resources\netstandard13\System.Security.Cryptography.X509Certificates.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Text.Encoding.dll">
<LogicalName>netstandard13.System.Text.Encoding</LogicalName>
<Link>Resources\netstandard13\System.Text.Encoding.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Text.Encoding.Extensions.dll">
<LogicalName>netstandard13.System.Text.Encoding.Extensions</LogicalName>
<Link>Resources\netstandard13\System.Text.Encoding.Extensions.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Text.RegularExpressions.dll">
<LogicalName>netstandard13.System.Text.RegularExpressions</LogicalName>
<Link>Resources\netstandard13\System.Text.RegularExpressions.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Threading.dll">
<LogicalName>netstandard13.System.Threading</LogicalName>
<Link>Resources\netstandard13\System.Threading.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Threading.Tasks.dll">
<LogicalName>netstandard13.System.Threading.Tasks</LogicalName>
<Link>Resources\netstandard13\System.Threading.Tasks.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Threading.Timer.dll">
<LogicalName>netstandard13.System.Threading.Timer</LogicalName>
<Link>Resources\netstandard13\System.Threading.Timer.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Xml.ReaderWriter.dll">
<LogicalName>netstandard13.System.Xml.ReaderWriter</LogicalName>
<Link>Resources\netstandard13\System.Xml.ReaderWriter.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\\Resources\netstandard1.3\System.Xml.XDocument.dll">
<LogicalName>netstandard13.System.Xml.XDocument</LogicalName>
<Link>Resources\netstandard13\System.Xml.XDocument.dll</Link>
</EmbeddedResource>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<ProjectReference Include="..\Basic.Reference.Assemblies.NetCoreApp31\Basic.Reference.Assemblies.NetCoreApp31.csproj">
<Aliases>RefNetCoreApp31</Aliases>
</ProjectReference>
<ProjectReference Include="..\Basic.Reference.Assemblies.NetStandard13\Basic.Reference.Assemblies.NetStandard13.csproj">
<Aliases>RefNetStandard13</Aliases>
</ProjectReference>
<ProjectReference Include="..\Basic.Reference.Assemblies.NetStandard20\Basic.Reference.Assemblies.NetStandard20.csproj">
<Aliases>RefNetStandard20</Aliases>
</ProjectReference>
Expand Down
22 changes: 22 additions & 0 deletions Basic.Reference.Assemblies.UnitTests/SanityUnitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ static void Main()
new[] { CSharpSyntaxTree.ParseText(source) },
references: ReferenceAssemblies.Get(kind));

// NetStandard1.3 comes with several no warn options we need here
if (kind == ReferenceAssemblyKind.NetStandard13)
{
compilation = NoWarn(compilation, "CS1702");
compilation = NoWarn(compilation, "CS1701");
}

Assert.Empty(compilation.GetDiagnostics());
using var stream = new MemoryStream();
var emitResult = compilation.Emit(stream);
Expand Down Expand Up @@ -64,12 +71,27 @@ static void Main()
references: Array.Empty<MetadataReference>());
compilation = compilation.WithReferenceAssemblies(kind);

// NetStandard1.3 comes with several no warn options we need here
if (kind == ReferenceAssemblyKind.NetStandard13)
{
compilation = NoWarn(compilation, "CS1702");
compilation = NoWarn(compilation, "CS1701");
}

Assert.Empty(compilation.GetDiagnostics());
using var stream = new MemoryStream();
var emitResult = compilation.Emit(stream);
Assert.True(emitResult.Success);
Assert.Empty(emitResult.Diagnostics);
}
}

private static CSharpCompilation NoWarn(CSharpCompilation compilation, string id)
{
var diagnosticMap = compilation.Options.SpecificDiagnosticOptions;
diagnosticMap = diagnosticMap.SetItem(id, ReportDiagnostic.Suppress);
var options = compilation.Options.WithSpecificDiagnosticOptions(diagnosticMap);
return compilation.WithOptions(options);
}
}
}
15 changes: 15 additions & 0 deletions Basic.Reference.Assemblies.UnitTests/SpecificSanityUnitTests.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
extern alias RefNetCoreApp31;
extern alias RefNet50;
extern alias RefNet60;
extern alias RefNetStandard13;
extern alias RefNetStandard20;
extern alias RefNet461;
extern alias RefNet472;

using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using System;
using System.IO;
using System.Linq;
Expand All @@ -16,6 +19,7 @@ namespace Basic.Reference.Assemblies.UnitTests
using Net50 = RefNet50::Basic.Reference.Assemblies.Net50;
using Net60 = RefNet60::Basic.Reference.Assemblies.Net60;
using NetCoreApp31 = RefNetCoreApp31::Basic.Reference.Assemblies.NetCoreApp31;
using NetStandard13 = RefNetStandard13::Basic.Reference.Assemblies.NetStandard13;
using NetStandard20 = RefNetStandard20::Basic.Reference.Assemblies.NetStandard20;
using Net461 = RefNet461::Basic.Reference.Assemblies.Net461;
using Net472 = RefNet472::Basic.Reference.Assemblies.Net472;
Expand Down Expand Up @@ -141,6 +145,17 @@ public void NetStandard20Tests()
Assert.Equal("Basic.Reference.Assemblies.NetStandard20", typeof(NetStandard20).Assembly.GetName().Name);
}

[Fact]
public void NetStandard13Tests()
{
foreach (var portableRef in NetStandard13.All)
{
Assert.NotNull(portableRef);
}
Assert.True(NetStandard13.All.Count() > 40);
Assert.Equal("Basic.Reference.Assemblies.NetStandard13", typeof(NetStandard13).Assembly.GetName().Name);
}

[Fact]
public void Net461Tests()
{
Expand Down
Loading

0 comments on commit 391edad

Please sign in to comment.