manage the configuration environment with the electron.manifest.json

This commit is contained in:
Gregor Biswanger
2020-05-26 22:03:05 +02:00
parent 2b415e5b59
commit 029b077602
6 changed files with 19 additions and 10 deletions

View File

@@ -5,6 +5,7 @@
ElectronNET.CLI:
* New Feature: Added config parameter (thanks [konstantingross](https://github.com/konstantingross)) [\#409](https://github.com/ElectronNET/Electron.NET/pull/409)
* New Feature: Set the configuration environment with the electron.manifest.json file.
* Fixed bug: Custom user path removed and replaced by the correct directory with VS macro (When ElectronNET.CLI is the Startup Project, press F5 (Debug) and the ElectronNET.WebApp starts correctly without error!) (thanks [konstantingross](https://github.com/konstantingross)) [\#409](https://github.com/ElectronNET/Electron.NET/pull/409)
ElectronNET.API:
@@ -16,6 +17,7 @@ ElectronNET.API:
* App-Api Enhancement: MenuItems with Submenus need an submenu type workaround [\#412](https://github.com/ElectronNET/Electron.NET/issues/412)
* App-Api Enhancement: Added UserAgentFallback (thanks [Mandrakia](https://github.com/Mandrakia)) [\#406](https://github.com/ElectronNET/Electron.NET/pull/406)
* App-Api Enhancement: New App.IsReady property and App.Ready event (thanks [konstantingross](https://github.com/konstantingross)) [\#415](https://github.com/ElectronNET/Electron.NET/pull/415)
* Shell-Api Enhancement: Shell.OpenItem API fix for Electron 9.0.0 (thanks [konstantingross](https://github.com/konstantingross)) [\#417](https://github.com/ElectronNET/Electron.NET/pull/417)
* Notification-Api Enhancement: Added missing properties in Notifications (thanks [konstantingross](https://github.com/konstantingross)) [\#410](https://github.com/ElectronNET/Electron.NET/pull/410)
* BrowserWindows-Api Enhancement: Add missing API call for SetProgressBar options (thanks [konstantingross](https://github.com/konstantingross)) [\#416](https://github.com/ElectronNET/Electron.NET/pull/416)
* MacOS Enhancement: Application exit logic (thanks [dafergu2](https://github.com/dafergu2)) [\#405](https://github.com/ElectronNET/Electron.NET/pull/405)

View File

@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using ElectronNET.CLI.Commands.Actions;
@@ -106,7 +105,7 @@ namespace ElectronNET.CLI.Commands
publishReadyToRun += "true";
}
var resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} -c {configuration} --output \"{tempBinPath}\" {publishReadyToRun} --self-contained", Directory.GetCurrentDirectory());
var resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} -c \"{configuration}\" --output \"{tempBinPath}\" {publishReadyToRun} --self-contained", Directory.GetCurrentDirectory());
if (resultCode != 0)
{

View File

@@ -74,7 +74,7 @@ namespace ElectronNET.CLI.Commands
publishReadyToRun += "true";
}
string configuration = "Release";
string configuration = "Debug";
if (parser.Arguments.ContainsKey(_paramDotNetConfig))
{
configuration = parser.Arguments[_paramDotNetConfig][0];
@@ -82,7 +82,7 @@ namespace ElectronNET.CLI.Commands
if (parser != null && !parser.Arguments.ContainsKey("watch"))
{
resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} -c {configuration} --output \"{tempBinPath}\" {publishReadyToRun} --no-self-contained", aspCoreProjectPath);
resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} -c \"{configuration}\" --output \"{tempBinPath}\" {publishReadyToRun} --no-self-contained", aspCoreProjectPath);
}
if (resultCode != 0)
@@ -156,7 +156,5 @@ namespace ElectronNET.CLI.Commands
return true;
});
}
}
}

View File

@@ -6,6 +6,7 @@
"name": "{{executable}}",
"author": "",
"singleInstance": false,
"environment": "Production",
"build": {
"appId": "com.{{executable}}.app",
"productName": "{{executable}}",
@@ -19,14 +20,14 @@
{
"from": "./bin",
"to": "bin",
"filter": ["**/*"]
"filter": [ "**/*" ]
}
],
"files": [
{
"from": "./ElectronHostHook/node_modules",
"to": "ElectronHostHook/node_modules",
"filter": ["**/*"]
"filter": [ "**/*" ]
},
"**/*"
]

View File

@@ -219,7 +219,7 @@ function startAspCoreBackend(electronPort) {
function startBackend(aspCoreBackendPort) {
console.log('ASP.NET Core Port: ' + aspCoreBackendPort);
loadURL = `http://localhost:${aspCoreBackendPort}`;
const parameters = [`/electronPort=${electronPort}`, `/electronWebPort=${aspCoreBackendPort}`];
const parameters = [getEnvironmentParameter(), `/electronPort=${electronPort}`, `/electronWebPort=${aspCoreBackendPort}`];
let binaryFile = manifestJsonFile.executable;
const os = require('os');
@@ -250,7 +250,7 @@ function startAspCoreBackendWithWatch(electronPort) {
function startBackend(aspCoreBackendPort) {
console.log('ASP.NET Core Watch Port: ' + aspCoreBackendPort);
loadURL = `http://localhost:${aspCoreBackendPort}`;
const parameters = ['watch', 'run', `/electronPort=${electronPort}`, `/electronWebPort=${aspCoreBackendPort}`];
const parameters = ['watch', 'run', getEnvironmentParameter(), `/electronPort=${electronPort}`, `/electronWebPort=${aspCoreBackendPort}`];
var options = {
cwd: currentBinPath,
@@ -262,4 +262,12 @@ function startAspCoreBackendWithWatch(electronPort) {
console.log(`stdout: ${data.toString()}`);
});
}
}
function getEnvironmentParameter() {
if(manifestJsonFile.environment) {
return '--environment=' + manifestJsonFile.environment;
}
return '';
}

View File

@@ -3,6 +3,7 @@
"splashscreen": {
"imageFile": "/wwwroot/assets/img/about@2x.png"
},
"environment": "Production",
"singleInstance": false,
"build": {
"appId": "com.electronnetapidemos.app",