Skip to content

Commit b69d4d2

Browse files
Merge pull request #313 from ElectronNET/netcore30
Update to .NET Core 3.0
2 parents af74d24 + 239d914 commit b69d4d2

20 files changed

+74
-79
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
language: csharp
22
mono: none
33
dist: xenial
4-
dotnet: 2.2
4+
dotnet: 3.0
55
before_script:
66
- export PATH="$PATH:/home/travis/.dotnet/tools"
7-
- npm install electron-packager --global
87
script:
98
- ./buildAll.sh

ElectronNET.API/ElectronNET.API.csproj

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.2</TargetFramework>
4+
<TargetFramework>netcoreapp3.0</TargetFramework>
55
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
66
<PackageOutputPath>..\artifacts</PackageOutputPath>
77
<PackageId>ElectronNET.API</PackageId>
@@ -17,32 +17,38 @@ This package contains the API to access the "native" electron API.</Description>
1717
<PublishRepositoryUrl>true</PublishRepositoryUrl>
1818
<PackageTags>electron aspnetcore</PackageTags>
1919
<PackageReleaseNotes>Changelog: https://github.com/ElectronNET/Electron.NET/blob/master/Changelog.md</PackageReleaseNotes>
20-
<PackageIconUrl>https://raw.githubusercontent.com/ElectronNET/Electron.NET/master/assets/images/electron.net-logo-square.png</PackageIconUrl>
21-
<Version>1.0.0.0</Version>
20+
<PackageIcon>PackageIcon.png</PackageIcon>
21+
<Version>99.0.0.0</Version>
2222
</PropertyGroup>
2323

2424
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
2525
<DocumentationFile>bin\Debug\netcoreapp2.0\ElectronNET.API.xml</DocumentationFile>
2626
</PropertyGroup>
2727

2828
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
29-
<DocumentationFile>bin\Release\netcoreapp2.0\ElectronNET.API.xml</DocumentationFile>
29+
<DocumentationFile>bin\Release\netcoreapp3.0\ElectronNET.API.xml</DocumentationFile>
3030
</PropertyGroup>
3131

3232
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
33-
<DocumentationFile>bin\Debug\netcoreapp2.0\ElectronNET.API.xml</DocumentationFile>
33+
<DocumentationFile>bin\Debug\netcoreapp3.0\ElectronNET.API.xml</DocumentationFile>
3434
<Optimize>true</Optimize>
3535
</PropertyGroup>
3636

37+
<ItemGroup>
38+
<None Include="PackageIcon.png" Pack="true" PackagePath="\" />
39+
</ItemGroup>
40+
3741
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(OS)' == 'Windows_NT'">
3842
<Exec Command="$(ProjectDir)devCleanup.cmd" IgnoreExitCode="true" />
3943
</Target>
4044
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(OS)' != 'Windows_NT'">
4145
<Exec Command="$(ProjectDir)devCleanup.sh" IgnoreExitCode="true" />
4246
</Target>
4347
<ItemGroup>
44-
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.1.1" />
45-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05">
48+
<FrameworkReference Include="Microsoft.AspNetCore.App" />
49+
</ItemGroup>
50+
<ItemGroup>
51+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-19367-01">
4652
<PrivateAssets>all</PrivateAssets>
4753
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
4854
</PackageReference>

ElectronNET.API/PackageIcon.png

38.5 KB
Loading

ElectronNET.CLI/Commands/AddCommand.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ public Task<bool> ExecuteAsync()
7272
ProcessHelper.CmdExecute("npm install", targetFilePath);
7373

7474
// run typescript compiler
75-
string tscPath = Path.Combine(targetFilePath, "node_modules", ".bin");
7675
// ToDo: Not sure if this runs under linux/macos
77-
ProcessHelper.CmdExecute(@"tsc -p ../../", tscPath);
76+
ProcessHelper.CmdExecute(@"npx tsc -p ../../", targetFilePath);
7877

7978
// search .csproj
8079
Console.WriteLine($"Search your .csproj to add configure CopyToPublishDirectory to 'Never'");

ElectronNET.CLI/Commands/BuildCommand.cs

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -105,21 +105,6 @@ public Task<bool> ExecuteAsync()
105105
Console.WriteLine("Start npm install...");
106106
ProcessHelper.CmdExecute("npm install --production", tempPath);
107107

108-
Console.WriteLine("Start npm install electron-builder...");
109-
110-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
111-
112-
{
113-
// Works proper on Windows...
114-
ProcessHelper.CmdExecute("npm install electron-builder --global", tempPath);
115-
}
116-
else
117-
{
118-
// ToDo: find another solution or document it proper
119-
// GH Issue https://github.com/electron-userland/electron-prebuilt/issues/48
120-
Console.WriteLine("Electron Builder - make sure you invoke 'sudo npm install electron-builder --global' at " + tempPath + " manually. Sry.");
121-
}
122-
123108
Console.WriteLine("ElectronHostHook handling started...");
124109

