Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Commit 2aaceaa

Browse files
Move core packages to netstandard2.0
1 parent 1c5bd98 commit 2aaceaa

File tree

11 files changed

+6
-66
lines changed

11 files changed

+6
-66
lines changed

build/dependencies.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<InternalAspNetCoreSdkVersion>2.1.0-*</InternalAspNetCoreSdkVersion>
77
<JsonNetVersion>10.0.1</JsonNetVersion>
88
<NETStandardImplicitPackageVersion>$(BundledNETStandardPackageVersion)</NETStandardImplicitPackageVersion>
9-
<RuntimeFrameworkVersion Condition="'$(TargetFramework)'=='netcoreapp2.0'">2.0.0-*</RuntimeFrameworkVersion>
9+
<RuntimeFrameworkVersion Condition="'$(TargetFramework)'=='netstandard2.0'">2.0.0-*</RuntimeFrameworkVersion>
1010
<ThreadingDataflowVersion>4.7.0</ThreadingDataflowVersion>
1111
</PropertyGroup>
1212
</Project>

src/Microsoft.AspNetCore.NodeServices.Sockets/Microsoft.AspNetCore.NodeServices.Sockets.csproj

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<PropertyGroup>
66
<Description>Socket-based RPC for Microsoft.AspNetCore.NodeServices.</Description>
7-
<TargetFramework>netcoreapp2.0</TargetFramework>
7+
<TargetFramework>netstandard2.0</TargetFramework>
88
<PackageTags>aspnetcore;aspnetcoremvc;nodeservices</PackageTags>
99
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
1010
</PropertyGroup>
@@ -15,14 +15,6 @@
1515

1616
<ItemGroup>
1717
<ProjectReference Include="..\Microsoft.AspNetCore.NodeServices\Microsoft.AspNetCore.NodeServices.csproj" />
18-
</ItemGroup>
19-
20-
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
21-
<PackageReference Include="Microsoft.Tpl.Dataflow" Version="$(MicrosoftDataflowVersion)" />
22-
</ItemGroup>
23-
24-
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
25-
<PackageReference Include="System.IO.Pipes" Version="$(CoreFxVersion)" />
2618
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="$(ThreadingDataflowVersion)" />
2719
</ItemGroup>
2820

src/Microsoft.AspNetCore.NodeServices.Sockets/PhysicalConnections/NamedPipeConnection.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ public override async Task<Stream> Open(string address)
1818
PipeDirection.InOut,
1919
PipeOptions.Asynchronous);
2020

21-
#if NET451
22-
_namedPipeClientStream.Connect();
23-
#else
2421
await _namedPipeClientStream.ConnectAsync().ConfigureAwait(false);
25-
#endif
2622

2723
return _namedPipeClientStream;
2824
}

src/Microsoft.AspNetCore.NodeServices.Sockets/PhysicalConnections/StreamConnection.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ internal abstract class StreamConnection : IDisposable
1111

1212
public static StreamConnection Create()
1313
{
14-
#if NET451
15-
return new NamedPipeConnection();
16-
#else
1714
var useNamedPipes = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(
1815
System.Runtime.InteropServices.OSPlatform.Windows);
1916
if (useNamedPipes)
@@ -24,7 +21,6 @@ public static StreamConnection Create()
2421
{
2522
return new UnixDomainSocketConnection();
2623
}
27-
#endif
2824
}
2925
}
3026
}

src/Microsoft.AspNetCore.NodeServices.Sockets/PhysicalConnections/UnixDomainSocketConnection.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,6 @@ internal class UnixDomainSocketConnection : StreamConnection
1010
private NetworkStream _networkStream;
1111
private Socket _socket;
1212

13-
#if NET451
14-
public override Task<Stream> Open(string address)
15-
{
16-
// The 'null' assignments avoid the compiler warnings about unassigned fields.
17-
// Note that this whole class isn't supported on .NET 4.5.1, since that's not cross-platform.
18-
_networkStream = null;
19-
_socket = null;
20-
throw new System.PlatformNotSupportedException();
21-
}
22-
#else
2313
public override async Task<Stream> Open(string address)
2414
{
2515
var endPoint = new UnixDomainSocketEndPoint("/tmp/" + address);
@@ -28,7 +18,6 @@ public override async Task<Stream> Open(string address)
2818
_networkStream = new NetworkStream(_socket);
2919
return _networkStream;
3020
}
31-
#endif
3221

3322
public override void Dispose()
3423
{

src/Microsoft.AspNetCore.NodeServices.Sockets/PhysicalConnections/UnixDomainSocketEndPoint.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,7 @@ internal UnixDomainSocketEndPoint(SocketAddress socketAddress)
5959
}
6060
else
6161
{
62-
#if NET451
63-
_encodedPath = new byte[0];
64-
#else
6562
_encodedPath = Array.Empty<byte>();
66-
#endif
6763
_path = string.Empty;
6864
}
6965
}

