2

I have been following the instructions on the Electron.NET Github page https://github.com/ElectronNET/Electron.NET and I have been running into an issue. When I have run the commands in VS Code the Electron code still is not recognised. E.g.

public static IWebHost BuildWebHost(string[] args) =>
    WebHost.CreateDefaultBuilder(args)
        .UseElectron(args)
        .UseStartup<Startup>()
        .Build();

When using this snippit of code my IDE doesn't recognise the .UseElectron(args) part of the code

Is there something I am doing wrong or a step I have missed? I made sure to run the following commands

dotnet new mvc
dotnet add package ElectronNet.API

and changing the .csproj file to include

<ItemGroup>
 <DotNetCliToolReference Include="ElectronNET.CLI" Version="0.0.9" />
</ItemGroup>

and running dotnet restore. If there is any way of figuring out what step I have missed out please let me know.

Camilo Terevinto
  • 26,697
  • 6
  • 67
  • 99
  • 2
    You are missing a `using ElectronNET.API;` at the top of the file – Camilo Terevinto Aug 02 '18 at 13:58
  • This is basic C# - you can't use an [extension method](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/extension-methods) as an extension method if you haven't imported the namespace via a `using` statement. – mason Aug 02 '18 at 13:59
  • Yeah, that's solved it. Thank you – Josh Whittle Aug 02 '18 at 14:04

0 Answers0