125110
string electronhosthookDir = Path.Combine(Directory.GetCurrentDirectory(), "ElectronHostHook");
@@ -130,13 +115,10 @@ public Task<bool> ExecuteAsync()
130115
DirectoryCopy.Do(electronhosthookDir, hosthookDir, true, new List<string>() { "node_modules" });
131116

132117
Console.WriteLine("Start npm install for hosthooks...");
133-
ProcessHelper.CmdExecute("npm install --production", hosthookDir);
118+
ProcessHelper.CmdExecute("npm install", hosthookDir);
134119

135-
// ToDo: Global TypeScript installation is needed for ElectronHostHook
136-
//string tscPath = Path.Combine(tempPath, "node_modules", ".bin");
137-
138120
// ToDo: Not sure if this runs under linux/macos
139-
ProcessHelper.CmdExecute(@"tsc -p . --sourceMap false", hosthookDir);
121+
ProcessHelper.CmdExecute(@"npx tsc -p . --sourceMap false", hosthookDir);
140122
}
141123

142124
Console.WriteLine("Build Electron Desktop Application...");
@@ -171,7 +153,7 @@ public Task<bool> ExecuteAsync()
171153
ProcessHelper.CmdExecute($"node build-helper.js", tempPath);
172154

173155
Console.WriteLine($"Package Electron App for Platform {platformInfo.ElectronPackerPlatform}...");
174-
ProcessHelper.CmdExecute($"electron-builder . --config=./bin/electron-builder.json --{platformInfo.ElectronPackerPlatform} --{electronArch} -c.electronVersion=5.0.8 {electronParams}", tempPath);
156+
ProcessHelper.CmdExecute($"npx electron-builder . --config=./bin/electron-builder.json --{platformInfo.ElectronPackerPlatform} --{electronArch} -c.electronVersion=5.0.8 {electronParams}", tempPath);
175157

176158
Console.WriteLine("... done");
177159

ElectronNET.CLI/Commands/StartElectronCommand.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,11 @@ public Task<bool> ExecuteAsync()
7676
string hosthookDir = Path.Combine(tempPath, "ElectronHostHook");
7777
DirectoryCopy.Do(electronhosthookDir, hosthookDir, true, new List<string>() { "node_modules" });
7878

79-
Console.WriteLine("Start npm install for hosthooks...");
79+
Console.WriteLine("Start npm install for typescript & hosthooks...");
8080
ProcessHelper.CmdExecute("npm install", hosthookDir);
8181

82-
string tscPath = Path.Combine(tempPath, "node_modules", ".bin");
8382
// ToDo: Not sure if this runs under linux/macos
84-
ProcessHelper.CmdExecute(@"tsc -p ../../ElectronHostHook", tscPath);
83+
ProcessHelper.CmdExecute(@"npx tsc -p ../../ElectronHostHook", tempPath);
8584
}
8685

8786
string path = Path.Combine(tempPath, "node_modules", ".bin");

ElectronNET.CLI/ElectronNET.CLI.csproj

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp2.2</TargetFramework>
5+
<TargetFramework>netcoreapp3.0</TargetFramework>
66
<AssemblyName>electronize</AssemblyName>
77

88
<PackageType>DotnetCliTool</PackageType>
99
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1010
<PackageOutputPath>..\artifacts</PackageOutputPath>
1111
<PackageId>ElectronNET.CLI</PackageId>
12-
<Version>1.0.0.0</Version>
12+
<!-- Version 99 is just set for local development stuff to avoid a conflict with "real" packages on NuGet.org -->
13+
<Version>99.0.0.0</Version>
1314
<Authors>Gregor Biswanger, Robert Muehsig</Authors>
1415
<Product>Electron.NET</Product>
1516
<Company />
@@ -22,7 +23,7 @@ This package contains the dotnet tooling to electronize your application.</Descr
2223
<PublishRepositoryUrl>true</PublishRepositoryUrl>
2324
<PackageTags>electron aspnetcore</PackageTags>
2425
<PackageReleaseNotes>Changelog: https://github.com/ElectronNET/Electron.NET/blob/master/Changelog.md</PackageReleaseNotes>
25-
<PackageIconUrl>https://raw.githubusercontent.com/ElectronNET/Electron.NET/master/assets/images/electron.net-logo-square.png</PackageIconUrl>
26+
<PackageIcon>PackageIcon.png</PackageIcon>
2627
<PackAsTool>true</PackAsTool>
2728
</PropertyGroup>
2829

