You should keep the files in a common project, and add a pre build step to copy to the proper folder for each target application.
see prebuild
See copy task
https://learn.microsoft.com/en-us/visualstudio/msbuild/copy-task?view=vs-2022
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have been learning .NET 8 Maui Blazor Hybrid for the past few months to build a multiplatform app for Windows, Android, and iPhone. It's pretty cool, but there was a learning curve. I would like to take advantage of version 9.0 so that I can extend my app to the web.
So far, it seems to start working out of the box.
But, I have two questions:
• Where should I put javascript files?
• Where and how should I reference... reference files?
Javascript Location
I am confused though. Where should I put javascript files? I would have assumed that it would in the .Web project, but there is no wwwroot there. Does it go in the .Shared project? There is a wwwroot, but no index.html to reference the <script>. What about the base project for multiplatform code? There is a wwwroot, and an index.html, but this seems like a strange place to put it.
Reference files
My app uses some large files, including an LLM and some audio files. Currently these sit in the References/raw folder in the base project. I would very much like to keep it there because they are the same files.
You should keep the files in a common project, and add a pre build step to copy to the proper folder for each target application.
see prebuild
See copy task
https://learn.microsoft.com/en-us/visualstudio/msbuild/copy-task?view=vs-2022