From 10311752237b6d4ea8b8c6c100cf9dbf6486f71b Mon Sep 17 00:00:00 2001 From: Sean McLellan Date: Sat, 12 Sep 2020 10:05:33 -0400 Subject: [PATCH] Exclude appsettings.json and simconnect.lib from single file publish --- .vscode/launch.json | 27 ++++++++++++++++++++ .vscode/tasks.json | 42 ++++++++++++++++++++++++++++++++ FSMosquitoClient.csproj | 23 ++++++++--------- FsMqtt.cs | 3 ++- Program.cs | 11 --------- Properties/Resources.Designer.cs | 10 -------- Properties/Resources.resx | 3 --- appsettings.json | 2 +- 8 files changed, 84 insertions(+), 37 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..a5b69c4 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,27 @@ +{ + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "version": "0.2.0", + "configurations": [ + { + "name": ".NET Core Launch (console)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/FSMosquitoClient.dll", + "args": [], + "cwd": "${workspaceFolder}", + // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console + "console": "internalConsole", + "stopAtEntry": false + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach", + "processId": "${command:pickProcess}" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..4f79882 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,42 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/FSMosquitoClient.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/FSMosquitoClient.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "${workspaceFolder}/FSMosquitoClient.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/FSMosquitoClient.csproj b/FSMosquitoClient.csproj index ca66f5a..0fa2b70 100644 --- a/FSMosquitoClient.csproj +++ b/FSMosquitoClient.csproj @@ -18,15 +18,16 @@ PreserveNewest + true - - - - - + + + + + @@ -54,16 +55,16 @@ - - PreserveNewest - - PreserveNewest + true - - + + + + + diff --git a/FsMqtt.cs b/FsMqtt.cs index 9b42289..13bebc5 100644 --- a/FsMqtt.cs +++ b/FsMqtt.cs @@ -198,9 +198,10 @@ private async Task OnDisconnected(MqttClientDisconnectedEventArgs e) await MqttClient.ConnectAsync(_mqttClientOptions, CancellationToken.None); return; } - catch + catch(Exception ex) { _logger.LogInformation($"Reconnection failed."); + _logger.LogError($"Exception thrown on Reconnect: {ex.Message}", ex); } _logger.LogInformation($"Disconnected from {_serverUrl}."); diff --git a/Program.cs b/Program.cs index ba12e75..12487f5 100644 --- a/Program.cs +++ b/Program.cs @@ -90,17 +90,6 @@ static void Main(string[] args) _logger.LogInformation("Starting FSMosquitoClient..."); - // Ensure that SimConnect.dll exists in the current folder. - if (!File.Exists("./SimConnect.dll")) - { - _logger.LogInformation("SimConnect.dll did not exist. Adding SimConnect.dll from resource."); - File.WriteAllBytes("./SimConnect.dll", Resources.SimConnect); - } - else - { - _logger.LogInformation("SimConnect.dll already exists. Continuing."); - } - Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs index 81b1b34..61a558b 100644 --- a/Properties/Resources.Designer.cs +++ b/Properties/Resources.Designer.cs @@ -69,15 +69,5 @@ internal static System.Drawing.Bitmap mosquito { return ((System.Drawing.Bitmap)(obj)); } } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] SimConnect { - get { - object obj = ResourceManager.GetObject("SimConnect", resourceCulture); - return ((byte[])(obj)); - } - } } } diff --git a/Properties/Resources.resx b/Properties/Resources.resx index 3fe5b80..555a75b 100644 --- a/Properties/Resources.resx +++ b/Properties/Resources.resx @@ -121,7 +121,4 @@ ..\Images\mosquito.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\lib\SimConnect.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - \ No newline at end of file diff --git a/appsettings.json b/appsettings.json index 45c035d..bc4725d 100644 --- a/appsettings.json +++ b/appsettings.json @@ -1,6 +1,6 @@ { + "fs_mosquito_serverurl": "wss://localhost:8443/mqtt/ws", "fs_mosquito_clientid": "some_pilot", - "fs_mosquito_serverurl": "ws://localhost:8080/mqtt/ws", "fs_mosquito_username": "guest", "fs_mosquito_password": "guest" } \ No newline at end of file