.csproj Assets not copied to output in dev builds #86

Closed
opened 2026-01-29 16:30:20 +00:00 by claunia · 5 comments
Owner

Originally created by @yoDon on GitHub (Nov 28, 2017).

When doing full desktop builds, items listed in the .csproj as <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> are copied into the built app's folder hierarchy but when doing dev builds the developer needs to manually copy the files into the destination directory.

For example, if you've included files from the Assets folder in your .csproj, those files need to be copied into obj/Host/node_modules/electron/dist/resources/app/bin/Assets (on a PC) or obj/Host/node_modules/electron/dist/Electron.app/Contents/Resources/app/bin/Assets (on a Mac). I suspect the same issue is present on Linux machines and I'm guessing the destination path matches the PC path but I've not been able to confirm for Linux.

Originally created by @yoDon on GitHub (Nov 28, 2017). When doing full desktop builds, items listed in the .csproj as ```<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>``` are copied into the built app's folder hierarchy but when doing dev builds the developer needs to manually copy the files into the destination directory. For example, if you've included files from the Assets folder in your .csproj, those files need to be copied into ```obj/Host/node_modules/electron/dist/resources/app/bin/Assets``` (on a PC) or ```obj/Host/node_modules/electron/dist/Electron.app/Contents/Resources/app/bin/Assets``` (on a Mac). I suspect the same issue is present on Linux machines and I'm guessing the destination path matches the PC path but I've not been able to confirm for Linux.
Author
Owner

@jcphlux commented on GitHub (Dec 11, 2017):

you could setup webpack to copy the file for you.

@jcphlux commented on GitHub (Dec 11, 2017): you could setup webpack to copy the file for you.
Author
Owner

@yoDon commented on GitHub (Dec 11, 2017):

Unfortunately webpack can't see inside the .csproj file so it can't easily understand or correctly predict what assets need to be copied, making it viable as a hard-coded temporary workaround but definitely not a real solution (I've got a similar manual work-around I'm doing at the moment).

@yoDon commented on GitHub (Dec 11, 2017): Unfortunately webpack can't see inside the .csproj file so it can't easily understand or correctly predict what assets need to be copied, making it viable as a hard-coded temporary workaround but definitely not a real solution (I've got a similar manual work-around I'm doing at the moment).
Author
Owner

@jcphlux commented on GitHub (Dec 12, 2017):

but you can easily tell webpack to copy all files in Asset to the wwwroot and obj folder and that will get published

@jcphlux commented on GitHub (Dec 12, 2017): but you can easily tell webpack to copy all files in Asset to the wwwroot and obj folder and that will get published
Author
Owner

@GregorBiswanger commented on GitHub (Dec 18, 2017):

@yoDon Do you mean the "electronize start" command creates a different folder on other platforms?!
And the assets folder is not in the correct path?

@GregorBiswanger commented on GitHub (Dec 18, 2017): @yoDon Do you mean the "electronize start" command creates a different folder on other platforms?! And the assets folder is not in the correct path?
Author
Owner

@yoDon commented on GitHub (Dec 21, 2017):

@GregorBiswanger This is a dev vs. production build issue not an OS platform issue. Dev builds and production builds act differently with respect to assets listed in the .csproj. Production builds copy assets listed in .csproj to the expected output folder. Dev builds don't work because the dev server expects to find the assets under obj/Host/..... as described in the initial bug report here and the dev build process doesn't copy them there.

@yoDon commented on GitHub (Dec 21, 2017): @GregorBiswanger This is a dev vs. production build issue not an OS platform issue. Dev builds and production builds act differently with respect to assets listed in the .csproj. Production builds copy assets listed in .csproj to the expected output folder. Dev builds don't work because the dev server expects to find the assets under obj/Host/..... as described in the initial bug report here and the dev build process doesn't copy them there.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#86