Jump to content

[SOLVED] How to setup a working C# environment in linux ?


photo

Recommended Posts

Posted (edited)

Hi,
I'm an Unreal Engine and Unity developer and I want to have a look to Unigine

I'm a very new user of Unigine and I've lot a difficulties to setup a dev environnement on Linux.

I've read online docs 
here
https://developer.unigine.com/en/docs/2.10/start/programmer
and here
https://developer.unigine.com/en/docs/2.10/code/csharp/application

and looked in the forum

But I found no answer to my question.

I created a new project with the following settings
- SDK: 2.10.0.2 entertainment evaluation version
- template: empty (VR is the only other choice, no "C# template" for me)
- API+IDE: C# (.net Core) (no other choice for C#)

I managed to setup VS Code to build the project (by adding some extensions for C++ and C#) , but I encountered the following errors when I tried to build using the "Run debug" task

  The framework 'Microsoft.NETCore.App', version '2.2.0' was not found.

After a search on google, I've successfully installed the Dotnet core 2.2.110 SDK using its install script (no package for that version on Arch Linux repos)

And I managed to build the project without error in the VS code terminal:

  Restore completed in 15,71 ms for /mnt/D/Projets/Unigine/first/first.csproj.
  first -> /mnt/D/Projets/Unigine/first/bin/first_x64d.dll
  CSPropertyGenerator started
  CSPropertyGenerator completed successfully in 0.42 seconds

I can run the project in the editor.

But I can not debug. Setting up break points in VS code does nothing. 

How can I "link" the projet in the editor and the code in VS code ?

Is there a "common way" to build and run the project from the editor, or VS code , or both  (as we can have the "build" and "run" buttons in Unreal Engine) ?

Thanks for your answers

 

Edited by laurent.ongaro
typo
Posted

Hi Laurent,

To be able to debug the C# Project under Linux you need to configure launch.json file inside .vscode directory:

image.png

For example, for a simple new project it can look something like that:

{
   // Use IntelliSense to find out which attributes exist for C# debugging
   // Use hover for the description of the existing attributes
   // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
   "version": "0.2.0",
   "configurations": [
        {
            "name": "Run Debug",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build debug",
            "program": "${workspaceFolder}/bin/unigine_project_x64d.dll",
            "args": "-data_path ../ -console_command \"world_load unigine_project\"",
            "cwd": "${workspaceFolder}",
            "console": "internalConsole",
            "stopAtEntry": false,
        },
        {
            "name": "Run Release",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build release",
            "program": "${workspaceFolder}/bin/unigine_project_x64.dll",
            "args": [],
            "cwd": "${workspaceFolder}",
            "console": "internalConsole",
            "stopAtEntry": false,
        },    
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach",
            "processId": "${command:pickProcess}"
        }
    ]
}

The main section here is args: you need to specify the parameter that engine will use to startup.

After that you can simply hit F5 in VS Code and your application should run.

Thanks!

  • Like 1

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted

Hello I tried to follow the above steps using Windows and VS Code

I am using a project created starting from component_samples 

Steps I did:

1 replace the program name with csharp_component_samples_x64d.dll

2. create a new prelaunch task as "build debug" as it does not exist in the tasks.

3. I also changed the args to the .world I wanted to open as a consolle command in my case it was ".Create_And_Delete"

All worked and started  but there's no way I can actually debug it, it ignores breakpoints...

I am probably missing something...

 

 

thanks you for help

Fred

 

 

 

Posted

That's pretty strange. I was able to debug on my Linux machine (at least breakpoints worked as expected):

image.png

The only drawback I was found that if Engine grabs a cursor and breakpoint hits you will not be able to go back to the VS Code :) I guess it should be easy to fix in the future versions.

I will also check this behavior at my work PC on Monday.

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted

Regarding ignored breakpoints while running from VS Code, it looks like you can adjust .csproj file and replace

<DebugType>full</DebugType>

with

<DebugType>portable</DebugType>

to make debugger work again.

Could you please verify if this helps?

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted

YESS !!

that worked perfectly ! thanks !

 

  • Like 1
  • silent changed the title to [SOLVED] How to setup a working C# environment in linux ?
×
×
  • Create New...