Dynamic Animation Library
This guide explains how to setup, build and run NUI (DALi C#) applications using Visual Studio Code (VSC).
It assumes the starting point is a completely ‘clean’ system, though that is not essential.
VSC can be be installed on Ubuntu 14.04 and onwards.
The NUI Hello World tutorial provides an introduction into NUI application development, describing how to display text in a text label.
This document covers:
Installation of .NET Core and VSC
Getting NUI source code
NUI build environment
Building NUI source code
Build and run the Hello World tutorial
Appendix A - Configuring firewall proxy settings
Appendix B - Clean build
$ sudo dpkg -i code_1.10.2xXXXXXXXXXX_amd64.deb
$ code // Open VSC
$ code . // Open VSC in current directory
$ code myfile // Open file in VSC
VSC requires installation of required packages and libraries. It may be necessary to configure the firewall proxy settings to enable download via http. The procedures for firewall setup are described in Appendix A.
Ctrl+Shift+X
(View extensions command).Getting started with Visual Studio code will give you a basic understanding of projects in VSC.
$ mkdir ~/DALiNUI
$ cd ~/DALiNUI
$ git clone git@github.com:dalihub/dali-core
$ git clone git@github.com:dalihub/dali-adaptor
$ git clone git@github.com:dalihub/dali-csharp-binder
$ git clone git@github.com:dalihub/dali-toolkit
$ git clone git@github.com:dalihub/app-stub
$ git clone git@github.com:dalihub/nui
$ cd ~/DALiNUI/dali-core
$ git checkout devel/master
$ cd ~/DALiNUI
$ dali-core/build/scripts/dali_env -c
$ dali-env/opt/bin/dali_env -s > setenv
$ . setenv
These steps only need to be done once.
You will have to source your environment variables every time you open up a new terminal (or you can add to .bashrc
if you prefer).
You can do this by sourcing the ‘‘setenv’’ script you created above:
$ . setenv
The shared library files (.so) will be built and installed into the ~/DALiNUI/dali-env/opt/lib folder.
$ git clone git@github.com:dalihub/dali-demo
$ cd ~/DALiNUI/dali-demo
$ git checkout devel/master
Build from README
$ cd ~/DALiNUI/dali-env/opt/bin
$ dali-demo
If ok, DALi demo window will appear.
$ cd dali-csharp-binder
$ autoreconf --install
$ ./configure --prefix=$DESKTOP_PREFIX
$ make install -j8
$ cd ~/DALiNUI/app-stub
$ dotnet restore
$ dotnet build
$ cd ~/DALiNUI/nui
$ ~/bin/build-nui-as-lib.sh
This creates a separate Tizen.NUI.Code folder which is used to build the NUI toolkit as a separate library. It does not build any of the example code within the sample folders.
hello-world.cs
hello-world.cs
to the tutorials folder: $ cd ~/DALiNUI
$ mkdir tutorials
$ cp hello-world.cs ~/DALiNUI/tutorials
tutorials
folder in the File Dialog $ cd ~/DALiNUI
$ . setenv
$ cd ~/DALiNUI/tutorials
$ dotnet new console
The ‘setenv’ will not be necessary, if the environment has been set up in your .bashrc as described in Build environment)
The ‘dotnet new console’ creates a Project, with a Project file tutorials.csproj
and a Program.cs
file.
Delete Program.cs in VSC Explorer, as its not needed.
Modify project file
tutorials.csproj
, adding the following lines inside the ‘Project’ element: <ItemGroup>
<ProjectReference Include="..\nui\Tizen.NUI.Code\Tizen.NUI.csproj" />
<ProjectReference Include="..\app-stub\Tizen.Applications.csproj" />
</ItemGroup>
2. Add the following line inside the 'PropertyGroup' element:
<DefineConstants>DOT_NET_CORE</DefineConstants>
$ dotnet restore
Running dotnet restore
gives you access to the required .NET Core packages that are needed to build your project.
Ctrl+Shift+P
to open the command Pallete, type “ctr”, and select Configure Task runner > NET coreA tasks.json
file is essential, or else will get “No task runner configured”, or “Error Could not find the Pre Launch Task ‘build’”
message pane on building.
$ dotnet build
Note: This step builds the ‘tutorials’ executable.
The screenshot shows the key files associated with the “hello world” project in VSC Explorer.
$ dotnet run
$ DALI_WINDOW_WIDTH=600 DALI_WINDOW_HEIGHT=800 dotnet run
This section provides an insight into the configuration of the application “Launch” profile.
In VSC, Open launch.json
via the Explorer. In the “configurations” section, add the required width and height
to the environment variable:
"name": ".NET Core Launch (console)",
...
...
"env": {
"DALI_WINDOW_WIDTH":"600",
"DALI_WINDOW_HEIGHT":"800"
},
These settings will be picked up if the application is run via F5.
{
"http.proxy": "http://xxx.xxx.xxx.xxx:xxxx
}
The proxy settings are saved to the settings.json
file.
The screenshot shows the installed C# extension package, and also the proxy settings for the library packages
in the settings.json
file.
http_proxy
and https_proxy
, in a terminal from which VSC will be run
$ export http_proxy=http://xxx.xxx.xxx.xxx
$ export https_proxy=http://xxx.xxx.xxx.xxx
These export variables could also be set in your .bashrc
file.