Electronize Init SHOULD NOT depend on visual Studio file #45

Closed
opened 2026-01-29 16:28:32 +00:00 by claunia · 13 comments
Owner

Originally created by @tebeco on GitHub (Nov 3, 2017).

Originally assigned to: @robertmuehsig on GitHub.

So i followed the step but never open Visual Studio, Only CLI and VsCode

Repro step :

$/> mkdir PocElectronNet
$/> dotnet new sln PocElectronNet
$/> cd PocElectronNet
$/PocElectronNet> mkdir src
$/PocElectronNet> cd src
$/PocElectronNet/src> mkdir PocElectronNet
$/PocElectronNet/src>cd PocElectronNet
$/PocElectronNet/src/PocElectronNet>dotnet new mvc
$/PocElectronNet/src/PocElectronNet>dotnet sln ..\..\PocElectronNet.sln add PocElectronNet.csproj
  • Edited Program.cs
  • Edited Startup.cs
  • Edited csproj
$/PocElectronNet/src/PocElectronNet>dotnet restore
$/PocElectronNet/src/PocElectronNet>dotnet electronize init

Adding our config file to your project...
Search your .csproj to add the needed electron.manifest.json...
Found your .csproj: C:\Workspace\GitHub\TeBeCo\PocElectronNet\src\PocElectronNet\PocElectronNet.csproj - check for existing config or update it.
electron.manifest.json will be added to csproj.
electron.manifest.json added in csproj!
Search your .launchSettings to add our electron debug profile...

Unhandled Exception: System.AggregateException: One or more errors occurred. (Could not find a part of the path '$\PocElectronNet\src\PocElectronNet\Properties\launchSettings.json'.) ---> System.IO.DirectoryNotFoundException: Could not find a part of the path '$\PocElectronNet\src\PocElectronNet\Properties\launchSettings.json'.

the file not found is a file specific to Visual Studio (used by the Configuration ComboBox) allowing user to choose between IIS or Console etc ...
It the goal of Electron is to be XPlat, and Electron.Net too, that might be a got idea to get rid of dependencies over Visual Studio generated file right ?

Originally created by @tebeco on GitHub (Nov 3, 2017). Originally assigned to: @robertmuehsig on GitHub. So i followed the step but never open Visual Studio, Only CLI and VsCode Repro step : ``` $/> mkdir PocElectronNet $/> dotnet new sln PocElectronNet $/> cd PocElectronNet $/PocElectronNet> mkdir src $/PocElectronNet> cd src $/PocElectronNet/src> mkdir PocElectronNet $/PocElectronNet/src>cd PocElectronNet $/PocElectronNet/src/PocElectronNet>dotnet new mvc $/PocElectronNet/src/PocElectronNet>dotnet sln ..\..\PocElectronNet.sln add PocElectronNet.csproj ``` * Edited `Program.cs` * Edited `Startup.cs` * Edited `csproj` ``` $/PocElectronNet/src/PocElectronNet>dotnet restore $/PocElectronNet/src/PocElectronNet>dotnet electronize init Adding our config file to your project... Search your .csproj to add the needed electron.manifest.json... Found your .csproj: C:\Workspace\GitHub\TeBeCo\PocElectronNet\src\PocElectronNet\PocElectronNet.csproj - check for existing config or update it. electron.manifest.json will be added to csproj. electron.manifest.json added in csproj! Search your .launchSettings to add our electron debug profile... Unhandled Exception: System.AggregateException: One or more errors occurred. (Could not find a part of the path '$\PocElectronNet\src\PocElectronNet\Properties\launchSettings.json'.) ---> System.IO.DirectoryNotFoundException: Could not find a part of the path '$\PocElectronNet\src\PocElectronNet\Properties\launchSettings.json'. ``` the file not found is a file specific to Visual Studio (used by the Configuration ComboBox) allowing user to choose between IIS or Console etc ... It the goal of Electron is to be XPlat, and Electron.Net too, that might be a got idea to get rid of dependencies over Visual Studio generated file right ?
claunia added the bug label 2026-01-29 16:28:32 +00:00
Author
Owner

@tebeco commented on GitHub (Nov 3, 2017):

As i saw from this code :

https://github.com/ElectronNET/Electron.NET/blob/master/ElectronNET.CLI/Commands/InitCommand.cs#L78
https://github.com/ElectronNET/Electron.NET/blob/master/ElectronNET.CLI/Commands/InitCommand.cs#L93-L109

  • Create the file if it does not exists ;) ?
  • Add a method for editing VsCode launch files
  • Ignore the step but not throw ?
@tebeco commented on GitHub (Nov 3, 2017): As i saw from this code : https://github.com/ElectronNET/Electron.NET/blob/master/ElectronNET.CLI/Commands/InitCommand.cs#L78 https://github.com/ElectronNET/Electron.NET/blob/master/ElectronNET.CLI/Commands/InitCommand.cs#L93-L109 * Create the file if it does not exists ;) ? * Add a method for editing VsCode launch files * Ignore the step but not throw ?
Author
Owner

