|
| 1 | + |
| 2 | +# Configure your development tool |
| 3 | + |
| 4 | +We support most popular options. We strongly recommend using containers to run |
| 5 | +and debug your apps but local compilation and debugging is also supported. |
| 6 | +We provide a Docker file in the project template to use as a start and a |
| 7 | +dev container for VSCode. |
| 8 | + |
| 9 | +## Visual Studio |
| 10 | + |
| 11 | +You should be all set, so skip to step 3. |
| 12 | +:::note |
| 13 | + |
| 14 | +To use Visual Studio's publish feature first install & configure the [Samba share Home Assistant addon](https://github.com/home-assistant/addons/blob/52bafd68185080e9b1a1d6b6c501ab96705d73f9/samba/DOCS.md), then configure your VS publish options: |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +Now you can publish to quickly deploy files, and restart NetDaemon to run them. |
| 19 | +::: |
| 20 | + |
| 21 | +## Visual Studio Code |
| 22 | + |
| 23 | +Dev Containers are the preferred way to develop your apps. |
| 24 | +This also requires Docker to be installed. You can also |
| 25 | +develop and debug directly on your dev machine without Docker. |
| 26 | + |
| 27 | +1. Install [Remote Development extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack) |
| 28 | +in VS Code if you have not already. |
| 29 | +2. Open folder, the newly cloned template |
| 30 | +3. Run task: `Dev Containers: Open Folder in Container...`. Wait until it fully opened |
| 31 | + |
| 32 | +## JetBrains Rider |
| 33 | + |
| 34 | +Just as with Visual Studio it is ready to go for local compile |
| 35 | +and debugging of your apps. |
| 36 | + |
| 37 | +Rider supports debugging of containerized ASP.Net Core apps from version 2018.2. |
| 38 | + |
| 39 | +Open the netdaemon_app folder in Rider and it should be able to build |
| 40 | +the projects immediately. A default execute and debug profile will be |
| 41 | +created however these will be executed as local processes. The preferred |
| 42 | +way to develop your app is to use a container, which requires Docker to be installed. |
| 43 | +To configure a container, perform the following steps: |
| 44 | + |
| 45 | +1. Locate `Dockerfile` in the Solution Explorer window |
| 46 | +2. Right click and select `Debug Dockerfile` |
| 47 | +3. This will create a new profile called "DOCKERFILE" |
| 48 | +4. To view progress, located "Docker" in the "Services" tab and double-click it |
| 49 | +5. Like all container apps, the first build may take a few minutes - watch the progress in the "Services / Docker" tab |
| 50 | + |
| 51 | +Ensure that the "DOCKERFILE" profile is selected in the toolbar and then `Run` and `Debug` will execute within the container. |
| 52 | + |
| 53 | +## Studio Code Server Addon |
| 54 | + |
| 55 | +### Setup |
| 56 | + |
| 57 | +1. In Home Assistant go to Configurations -> Add-ons, Backups & |
| 58 | +Supervisor -> Add-on Store -> Menu -> Repositories |
| 59 | +2. Add the repository: [https://github.com/hassio-addons/repository](https://github.com/hassio-addons/repository) |
| 60 | +3. Install the `Studio Code Server Addon` (a0d7b954_vscode) |
| 61 | +4. In the add-on configuration Tab add the following config: |
| 62 | + |
| 63 | + ```yaml |
| 64 | + init_commands: |
| 65 | + - >- |
| 66 | + wget |
| 67 | + https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb |
| 68 | + -O packages-microsoft-prod.deb |
| 69 | + - dpkg -i packages-microsoft-prod.deb |
| 70 | + - rm packages-microsoft-prod.deb |
| 71 | + - apt-get update |
| 72 | + - apt-get install -y apt-transport-https |
| 73 | + - apt-get update |
| 74 | + - apt-get install -y dotnet-sdk-9.0 |
| 75 | + - dotnet tool install -g NetDaemon.HassModel.CodeGen |
| 76 | + packages: [] |
| 77 | + log_level: info |
| 78 | + config_path: / |
| 79 | + ``` |
| 80 | + --> The part in the `init_commands` will install .NET SDK 9.0 only in the |
| 81 | + Studio Code Server add-on (Docker Container) |
| 82 | +5. Now you can start the Studio Code Server add-on by going the |
| 83 | +add-on information tab and pressing `OPEN WEB UI`. |
| 84 | + |
| 85 | +HINTS: |
| 86 | + |
| 87 | +- It is recommended to install the C# Extensions (ms-dotnettools.csharp) in Studio Code |
| 88 | +Server to get Semantic Highlighting and IntelliSense. |
| 89 | +- Open only the folder where the solution/project is located to ensure that the C# |
| 90 | +Extension works properly. |
0 commit comments