Skip to content

Commit

Permalink
Upgrading to NET Core 1.1 before publish new nuget
Browse files Browse the repository at this point in the history
  • Loading branch information
geoperez committed Dec 15, 2016
1 parent f2e72e3 commit 0e333d0
Show file tree
Hide file tree
Showing 16 changed files with 160 additions and 166 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,4 @@ TestResult.xml
/src/Unosquare.Labs.EmbedIO.Samples/nuget.config
/test/Unosquare.Labs.EmbedIO.Tests/nuget.config
*.targets
/.vscode
12 changes: 7 additions & 5 deletions src/Unosquare.Labs.EmbedIO.Command/Program.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
namespace Unosquare.Labs.EmbedIO.Command
{
using CommandLine;
using Swan;
using System;
using System.Reflection;
using Unosquare.Labs.EmbedIO.Modules;

/// <summary>
/// Entry poing
/// Entry point
/// </summary>
internal class Program
{
Expand All @@ -18,13 +19,14 @@ private static void Main(string[] args)
{
var options = new Options();

Console.WriteLine("Unosquare.Labs.EmbedIO Web Server");
"Unosquare.Labs.EmbedIO Web Server".Info();

if (!Parser.Default.ParseArguments(args, options)) return;

Console.WriteLine(" Command-Line Utility: Press any key to stop the server.");
" Command-Line Utility: Press any key to stop the server.".Info();

var serverUrl = "http://localhost:" + options.Port + "/";

using (
var server = options.NoVerbose
? WebServer.Create(serverUrl)
Expand All @@ -43,14 +45,14 @@ private static void Main(string[] args)
{
foreach (var api in options.ApiAssemblies)
{
server.Log.DebugFormat("Registering Assembly {0}", api);
$"Registering Assembly {api}".Debug();
LoadApi(api, server);
}
}

// start the server
server.RunAsync();
Console.ReadKey(true);
Terminal.ReadKey(true);
}
}

Expand Down
33 changes: 17 additions & 16 deletions src/Unosquare.Labs.EmbedIO.Command/project.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},

"dependencies": {
"Newtonsoft.Json": "9.0.1",
"CommandLineParser": "1.9.71",
"Unosquare.Labs.EmbedIO": { "target": "project" }
},
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"CommandLineParser": "1.9.71",
"Unosquare.Swan": "0.9.0",
"Unosquare.Labs.EmbedIO": { "target": "project" }
},

"frameworks": {
"net452": {

"frameworks": {
"net452": {

}
},
"runtimes": {
"win": {}
}
},
"runtimes": {
"win": {}
}
}
2 changes: 1 addition & 1 deletion src/Unosquare.Labs.EmbedIO.Samples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private static void Main(string[] args)
server.RunAsync();

// Fire up the browser to show the content!
#if DEBUG && !NETCOREAPP1_0 && !NETSTANDARD1_6
#if DEBUG && !NETCOREAPP1_1 && !NETSTANDARD1_6
var browser = new System.Diagnostics.Process()
{
StartInfo = new System.Diagnostics.ProcessStartInfo(url)
Expand Down
2 changes: 1 addition & 1 deletion src/Unosquare.Labs.EmbedIO.Samples/StaticFilesSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static string HtmlRootPath

// This lets you edit the files without restarting the server.
#if DEBUG && !MONO
#if NETCOREAPP1_0
#if NETCOREAPP1_1
return Path.Combine(Directory.GetParent(assemblyPath).Parent.Parent.FullName, "html");
#else
return Path.Combine(Directory.GetParent(assemblyPath).Parent.Parent.Parent.FullName, "html");
Expand Down
2 changes: 1 addition & 1 deletion src/Unosquare.Labs.EmbedIO.Samples/WebSocketsSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ protected override void OnClientConnected(WebSocketContext context)
StartInfo = new ProcessStartInfo()
{
CreateNoWindow = true,
#if !NETCOREAPP1_0 && !NETSTANDARD1_6
#if !NETCOREAPP1_1 && !NETSTANDARD1_6
ErrorDialog = false,
#endif
FileName = "cmd.exe",
Expand Down
63 changes: 30 additions & 33 deletions src/Unosquare.Labs.EmbedIO.Samples/project.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,37 @@
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true,
"copyToOutput": ["html\\"]
},
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true,
"copyToOutput": ["html\\"]
},

"dependencies": {
"LiteLib": "0.9.1",
"Newtonsoft.Json": "9.0.1",
"Tubular.ServerSide": "1.0.8",
"Unosquare.Labs.EmbedIO": { "target": "project" }
},
"dependencies": {
"LiteLib": "0.9.2",
"Newtonsoft.Json": "9.0.1",
"Tubular.ServerSide": "1.0.8",
"Unosquare.Labs.EmbedIO": { "target": "project" }
},

