Reputation:
[Running] scriptcs "/home/yash/netcore/netcore/Program.cs" /bin/sh: 1: scriptcs: not found
[Done] exited with code=127 in 0.012 seconds
Upvotes: 5
Views: 2336
Reputation: 661
You need to install mono-complete if you want to run software for Mono or Microsoft .NET which you are not installing from a Debian package.
Then, nstall mono-complete. In all currently supported versions of Ubuntu open the terminal and type:
sudo apt install mono-complete
Save your C# code in a file called hello.cs. Example hello.cs code is: Make hello.cs executable. Right-click the hello.cs file -> select Properties -> Permissions tab -> put a checkmark to the left of Allow executing file as program.
Change directories using the cd
command to the directory that contains the hello.cs file.
Use the mcs
compiler and create a Windows executable named hello.exe from the source hello.cs:
mcs -out:hello.exe hello.cs
Run the hello.exe program with mono:
mono hello.exe
The results of running your program in step 6. should be:
Hello World!
Press Enter to exit back to a default terminal prompt.
Decompile the executable file.
monodis --output=decompiled-hello.txt hello.exe
Upvotes: 3
Reputation: 11
Your code probably is not compiling as you didn't install or set the compiler on your computer. You need to install Run Time Compile for C# and .NET Core SDK, then use the terminal to run your code. Here some instructions that could help you set this up https://almirvuk.blogspot.com/2016/09/run-and-compile-c-in-visual-studio-code.html. Otherwise, you can install Visual Studio, which will take care of its own for compiling when you Run your code.
Upvotes: 0