@robertmuehsig commented on GitHub (Nov 3, 2017):

Ah - good catch! Sorry - I thought this file was present even when init it without Visual Studio.

First step would be to check if the file does exists do the manipulation - if not, do nothing.

As a second step I could do the same with the VSCode launch file - but because of the nature of VSCode this might be not super important.

@robertmuehsig commented on GitHub (Nov 3, 2017): Ah - good catch! Sorry - I thought this file was present even when init it without Visual Studio. First step would be to check if the file does exists do the manipulation - if not, do nothing. As a second step I could do the same with the VSCode launch file - but because of the nature of VSCode this might be not super important.
Author
Owner

@robertmuehsig commented on GitHub (Nov 3, 2017):

As a workaround you might create a launchSettings.json file yourself. The code is pretty stupid TBH ;)

@robertmuehsig commented on GitHub (Nov 3, 2017): As a workaround you might create a launchSettings.json file yourself. The code is pretty stupid TBH ;)
Author
Owner

@andymac4182 commented on GitHub (Nov 4, 2017):

It would be good if it created a launchSettings.json file so you can open it in VS later and the same debug experience will work.

@andymac4182 commented on GitHub (Nov 4, 2017): It would be good if it created a `launchSettings.json` file so you can open it in VS later and the same debug experience will work.
Author
Owner

@Petermarcu commented on GitHub (Nov 4, 2017):

I just hit this too.

@Petermarcu commented on GitHub (Nov 4, 2017): I just hit this too.
Author
Owner

@Petermarcu commented on GitHub (Nov 4, 2017):

I opened an issue against ASP.NET as well to make it so the templates create the same assets whether through VS or CLI. https://github.com/aspnet/templating/issues/142

@Petermarcu commented on GitHub (Nov 4, 2017): I opened an issue against ASP.NET as well to make it so the templates create the same assets whether through VS or CLI. https://github.com/aspnet/templating/issues/142
Author
Owner

@Petermarcu commented on GitHub (Nov 4, 2017):

After creating launchSettings.json and then cleaning out the project entry and manifest from the initial failed run of electronize init I am past this. Here is the initial launchSettings.json in case anyone wants to copy paste.

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:54587/",
      "sslPort": 0
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "WebApplication1": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "http://localhost:54588/"
    }
  }
}
@Petermarcu commented on GitHub (Nov 4, 2017): After creating launchSettings.json and then cleaning out the project entry and manifest from the initial failed run of `electronize init` I am past this. Here is the initial launchSettings.json in case anyone wants to copy paste. ``` { "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:54587/", "sslPort": 0 } }, "profiles": { "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "WebApplication1": { "commandName": "Project", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, "applicationUrl": "http://localhost:54588/" } } } ```
Author
Owner

@tebeco commented on GitHub (Nov 4, 2017):

dunno when i’ll have time to give it a shoot
if no file ?

  • electron profile only
  • vs2017 like + électron (maybe harder)
@tebeco commented on GitHub (Nov 4, 2017): dunno when i’ll have time to give it a shoot if no file ? * electron profile only * vs2017 like + électron (maybe harder)
Author
Owner

@robertmuehsig commented on GitHub (Nov 4, 2017):

I'm on it 👍

@robertmuehsig commented on GitHub (Nov 4, 2017): I'm on it 👍
Author
Owner

@robertmuehsig commented on GitHub (Nov 4, 2017):

As a first step: If launchSetting is not present, do nothing. I'm not sure if it is clever to create the whole file.

@robertmuehsig commented on GitHub (Nov 4, 2017): As a first step: If launchSetting is not present, do nothing. I'm not sure if it is clever to create the whole file.
Author
Owner

@robertmuehsig commented on GitHub (Nov 4, 2017):

The fix will be part of 0.0.6. Current approach is: We only edit the file if it is present, because creating the file itself might result in strange issues as well.

@robertmuehsig commented on GitHub (Nov 4, 2017): The fix will be part of 0.0.6. Current approach is: We only edit the file if it is present, because creating the file itself might result in strange issues as well.
Author
Owner

@robertmuehsig commented on GitHub (Nov 5, 2017):

I released Version 0.0.6.

@robertmuehsig commented on GitHub (Nov 5, 2017): I released Version 0.0.6.
Author
Owner

@tebeco commented on GitHub (Nov 14, 2017):

https://github.com/aspnet/docs/issues/4021#issuecomment-342325746

is it interessting ?

@tebeco commented on GitHub (Nov 14, 2017): https://github.com/aspnet/docs/issues/4021#issuecomment-342325746 is it interessting ?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#45