Build instructions in readme.md are complicated and don't work -- please provide a VS project template.
See original GitHub issueUsing VS 2017 15.6.4, I created a new .NET Core MVC app.
I followed build instructions up to the ElectronNET.CLI
nuget package part (which is super ambiguous).
I added the DotNetCliToolReference
to my .csproj like so (it didn’t say to remove the other ones, so I left them alone):
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ElectronNET.API" Version="0.0.9" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.3" />
<DotNetCliToolReference Include="ElectronNET.CLI" Version="0.0.9" />
</ItemGroup>
</Project>
dotnet restore
did not add the CLI package that I just added.
and manually calling Install-Package ElectronNET.CLI -Version 0.0.9
fails because it’s not compatible with this project type:
Install-Package : Package 'ElectronNET.CLI 0.0.9' has a package type 'DotnetCliTool' that is not supported by project 'ElectronTest'.
(Also requiring folks to hand edit a .csproj is kind of wacky – please just provide a visual studio template.)
Trying to run the project, it opens a chrome web browser up to the site (not an electron window).
Further details, program.cs
:
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args)
{
return WebHost.CreateDefaultBuilder(args)
.UseElectron(args)
.UseStartup<Startup>()
.Build();
}
}
startup.cs
:
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the
// container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}
// This method gets called by the runtime. Use this method to configure the HTTP
// request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
// Open the Electron-Window here
Task.Run(async () => await Electron.WindowManager.CreateWindowAsync());
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (1 by maintainers)
Top GitHub Comments
We updated the readme.
The DotNetCliToolReference is “old” - the new style requires to install it as a global tool:
After that you should be able to invoke like this (in the same folder as the .csproj file)
Hope this helps!
@robertmuehsig This should be on your main documentation (if you can call a readme main documentation), I just had and same thing and came to this issue after a Google search - Everyone who uses Electron.NET is going to have the same issue