Managing Your Project

Visutal Studio makes it easy to build Tizen .NET applications. you can create a Tizen project, add a class library, register your certificate, build projects, and run and debug your applications.

If you want to get started quickly and learn the basics of Tizen .NET, please follow the guide to Creating Your First Tizen .NET Application.

Create a Project

To create a new project:

  1. In the Visual Studio menu, go to File > New > Project to open the New Project dialog.
  2. Select Blank App (Tizen Xamarin.Forms Portable).

    New project

  3. Check the Create directory for solution option.

    Create directory for solution

  4. Click OK.

    After the project is created, Visual Studio runs the NuGet Package Manager to download the required packages. Wait for a while, depending on your computer and network speed, until the packages have been downloaded.

    Downloading NuGet packages

Adding a Class Library and Manual NuGet Restore

To add a class library and restore NuGet manually:

  1. If you add a Class Library (Tizen) in Visual Studio, the editing window shows red wavy lines.

    Red wavy lines

  2. Right-click the solution item in the Solution Explorer view and click Restore NuGet Packages.

    Restore NuGet packages

    Wait for the NuGet restoring to complete. Click the ClassLibrary project, and then click Refresh when the Refresh button appears.

    Refresh

  3. The .NETStandard.Library shows up and the code looks clean.

    .NETStandard.Library

The following figure shows warning messages that you can see in the Error List window when building the project. These can occur because the application is based on the Microsoft.NETCore.App and the Class library is based on NETStandard.Library, and the difference makes Visual Studio 2015 show a warning. However, it is OK to run the project, because the Microsoft.NETCore.App includes the NETStandard.Library set.

Figure: Warning messages

Warning messages

 

Modifying Certificate and Tool Settings

You can modify the certificate and tool settings.

Setting the Certificate Information

NoteIn this preview version, certificate information must be set at least once before building for the .tpk file generation, even when you want to use the default certificates without any change. This is going to be fixed in the next version.

To set the certificate information:

  1. In the Visual Studio menu, go to Tools > Options >Tizen > Certification.

    Certification

  2. Click OK. You don't need to change anything.
  3. Note the passwords:
    • For the author certificate, the password is author_test without the double quotation marks.
    • Do not touch the distributor certificate password.
  4. To change the author certificate, click the ... button and select the file.

The creation of your own certificate is not yet defined, but you can use an existing certificate from the Tizen Studio.

Setting the Tizen Tools

You can define the path to the Tools folder by going to Tools > Options >Tizen > Tools. Currently, the setting is used to get the sdb.exe file path.

Figure: Tools settings

Tools settings

Setting the NuGet Package Manager

To set up the NuGet package manager:

  1. Go to Tools > NuGet Package Manager > Package Manager Settings.

    NuGet package manager settings

  2. Uncheck the Automatically check for missing packages during build in Visual Studio option.

    Package restore options

Building the Project

To build a project:

  1. In the Visual Studio menu, go to Build > Build Solution.

    Build solution

    • Set the certificate in Tools > Options, if you see the Invalid signing Certificate error, as in the following figure. For more information, see Setting the Certificate Information.

      Invalid certificate

    • The .tpk file is generated when the certificate is set and there are no errors.

      Certificate is set

  2. Right-click the project item and select Open Folder in File Explorer.

    Open the project in File Explorer

  3. Open the .tpk file in the bin/Debug folder.

    Debug folder

  4. Inside the .tpk file, open the bin/Debug/packaging folder to see the source of the .tpk file.

    tpk file contents

  5. Install the .tpk file:
    • The .tpk file is installed for debugging when you click the debug start button (the button with a green triangle).

      The file installs after the build or after you have changed the debug device.

    • Manual installation:
      • Use the cd command to go to the debug folder.
      • Use the <path to sdb> install <TizenApplication>.tpk command to install the application. For example:

        c:\Program Files (x86)\Tizen\Tools\sdb.exe install XamarinApplication3.Tizen.tpk

    You get the following message:

    * Temporarily modified for Tizen build: C:\Users\...\.nuget\packages\Xamarin.Forms\2.3.3.163-pre3\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets 
       DebugSymbols = "$(DebugSymbols)" --> DebugSymbols = "false"
    * Temporarily modified for Tizen build: c:\users\...\documents\visual studio 2015\Projects\XamarinApplication10\packages\Xamarin.Forms.2.3.3.163-pre3\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets
       DebugSymbols = "$(DebugSymbols)" --> DebugSymbols = "false"
    

    The current Xamarin.Forms does not support .NET Core, which Tizen includes. For this reason, the Mono.Cecil assembly used by Xamarin.Forms has a problem with handling "portable" debug symbols used by .NET Core. The latest version of Mono.Cecil has fixed this problem, but it can take some time for Xamarin.Forms to include the fixed version.

    To overcome the problem in Tizen Tools, as a work around, modify the Xamarin.Forms.targets file a little so that it compiles. After the compiling has finished, it is restored to as it was before. This happens only when the Tizen project exists in the solution. A side effect of this action is that debugging codes related to XAML CS sources are not necessarily available with Visual Studio 2015. This action is removed when the fixed version Mono.Cecil is available to the public.

    The Automatically check for missing packages during build in Visual Studio option in the NuGet Package Manager can perform its actions after this change, so it is better to uncheck this option so that it does not restore while building.

Running from Visual Studio

  1. Go to Tools > Tizen > Run Emulator to run the emulator.

    Emulator

  2. Click Reset Emulator in case of a kernel panic or any other problem.

 

Debugging a Project

To debug an application:

  1. Run the emulator in Tools > Tizen > Run Emulator, or click Launch Tizen Emulator.

    Launch the emulator

    Wait for the emulator to launch.

    Emulator starting

    Emulator starting

    The Launch Tizen Emulator button changes to Emulator (tizen-3.0_mobile_x86_64_hd).

    Emulator button

  2. Start debugging.

    The debug functionalities are still in development.

    1. You can pause the code with a break point and see primitive values, such as an integer.

      Add a breakpoint using the F9 key.

      Breakpoint

    2. Click Debug Start in the Emulator (tizen-3.0_mobile_x86_64_hd) view.
      • Visual Studio builds the project if you have not built it or it needs building.
      • The Tizen package file (.tpk) must be installed after the build:

        Install the .tpk file

        • If no changes were made, the installation does not happen.
        • If you changed the connection with the device (emulator), the installation happens.
      • The code pauses at the break point.

        Pause the code

    3. Click Continue.

      Continue

      The application continues running on the emulator.

      Application running on the emulator

    4. Click Back on the emulator or Stop Debugging in Visual Studio to end the debugging process.

      Back button

      Stop debugging

      After the debugging is done, your application is available in the emulator and can be run again, as needed.

      Application running on the emulator