Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executing C# dotnet #2234

Closed
Adam-wil opened this issue Mar 3, 2023 · 3 comments
Closed

Executing C# dotnet #2234

Adam-wil opened this issue Mar 3, 2023 · 3 comments

Comments

@Adam-wil
Copy link

Adam-wil commented Mar 3, 2023

Hi Giuspen,

Firstly, great work on CherryTree, its my new NoteBook!

I would like to know how to execute C# from the codeblocks.

Can you help me with some more instructions setting up the preferences / tmp path please. As I understand it please see images below:

To Run the C#

image

Do I need to set the C:\Program Files\CherryTree\mingw64\bin> to the Environment Variable Path ?

image

image

Any help would be appreciated. Cheers Adam

@giuspen
Copy link
Owner

giuspen commented Mar 3, 2023

Hi @Adam-wil
The command that you need to write is:
csc /out:<tmp_bin_path> <tmp_src_path> && <tmp_bin_path>
And a valid Hello World would be:

namespace HelloWorld {
class Hello {
    static void Main(string[] args) {
        System.Console.WriteLine("Hello World!");
    }
}
} // namespace HelloWorld

And if the codebox type is c-sharp and the folder containing csc.exe is in the system Path ( C:\Windows\Microsoft.NET\Framework64\v4.0.30319 ), you will get:

Microsoft (R) Visual C# Compiler version 4.8.4084.0
for C# 5
Copyright (C) Microsoft Corporation. All rights reserved.

This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240

Hello World!

C:\Program Files\CherryTree\mingw64\bin>

@Adam-wil
Copy link
Author

Adam-wil commented Mar 4, 2023

Thanks Guispen,

I managed to get the c-sharp compiling. Saving the snippet as a testc.cs by right clicking the snippet and saving as cs. Then adding it to the file path worked.

WhatsApp Image 2023-03-04 at 14 39 58

Thanks from your help on this! I would love to see the c# be written in .Net 6 or 7 to strip out the namespaces etc.

@giuspen
Copy link
Owner

giuspen commented Mar 4, 2023

No problem I added support command in the default list in upcoming 0.99.55 and a dedicated icon for c-sharp

@giuspen giuspen closed this as completed Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants