Skip to content

Commit 6bd68e1

Browse files
authored
Rework of the getting started guide (#270)
* Rework of the getting started guid * Small improvements * update the docs on tools and source deployment * Add reference to source deployment
1 parent 45d886b commit 6bd68e1

File tree

14 files changed

+334
-265
lines changed

14 files changed

+334
-265
lines changed
81.6 KB
Loading
22.7 KB
Loading

docs/user/started/development.md

Lines changed: 0 additions & 195 deletions
This file was deleted.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
id: development_source_deploy
3+
title: Get started with NetDaemon app development
4+
---
5+
6+
### Deploy source files and configurations
7+
8+
With this option you can deploy the actual source code and NetDaemon will
9+
compile them and use it dynamically.
10+
11+
This option offers:
12+
13+
- Easy access and editing your apps with integrated editor like VS Code server.
14+
- Limited DI support.
15+
- Does **not** support custom nuget packages.
16+
17+
Deployment is done by copying source code and config files under your apps folder
18+
(.cs and .yaml ) to the destination.
19+
The provided debug project should never be copied.
20+
21+
**We always recommend to deploy your binaries as described in the main getting started guide**
22+
23+
#### Use the source code deployment template
24+
25+
```bash
26+
dotnet new --install NetDaemon.Templates.Project
27+
mkdir NetDaemonApps
28+
cd NetDaemonApps
29+
dotnet new nd-src-project
30+
```
31+
32+
### Source files and configurations
33+
34+
**Do not copy project files. Only copy the contents under the `apps` folder!**
35+
Copy the content from the `apps` folder to to `/config/netdaemon5` if you are using
36+
add-on (note that you might have changed the destination in add-on config),
37+
or the destination folder you chose in the other hosting options.
38+
**Do not copy project files. Only copy the contents under the `apps` folder!**
39+
40+
See [installation docs](user\started\installation.md) for how to configure
41+
different hosting options.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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+
![Visual studio profile settings](/img/docs/started/vs_publish_config.jpg)
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

Comments
 (0)