"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50",
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
"frameworks": {
"netcoreapp1.1": {
"imports": "dnxcore50",
"dependencies": {
"Microsoft.NETCore.App": "1.1.0"
}
},
"net452": {
"frameworkAssemblies": {
"System.ComponentModel.DataAnnotations": ""
}
},
"net46": {
"frameworkAssemblies": {
"System.ComponentModel.DataAnnotations": ""
}
}
}
},
"net452": {
"frameworkAssemblies": {
"System.ComponentModel.DataAnnotations": ""
}
},
"net46": {
"frameworkAssemblies": {
"System.ComponentModel.DataAnnotations": ""
}
"runtimes": {
"win": {},
"win81-x64": {}
}
},
"runtimes": {
"win": {},
"win81-x64": {}
}
}
6 changes: 3 additions & 3 deletions src/Unosquare.Labs.EmbedIO/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static class Constants
/// The format culture used for header outputs
/// </summary>
public static readonly CultureInfo StandardCultureInfo =
#if !NETCOREAPP1_0 && !NETSTANDARD1_6
#if !NETCOREAPP1_1 && !NETSTANDARD1_6
CultureInfo.CreateSpecificCulture("en-US");
#else
new CultureInfo("en-US");
Expand All @@ -35,7 +35,7 @@ public static class Constants
/// The standard string comparer
/// </summary>
public static StringComparer StandardStringComparer =
#if !NETCOREAPP1_0 && !NETSTANDARD1_6
#if !NETCOREAPP1_1 && !NETSTANDARD1_6
StringComparer.InvariantCultureIgnoreCase;
#else
StringComparer.OrdinalIgnoreCase;
Expand All @@ -45,7 +45,7 @@ public static class Constants
/// The default encoding
/// </summary>
public static Encoding DefaultEncoding =
#if !NETCOREAPP1_0 && !NETSTANDARD1_6
#if !NETCOREAPP1_1 && !NETSTANDARD1_6
Encoding.Default;
#else
Encoding.GetEncoding(0);
Expand Down
2 changes: 1 addition & 1 deletion src/Unosquare.Labs.EmbedIO/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ public static MemoryStream Compress(this Stream buffer)
public static string ComputeMd5Hash(Stream stream)
{
var md5 = MD5.Create();
#if !NETCOREAPP1_0 && !NETSTANDARD1_6
#if !NETCOREAPP1_1 && !NETSTANDARD1_6
const int bufferSize = 4096;

var readAheadBuffer = new byte[bufferSize];
Expand Down
2 changes: 1 addition & 1 deletion src/Unosquare.Labs.EmbedIO/Modules/StaticFilesModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ private bool HandleGet(HttpListenerContext context, WebServer server, bool sendB
}
finally
{
#if !NETCOREAPP1_0 && !NETSTANDARD1_6
#if !NETCOREAPP1_1 && !NETSTANDARD1_6
buffer.Close();
#endif
buffer.Dispose();
Expand Down
2 changes: 1 addition & 1 deletion src/Unosquare.Labs.EmbedIO/System.Net/SystemUri.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETCOREAPP1_0 || NETSTANDARD1_6
#if NETCOREAPP1_1 || NETSTANDARD1_6
namespace System
{
/// <summary>
Expand Down
84 changes: 39 additions & 45 deletions src/Unosquare.Labs.EmbedIO/project.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,47 @@
{
"version": "1.2.4-*",
"buildOptions": {
"xmlDoc": true
},
"version": "1.2.5-*",
"buildOptions": {
"xmlDoc": true
},

"dependencies": {
"Newtonsoft.Json": "9.0.1"
},
"dependencies": {
"Newtonsoft.Json": "9.0.1"
},

"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50",
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
"frameworks": {
"netcoreapp1.1": {
"imports": "dnxcore50",
"dependencies": {
"Microsoft.NETCore.App": "1.1.0",
"System.Security.Cryptography.Primitives": "4.3.0",
"System.Net.Primitives": "4.3.0",
"System.Collections.Specialized": "4.3.0",
"System.Collections.NonGeneric": "4.3.0",
"System.Security.Claims": "4.3.0"
}
},
"System.Security.Cryptography.Primitives": "4.0.0",
"System.Net.Primitives": "4.0.11",
"System.Collections.Specialized": "4.0.1",
"System.Collections.NonGeneric": "4.0.1",
"System.Security.Claims": "4.0.1"
}
},
"netstandard1.6": {
"dependencies" : {
"NETStandard.Library": "1.6.1",
"System.Security.Cryptography.Primitives": "4.3.0",
"System.Net.Primitives": "4.3.0",
"System.Net.Requests": "4.3.0",
"System.Collections.Specialized": "4.3.0",
"System.Collections.NonGeneric": "4.3.0",
"System.Security.Claims": "4.3.0",
"System.Net.Security": "4.3.0",
"System.Net.NameResolution": "4.3.0",
"System.Threading.Thread": "4.3.0",
"System.Threading.ThreadPool": "4.3.0",
"System.IO.FileSystem.Watcher": "4.3.0"
}
},
"net452": {
"netstandard1.6": {
"dependencies": {
"NETStandard.Library": "1.6.1",
"System.Security.Cryptography.Primitives": "4.3.0",
"System.Net.Primitives": "4.3.0",
"System.Net.Requests": "4.3.0",
"System.Collections.Specialized": "4.3.0",
"System.Collections.NonGeneric": "4.3.0",
"System.Security.Claims": "4.3.0",
"System.Net.Security": "4.3.0",
"System.Net.NameResolution": "4.3.0",
"System.Threading.Thread": "4.3.0",
"System.Threading.ThreadPool": "4.3.0",
"System.IO.FileSystem.Watcher": "4.3.0"
}
},
"net452": {

},
"net46": {}
},
"net46": {
"dependencies": {
}
"runtimes": {
"win": {}
}
},
"runtimes": {
"win": {}
}
}
6 changes: 4 additions & 2 deletions test/Unosquare.Labs.EmbedIO.Tests/StaticFilesModuleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public async Task GetEtag()
Assert.Fail("The Exception should raise");
}

#if !NETCOREAPP1_0 && !NETSTANDARD1_6
#if !NETCOREAPP1_1 && !NETSTANDARD1_6
[Test]
public void GetInitialPartial()
{
Expand Down Expand Up @@ -288,7 +288,7 @@ public async Task GetNotPartial()
}
}