@@ -38,7 +39,11 @@ This package contains the dotnet tooling to electronize your application.</Descr
3839
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
3940
<DocumentationFile></DocumentationFile>
4041
</PropertyGroup>
41-
42+
43+
<ItemGroup>
44+
<None Include="PackageIcon.png" Pack="true" PackagePath="\"/>
45+
</ItemGroup>
46+
4247
<ItemGroup>
4348
<EmbeddedResource Include="..\ElectronNET.Host\electron.manifest.json" Link="ElectronHost\electron.manifest.json" />
4449
</ItemGroup>
@@ -96,7 +101,7 @@ This package contains the dotnet tooling to electronize your application.</Descr
96101
</ItemGroup>
97102

98103
<ItemGroup>
99-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05">
104+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-19367-01">
100105
<PrivateAssets>all</PrivateAssets>
101106
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
102107
</PackageReference>

ElectronNET.CLI/PackageIcon.png

38.5 KB
Loading

ElectronNET.WebApp/Controllers/TrayController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ namespace ElectronNET.WebApp.Controllers
88
{
99
public class TrayController : Controller
1010
{
11-
private readonly IHostingEnvironment _env;
11+
private readonly IWebHostEnvironment _env;
1212

13-
public TrayController(IHostingEnvironment env)
13+
public TrayController(IWebHostEnvironment env)
1414
{
1515
_env = env;
1616
}

ElectronNET.WebApp/ElectronHostHook/excelCreator.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ElectronNET.WebApp/ElectronHostHook/excelCreator.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ElectronNET.WebApp/ElectronHostHook/index.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ElectronNET.WebApp/ElectronHostHook/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ElectronNET.WebApp/ElectronNET.WebApp.csproj

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFramework>netcoreapp2.2</TargetFramework>
3+
<TargetFramework>netcoreapp3.0</TargetFramework>
4+
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
5+
<AspNetCoreModuleName>AspNetCoreModule</AspNetCoreModuleName>
46
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
5-
<TypeScriptToolsVersion>3.1</TypeScriptToolsVersion>
7+
<TypeScriptToolsVersion>3.6</TypeScriptToolsVersion>
68
</PropertyGroup>
79
<ItemGroup>
810
<Compile Remove="Controllers\ManageWindowsController.cs" />
@@ -14,11 +16,7 @@
1416
<Folder Include="wwwroot\assets\" />
1517
</ItemGroup>
1618
<ItemGroup>
17-
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
18-
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
19-
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
20-
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.0" />
21-
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" />
19+
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />
2220
</ItemGroup>
2321
<ItemGroup>
2422
<ProjectReference Include="..\ElectronNET.API\ElectronNET.API.csproj" />

ElectronNET.WebApp/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using ElectronNET.API;
22
using Microsoft.AspNetCore;
33
using Microsoft.AspNetCore.Hosting;
4+
using Microsoft.Extensions.Logging;
45

56
namespace ElectronNET.WebApp
67
{
@@ -14,6 +15,7 @@ public static void Main(string[] args)
1415
public static IWebHost BuildWebHost(string[] args)
1516
{
1617
return WebHost.CreateDefaultBuilder(args)
18+
.ConfigureLogging((hostingContext, logging) => { logging.AddConsole(); })
1719
.UseElectron(args)
1820
.UseStartup<Startup>()
1921
.Build();

ElectronNET.WebApp/Startup.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Microsoft.Extensions.Configuration;
66
using Microsoft.Extensions.DependencyInjection;
77
using Microsoft.Extensions.Logging;
8+
using Microsoft.Extensions.Hosting;
89

910
namespace ElectronNET.WebApp
1011
{
@@ -25,27 +26,23 @@ public void ConfigureServices(IServiceCollection services)
2526
}
2627

2728
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
28-
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
29+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
2930
{
30-
loggerFactory.AddConsole();
31-
3231
if (env.IsDevelopment())
3332
{
3433
app.UseDeveloperExceptionPage();
3534
}
3635

3736
app.UseStaticFiles();
3837

39-
app.UseMvc(routes =>
38+
app.UseRouting();
39+
40+
app.UseEndpoints(endpoints =>
4041
{
41-
routes.MapRoute(
42-
name: "default",
43-
template: "{controller=Home}/{action=Index}/{id?}");
42+
endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
4443
});
4544

46-
47-
48-
if(HybridSupport.IsElectronActive)
45+
if (HybridSupport.IsElectronActive)
4946
{
5047
ElectronBootstrap();
5148
}

0 commit comments

Comments
 (0)