wwwroot folder is cached on first run and used everytime regardless of changes & Full Build Not working - Windows 10 #171

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

Originally created by @GammaSoul on GitHub (May 31, 2018).

Originally assigned to: @GregorBiswanger on GitHub.

Hi I’ve been preparing to build an application with electron and have only truly got into it today after spending three months learning VueJs inside out.
I also upgraded my windows 10 machine last week to the latest 1803 release.
im also using Visual Studio 2017 Community 15.6.4
But when I create a new project and put my VueJS dist/build.js folder/javascript in the wwwroot folder and run "dot net electron start" the javascript VueJs application will work very well in the electron application.
the problem is when I change the vuejs distribution file in wwwroot. the old one is cached some were in the electron.net build system on the first run and it won’t update to reflect the new javascript file eveytime i subsequently use "dot net electron start".
the other problem is that it won’t do a full build at all when I do "dotnet electronize build /target win" and I get the following error:

$ dotnet electronize build /target win
Build Electron Application...

Unhandled Exception: System.AggregateException: One or more errors occurred. (The given key was not present in the dictionary.) ---> System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at ElectronNET.CLI.Commands.BuildCommand.<ExecuteAsync>b__13_0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at ElectronNET.CLI.Program.Main(String[] args)
Originally created by @GammaSoul on GitHub (May 31, 2018). Originally assigned to: @GregorBiswanger on GitHub. Hi I’ve been preparing to build an application with electron and have only truly got into it today after spending three months learning VueJs inside out. I also upgraded my windows 10 machine last week to the latest 1803 release. im also using Visual Studio 2017 Community 15.6.4 But when I create a new project and put my VueJS dist/build.js folder/javascript in the wwwroot folder and run "dot net electron start" the javascript VueJs application will work very well in the electron application. the problem is when I change the vuejs distribution file in wwwroot. the old one is cached some were in the electron.net build system on the first run and it won’t update to reflect the new javascript file eveytime i subsequently use "dot net electron start". the other problem is that it won’t do a full build at all when I do "dotnet electronize build /target win" and I get the following error: ``` $ dotnet electronize build /target win Build Electron Application... Unhandled Exception: System.AggregateException: One or more errors occurred. (The given key was not present in the dictionary.) ---> System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at System.ThrowHelper.ThrowKeyNotFoundException() at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at ElectronNET.CLI.Commands.BuildCommand.<ExecuteAsync>b__13_0() at System.Threading.Tasks.Task`1.InnerInvoke() at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot) --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) at ElectronNET.CLI.Program.Main(String[] args) ```
Author
Owner

@robertmuehsig commented on GitHub (Jun 1, 2018):

Are you using the latest Electron.NET CLI version?

@robertmuehsig commented on GitHub (Jun 1, 2018): Are you using the latest Electron.NET CLI version?
Author
Owner

@GammaSoul commented on GitHub (Jun 1, 2018):

Hi Robertmuehsig im just doing eactly what is on the current Readme.md on the main page of Electron.Net git hub project and including:

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

as explained to (in the project file - .csproj) right there. i have created many new projects exactly as is told to do but i always get these same problems........

@GammaSoul commented on GitHub (Jun 1, 2018): Hi Robertmuehsig im just doing eactly what is on the current Readme.md on the main page of Electron.Net git hub project and including: ``` <ItemGroup> <DotNetCliToolReference Include="ElectronNET.CLI" Version="0.0.9" /> </ItemGroup> ``` as explained to (in the project file - .csproj) right there. i have created many new projects exactly as is told to do but i always get these same problems........
Author
Owner

@GammaSoul commented on GitHub (Jun 3, 2018):

Hi just to let you know but this same problem is happening on my home computer which is also running a two week old fresh install of windows 10 1803 release.... i don’t know but maybe its the new windows 10 - 1803 feature update that came out on April /17/18...............
One other thing is I think the problem with the wwwroot is that if the name of the file is the same then it caches it and uses the original file regardless of changes within the file. it also caches that same file to use on a separate project if that project has the same named file and folder structure in the wwwroot folder. When I change the name of the file then it will changes to the new file.

@GammaSoul commented on GitHub (Jun 3, 2018): Hi just to let you know but this same problem is happening on my home computer which is also running a two week old fresh install of windows 10 1803 release.... i don’t know but maybe its the new windows 10 - 1803 feature update that came out on April /17/18............... One other thing is I think the problem with the wwwroot is that if the name of the file is the same then it caches it and uses the original file regardless of changes within the file. it also caches that same file to use on a separate project if that project has the same named file and folder structure in the wwwroot folder. When I change the name of the file then it will changes to the new file.
Author
Owner

@paulov-t commented on GitHub (Jun 9, 2018):

Hi. This is happening with our team project too.

@paulov-t commented on GitHub (Jun 9, 2018): Hi. This is happening with our team project too.
Author
Owner

@Alekaei commented on GitHub (Jun 16, 2018):

yeah its a big problem for me too, need some solution if i wish to continue with Electron.NET

@Alekaei commented on GitHub (Jun 16, 2018): yeah its a big problem for me too, need some solution if i wish to continue with Electron.NET
Author
Owner

@EldinZenderink commented on GitHub (Jul 16, 2018):

Same, here, really annoying.

I found deleting the Electron directory generated by Electron (Path: C:\Users\<user>\AppData\Roaming\Electron) fixed it.

So if you want to continue using this, here is a quick and dirty hack (not sure if it works for everyone, and you will loose all sessions and all things related to the electron directory):

Create a bat file with the following line:

rmdir /S /Q "%appdata%/Electron" & dotnet electronize start

Save it in your project directory where you normally execute the dotnet electronize start command.

Go to visual studio and open the project settings, and do something along this line:

This is definitely not how it should be, and I hope this will eventually be fixed, but for now, this works for me.

@EldinZenderink commented on GitHub (Jul 16, 2018): Same, here, really annoying. I found deleting the Electron directory generated by Electron (Path: `C:\Users\<user>\AppData\Roaming\Electron`) fixed it. So if you want to continue using this, here is a quick and dirty hack (not sure if it works for everyone, and you will loose all sessions and all things related to the electron directory): Create a bat file with the following line: `rmdir /S /Q "%appdata%/Electron" & dotnet electronize start` Save it in your project directory where you normally execute the `dotnet electronize start` command. Go to visual studio and open the project settings, and do something along this line: ![](https://i.imgur.com/mow6m1e.png) This is definitely not how it should be, and I hope this will eventually be fixed, but for now, this works for me.
Author
Owner

@rexyque commented on GitHub (Aug 28, 2018):

I am having the same issue, and deleting the Electron directory EldinZenderink mentioned did not work for me. I decided to try changing the path to the actual files, so I changed my 'wwwroot/lib' folder to 'wwwroot/libs' and now everything works perfectly. Is there directory other than the one EldinZenderink mentioned that could be storing the cached files? Because the path name change is an even dirtier work around than deleting the cache, lmao.

@rexyque commented on GitHub (Aug 28, 2018): I am having the same issue, and deleting the Electron directory EldinZenderink mentioned did not work for me. I decided to try changing the path to the actual files, so I changed my 'wwwroot/lib' folder to 'wwwroot/libs' and now everything works perfectly. Is there directory other than the one EldinZenderink mentioned that could be storing the cached files? Because the path name change is an even dirtier work around than deleting the cache, lmao.
Author
Owner

@GregorBiswanger commented on GitHub (Sep 26, 2018):

@rexyque we can implement the native electron feature browserWindow.webContents.session.clearCache()

is that an alternative for you? PR are always welcome :)

@GregorBiswanger commented on GitHub (Sep 26, 2018): @rexyque we can implement the native electron feature **browserWindow.webContents.session.clearCache()** is that an alternative for you? PR are always welcome :)
Author
Owner

@GregorBiswanger commented on GitHub (May 22, 2019):

implemented in the new Electron version 5.22.12:

browserWindow.WebContents.Session.ClearCacheAsync();

@GregorBiswanger commented on GitHub (May 22, 2019): implemented in the new Electron version 5.22.12: `browserWindow.WebContents.Session.ClearCacheAsync();`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#171