#if !NETCOREAPP1_0 && !NETSTANDARD1_6
#if !NETCOREAPP1_1 && !NETSTANDARD1_6
[Test]
public async Task GetGzipCompressFile()
{
Expand Down Expand Up @@ -359,6 +359,8 @@ public async Task TestCaseSensitiveFile()
var file = Path.GetTempPath() + Guid.NewGuid().ToString().ToLower();
File.WriteAllText(file, "");

Assert.IsTrue(File.Exists(file), "File was created");

if (File.Exists(file.ToUpper()))
{
Assert.Ignore("File-system is not case sensitive, ignoring");
Expand Down
2 changes: 1 addition & 1 deletion test/Unosquare.Labs.EmbedIO.Tests/WebServerCultureTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NETCOREAPP1_0 && !NETSTANDARD1_6
#if !NETCOREAPP1_1 && !NETSTANDARD1_6
using System;
using System.Collections.Generic;
using System.IO;
Expand Down
8 changes: 4 additions & 4 deletions test/Unosquare.Labs.EmbedIO.Tests/WebSocketsModuleTest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Unosquare.Labs.EmbedIO.Tests
{
using System;
#if !NETCOREAPP1_0 && !NETSTANDARD1_6
#if !NETCOREAPP1_1 && !NETSTANDARD1_6
using System.Net.WebSockets;
#endif
using System.Threading;
Expand Down Expand Up @@ -31,7 +31,7 @@ public async Task TestConnectWebSocket()

Assert.AreEqual(WebServer.Module<WebSocketsModule>().Handlers.Count, 1, "WebSocketModule has one handler");

#if !NETCOREAPP1_0 && !NETSTANDARD1_6
#if !NETCOREAPP1_1 && !NETSTANDARD1_6
var clientSocket = new ClientWebSocket();
var ct = new CancellationTokenSource();
await clientSocket.ConnectAsync(new Uri(Resources.WsServerAddress + "test"), ct.Token);
Expand All @@ -44,8 +44,8 @@ public async Task TestConnectWebSocket()
await clientSocket.SendAsync(message, WebSocketMessageType.Text, true, ct.Token);
var result = await clientSocket.ReceiveAsync(buffer, ct.Token);

Assert.IsTrue(result.EndOfMessage);
Assert.IsTrue(System.Text.Encoding.UTF8.GetString(buffer.Array).TrimEnd((char) 0) == "WELCOME");
Assert.IsTrue(result.EndOfMessage, "End of message is true");
Assert.IsTrue(System.Text.Encoding.UTF8.GetString(buffer.Array).TrimEnd((char) 0) == "WELCOME", "Final message is WELCOME");
#endif
}

Expand Down
Loading

0 comments on commit 0e333d0

Please sign in to comment.