|
| 1 | +# Updating File System during Visual Studio code deployment |
| 2 | + |
| 3 | +> [!NOTE] |
| 4 | +> |
| 5 | +> This document is based on this [Discord Announce](https://discord.com/channels/478725473862549535/481780524864503828/1317131756369088574) |
| 6 | +
|
| 7 | +This method is complementary from deploying files during the [flash process using nanoff](https://github.com/nanoframework/nanoFirmwareFlasher?tab=readme-ov-file#deploy-file-to-device-storage). It is intended to faciliate development. While deploying at scale, we recommend to use the nanoff method. |
| 8 | + |
| 9 | +## Can I update the internal filesystem of an ESP32 (or any other board that supports it) during deployment? |
| 10 | + |
| 11 | +Yes, you can! |
| 12 | + |
| 13 | +To do that you should set the property `Build action` to `Content` and `Copy to output directory` to `Copy always` |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | +## Folder structure are supported? |
| 18 | + |
| 19 | +Yes, by default the deploy will maintain the structure of the folder startig from the root of project. |
| 20 | + |
| 21 | +For example you can place a file named "favicon.ico" to the root of the project, sets the two props as described and your internal storage will be: |
| 22 | + |
| 23 | +```txt |
| 24 | +I:\favicon.ico |
| 25 | +``` |
| 26 | + |
| 27 | +If you put that file under in your project's "webapp" folder, the internal storage structure will follow the same tree and look like this: |
| 28 | + |
| 29 | +```txt |
| 30 | +I:\webapp\favicon.ico |
| 31 | +``` |
| 32 | + |
| 33 | +If you want to change the storage path of a file you need to set `NF_StoragePath` metadata to the file definition inside the project file. |
| 34 | +To do that click with right button on the project entry and select `Unload project`, Visual Studio will open the project file for you. |
| 35 | +Inside this file search for the `Content` entry of your file and add the TAG `NF_StoragePath` like this example: |
| 36 | + |
| 37 | +```xml |
| 38 | +<Content Include="webapp\index.html"> |
| 39 | + <CopyToOutputDirectory>Always</CopyToOutputDirectory> |
| 40 | + <NF_StoragePath>I:\newindex.html</NF_StoragePath><!-- now this file will be copied under the root of I:\ and rename the file to newindex.html --> |
| 41 | +</Content> |
| 42 | +``` |
| 43 | + |
| 44 | +## Can I erase all files before deploy? |
| 45 | + |
| 46 | +The response for this question is no but yes... |
| 47 | + |
| 48 | +In other words you can not erase the internal storage every time you press `F5` or deploy your code but you can do that re-flashing the firmware with `--masserase` option of `nanoff` cli, for example: |
| 49 | + |
| 50 | +```sh |
| 51 | +nanoff --platform esp32 --serialport COM3 --update --masserase --target ESP32_S3_BLE |
| 52 | +``` |
0 commit comments