Skip to content

Commit 43ce20d

Browse files
committed
Add ElectronNET.ConsoleApp test project
1 parent 40d6558 commit 43ce20d

File tree

10 files changed

+238
-0
lines changed

10 files changed

+238
-0
lines changed
273 KB
Binary file not shown.
1.25 KB
Loading
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<!-- When this is enabled, the project will be switched from nuget packages to consuming the ElectronNet orchestration directly -->
5+
<ElectronNetDevMode>False</ElectronNetDevMode>
6+
</PropertyGroup>
7+
8+
<Import Project="..\ElectronNET\build\ElectronNET.props" Condition="$(ElectronNetDevMode)" />
9+
10+
<PropertyGroup>
11+
<TargetFramework>net8.0</TargetFramework>
12+
<OutputType>exe</OutputType>
13+
</PropertyGroup>
14+
<PropertyGroup>
15+
<IsPackable>false</IsPackable>
16+
<ImportNuGetBuildTasksPackTargetsFromSdk>false</ImportNuGetBuildTasksPackTargetsFromSdk>
17+
<PublishTrimmed>False</PublishTrimmed>
18+
<NuGetAudit>False</NuGetAudit>
19+
</PropertyGroup>
20+
<PropertyGroup Label="ElectronNetCommon">
21+
<PackageIcon>128.png</PackageIcon>
22+
<ApplicationIcon>app.ico</ApplicationIcon>
23+
<NoWin32Manifest>true</NoWin32Manifest>
24+
<ElectronIcon>app.ico</ElectronIcon>
25+
<Title>ElectronNET API Demo1</Title>
26+
<Version>1.0.2</Version>
27+
<Product>com.electronnet-apisamples.app</Product>
28+
<Description>Electron.NET Demo Application</Description>
29+
<Company>Electron.Net</Company>
30+
<Copyright>Copyright © 2025, Electron.NET</Copyright>
31+
<PackageTags>Electron;.NET;ASP;NET;Sample;App</PackageTags>
32+
<ElectronVersion>30.4.0</ElectronVersion>
33+
<ElectronSplashScreen></ElectronSplashScreen>
34+
<License>MIT</License>
35+
<TypeScriptModuleKind>commonjs</TypeScriptModuleKind>
36+
<ElectronSingleInstance>False</ElectronSingleInstance>
37+
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
38+
</PropertyGroup>
39+
<ItemGroup>
40+
<Compile Remove="bin\**" />
41+
<Compile Remove="publish\**" />
42+
<Content Remove="publish\**" />
43+
<EmbeddedResource Remove="bin\**" />
44+
<EmbeddedResource Remove="publish\**" />
45+
<None Remove="bin\**" />
46+
<None Remove="publish\**" />
47+
</ItemGroup>
48+
<ItemGroup>
49+
<None Update="Assets\electron.ico">
50+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
51+
</None>
52+
<None Update="Assets\electron_32x32.png">
53+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
54+
</None>
55+
</ItemGroup>
56+
<ItemGroup>
57+
<Compile Remove="obj\**" />
58+
<Compile Remove="publish\**" />
59+
<Content Remove="publish\**" />
60+
<EmbeddedResource Remove="obj\**" />
61+
<EmbeddedResource Remove="publish\**" />
62+
<None Remove="obj\**" />
63+
<None Remove="publish\**" />
64+
<TypeScriptCompile Remove="bin\**" />
65+
<TypeScriptCompile Remove="obj\**" />
66+
</ItemGroup>
67+
68+
<ItemGroup>
69+
<ProjectReference Include="..\ElectronNET.API\ElectronNET.API.csproj" Condition="$(ElectronNetDevMode)" />
70+
</ItemGroup>
71+
<ItemGroup>
72+
<PackageReference Include="ElectronNET.Core" Version="0.0.18" Condition="'$(ElectronNetDevMode)' != 'True'" />
73+
</ItemGroup>
74+
75+
<Import Project="..\ElectronNET\build\ElectronNET.targets" Condition="$(ElectronNetDevMode)" />
76+
77+
</Project>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using ElectronNET.API;
2+
3+
namespace ElectronNET.WebApp
4+
{
5+
using System;
6+
using System.Threading.Tasks;
7+
using ElectronNET.API.Entities;
8+
9+
public class Program
10+
{
11+
public static async Task Main(string[] args)
12+
{
13+
var runtimeController = ElectronNetRuntime.RuntimeController;
14+
15+
try
16+
{
17+
await runtimeController.Start();
18+
19+
await runtimeController.WaitReadyTask;
20+
21+
await ElectronBootstrap();
22+
23+
await runtimeController.WaitStoppedTask;
24+
}
25+
catch (Exception ex)
26+
{
27+
Console.WriteLine(ex);
28+
await runtimeController.Stop().ConfigureAwait(false);
29+
30+
await runtimeController.WaitStoppedTask.WaitAsync(TimeSpan.FromSeconds(2)).ConfigureAwait(false);
31+
}
32+
}
33+
34+
public static async Task ElectronBootstrap()
35+
{
36+
//AddDevelopmentTests();
37+
38+
var browserWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions
39+
{
40+
Width = 1152,
41+
Height = 940,
42+
Show = false,
43+
}, "https://github.com/ElectronNET/Electron.NET");
44+
45+
await browserWindow.WebContents.Session.ClearCacheAsync();
46+
47+
browserWindow.OnReadyToShow += () => browserWindow.Show();
48+
}
49+
}
50+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
3+
<Project>
4+
<PropertyGroup>
5+
<Configuration>Release</Configuration>
6+
<Platform>Any CPU</Platform>
7+
<PublishDir>publish\Release\net8.0\linux-x64</PublishDir>
8+
<PublishProtocol>FileSystem</PublishProtocol>
9+
<_TargetId>Folder</_TargetId>
10+
<TargetFramework>net8.0</TargetFramework>
11+
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
12+
<SelfContained>false</SelfContained>
13+
<PublishSingleFile>false</PublishSingleFile>
14+
</PropertyGroup>
15+
</Project>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
https://go.microsoft.com/fwlink/?LinkID=208121.
4+
-->
5+
<Project>
6+
<PropertyGroup>
7+
<DeleteExistingFiles>true</DeleteExistingFiles>
8+
<ExcludeApp_Data>false</ExcludeApp_Data>
9+
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
10+
<LastUsedPlatform>Any CPU</LastUsedPlatform>
11+
<PublishProvider>FileSystem</PublishProvider>
12+
<PublishUrl>publish\Release\net8.0\win-x64\</PublishUrl>
13+
<WebPublishMethod>FileSystem</WebPublishMethod>
14+
<_TargetId>Folder</_TargetId>
15+
<TargetFramework>net8.0</TargetFramework>
16+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
17+
<SelfContained>true</SelfContained>
18+
</PropertyGroup>
19+
</Project>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
3+
<Project>
4+
<PropertyGroup>
5+
<Configuration>Release</Configuration>
6+
<Platform>Any CPU</Platform>
7+
<PublishDir>publish\Release\net8.0\win-x64</PublishDir>
8+
<PublishProtocol>FileSystem</PublishProtocol>
9+
<_TargetId>Folder</_TargetId>
10+
<TargetFramework>net8.0</TargetFramework>
11+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
12+
<SelfContained>false</SelfContained>
13+
<PublishSingleFile>false</PublishSingleFile>
14+
<PublishReadyToRun>false</PublishReadyToRun>
15+
</PropertyGroup>
16+
</Project>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/electron-userland/electron-builder/refs/heads/master/packages/app-builder-lib/scheme.json",
3+
"compression": "maximum",
4+
//"afterPack": "bin/Assets/afterPack.js",
5+
//"beforePack": "bin/Assets/beforePack.js",
6+
"buildNumber": "",
7+
"linux": {
8+
"target": [
9+
"tar.xz"
10+
//"AppImage",
11+
//"rpm",
12+
//"deb",
13+
//"pacman"
14+
],
15+
"executableArgs": [ "--no-sandbox" ],
16+
"icon": "bin/Assets/icon.png",
17+
"artifactName": "${name}-${arch}-${version}.${ext}"
18+
},
19+
"win": {
20+
"target": [
21+
{
22+
"target": "portable",
23+
"arch": "x64"
24+
}
25+
],
26+
"icon": "bin/Assets/icon.ico"
27+
},
28+
"mac": {
29+
"icon": "bin/Assets/icon.icns"
30+
}
31+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"profiles": {
3+
"DotNet (unpackaged)": {
4+
"commandName": "Project",
5+
"environmentVariables": {
6+
"ASPNETCORE_ENVIRONMENT": "Development"
7+
}
8+
},
9+
"Electron (unpackaged)": {
10+
"commandName": "Executable",
11+
"executablePath": "node",
12+
"commandLineArgs": "node_modules/electron/cli.js main.js -unpackedelectron",
13+
"workingDirectory": "$(TargetDir).electron",
14+
"environmentVariables": {
15+
"ASPNETCORE_ENVIRONMENT": "Development"
16+
}
17+
},
18+
"WSL": {
19+
"commandName": "WSL2",
20+
"environmentVariables": {
21+
"ASPNETCORE_ENVIRONMENT": "Development",
22+
"ASPNETCORE_URLS": "http://localhost:8001/"
23+
},
24+
"distributionName": ""
25+
},
26+
"Profile 1": {
27+
"commandName": "Project"
28+
}
29+
}
30+
}

src/ElectronNET.ConsoleApp/app.ico

158 KB
Binary file not shown.

0 commit comments

Comments
 (0)