src/Microsoft.AspNetCore.NodeServices.Sockets/VirtualConnections/VirtualConnection.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@ namespace Microsoft.AspNetCore.NodeServices.Sockets.VirtualConnections
1212
/// </summary>
1313
internal class VirtualConnection : Stream
1414
{
15-
#if NET451
16-
private readonly static Task CompletedTask = Task.FromResult((object)null);
17-
#else
1815
private readonly static Task CompletedTask = Task.CompletedTask;
19-
#endif
2016
private VirtualConnectionClient _host;
2117
private readonly BufferBlock<byte[]> _receivedDataQueue = new BufferBlock<byte[]>();
2218
private ArraySegment<byte> _receivedDataNotYetUsed;

src/Microsoft.AspNetCore.NodeServices/HostingModels/OutOfProcessNodeInstance.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,7 @@ private void EnsureFileSystemWatcherIsDisposed()
315315

316316
private static void SetEnvironmentVariable(ProcessStartInfo startInfo, string name, string value)
317317
{
318-
#if NET451
319-
startInfo.EnvironmentVariables[name] = value;
320-
#else
321318
startInfo.Environment[name] = value;
322-
#endif
323319
}
324320

325321
private static Process LaunchNodeProcess(ProcessStartInfo startInfo)

src/Microsoft.AspNetCore.NodeServices/Microsoft.AspNetCore.NodeServices.csproj

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<PropertyGroup>
66
<Description>Invoke Node.js modules at runtime in ASP.NET Core applications.</Description>
7-
<TargetFramework>netcoreapp2.0</TargetFramework>
7+
<TargetFramework>netstandard2.0</TargetFramework>
88
<PackageTags>aspnetcore;aspnetcoremvc;nodeservices</PackageTags>
99
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
1010
<GenerateDocumentationFile>true</GenerateDocumentationFile>
@@ -18,11 +18,6 @@
1818
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="$(AspNetCoreVersion)" />
1919
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(AspNetCoreVersion)" />
2020
<PackageReference Include="Newtonsoft.Json" Version="$(JsonNetVersion)" />
21-
</ItemGroup>
22-
23-
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
24-
<PackageReference Include="System.Diagnostics.Process" Version="$(CoreFxVersion)" />
25-
<PackageReference Include="System.IO.FileSystem.Watcher" Version="$(CoreFxVersion)" />
2621
<PackageReference Include="System.Runtime.Loader" Version="$(CoreFxVersion)" />
2722
</ItemGroup>
2823

src/Microsoft.AspNetCore.NodeServices/Util/StringAsTempFile.cs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,10 @@ public StringAsTempFile(string content)
2323

2424
// Because .NET finalizers don't reliably run when the process is terminating, also
2525
// add event handlers for other shutdown scenarios.
26-
#if NET451
27-
AppDomain.CurrentDomain.ProcessExit += HandleProcessExit;
28-
AppDomain.CurrentDomain.DomainUnload += HandleProcessExit;
29-
#else
3026
// Note that this still doesn't capture SIGKILL (at least on macOS) - there doesn't
3127
// appear to be a way of doing that. So in that case, the temporary file will be
3228
// left behind.
3329
System.Runtime.Loader.AssemblyLoadContext.Default.Unloading += HandleAssemblyUnloading;
34-
#endif
3530
}
3631

3732
/// <summary>
@@ -55,12 +50,7 @@ private void DisposeImpl(bool disposing)
5550
if (disposing)
5651
{
5752
// Dispose managed state
58-
#if NET451
59-
AppDomain.CurrentDomain.ProcessExit -= HandleProcessExit;
60-
AppDomain.CurrentDomain.DomainUnload -= HandleProcessExit;
61-
#else
6253
System.Runtime.Loader.AssemblyLoadContext.Default.Unloading -= HandleAssemblyUnloading;
63-
#endif
6454
}
6555

6656
EnsureTempFileDeleted();
@@ -81,17 +71,10 @@ private void EnsureTempFileDeleted()
8171
}
8272
}
8373

84-
#if NET451
85-
private void HandleProcessExit(object sender, EventArgs args)
86-
{
87-
EnsureTempFileDeleted();
88-
}
89-
#else
9074
private void HandleAssemblyUnloading(System.Runtime.Loader.AssemblyLoadContext context)
9175
{
9276
EnsureTempFileDeleted();
9377
}
94-
#endif
9578

9679
/// <summary>
9780
/// Implements the finalization part of the IDisposable pattern by calling Dispose(false).

0 commit comments

Comments
 (0)