Coding with C#
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
-
- Level 3
- Posts: 156
- Joined: Thu Sep 30, 2021 2:46 pm
Coding with C#
Programming is a new thing for me, I just started a new school program a few months ago. We are learning C# and are using Visual Studio on Windows.
I would like to practice at home to on my Linux PC. Unfortunately, I couldn't find a way to make Visual Code work. It seems to be missing scriptcs and the instructions for that are confusing and don't work.
Someone on this board pointed out to me some websites where I can code and build online, which works fine, thanks to him.
However, I was still wondering if there were other software alternatives which I could easily install, use to code using C#, that would highlight my syntax errors like Visual Code does and which could build and run my programs. Does that exist on Linux? Which one would you recommend?
Thank you.
I would like to practice at home to on my Linux PC. Unfortunately, I couldn't find a way to make Visual Code work. It seems to be missing scriptcs and the instructions for that are confusing and don't work.
Someone on this board pointed out to me some websites where I can code and build online, which works fine, thanks to him.
However, I was still wondering if there were other software alternatives which I could easily install, use to code using C#, that would highlight my syntax errors like Visual Code does and which could build and run my programs. Does that exist on Linux? Which one would you recommend?
Thank you.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Coding with C#
C# is a Microsoft product and as such a Windows-centric language. Making anything from Microsoft play nice with anything not produced by Microsoft amounts to torture. Feel free to torture yourself with e.g. the mountain of bugs that is Mono but as to "us" you were the last time you asked this same thing helped correctly through the advise to e.g. install Windows into a VM if you must do Windows-things.
Re: Coding with C#
Visual Studio Code can be installed through Software Manager. That installs the flatpak from https://flathub.org/apps/details/com.visualstudio.code, which is sandboxed so may be more difficult to work with. Also install FlatSeal from Software Manager so you can easily configure the sandbox permissions.
Alternatively you can download the .deb package from here https://code.visualstudio.com/docs/setup/linux, save it to disk, and double-click it in your file manager to launch the installer. That installs it as a regular package which may be easier to work with.
Beyond that I don't have experience with it. If you get stuck with instructions for something you need you'll have a better chance of getting help with that if you ask specific and detailed question: which instructions are you trying to follow, from where, how far did you get with them / at what step do you get stuck, what is baffling you and so on.
Alternatively you can download the .deb package from here https://code.visualstudio.com/docs/setup/linux, save it to disk, and double-click it in your file manager to launch the installer. That installs it as a regular package which may be easier to work with.
Beyond that I don't have experience with it. If you get stuck with instructions for something you need you'll have a better chance of getting help with that if you ask specific and detailed question: which instructions are you trying to follow, from where, how far did you get with them / at what step do you get stuck, what is baffling you and so on.
-
- Level 3
- Posts: 156
- Joined: Thu Sep 30, 2021 2:46 pm
Re: Coding with C#
A classmate who also uses Linux Mint at home tried using VisualStudio on a virtual machine but it made the whole system crash.
For Visual Code, I'm a little bit lost and confused about everything I did exactly. It's links that brings me to other links who brings me to other links, I would not be able to tell everything I did.
I've been trying to solve this for several weeks. That's why I was trying to see if there was an easier alternative to VisualCode.
Today, I tried again, I got on this link: https://github.com/OmniSharp/omnisharp- ... ebugger.md
I don't understand step 3:
For Visual Code, I'm a little bit lost and confused about everything I did exactly. It's links that brings me to other links who brings me to other links, I would not be able to tell everything I did.
I've been trying to solve this for several weeks. That's why I was trying to see if there was an easier alternative to VisualCode.
Today, I tried again, I got on this link: https://github.com/OmniSharp/omnisharp- ... ebugger.md
I don't understand step 3:
I don't have any project.json and I don't see any prompt. The C# extension is installed.3: Add VS Code configuration files to the workspace
VS Code needs to be configured so it understands how to build your project and debug it. For this there are two files which need to be added -- .vscode/tasks.json and .vscode/launch.json.
Tasks.json is used to configure what command line command is executed to build your project, and launch.json configures the type of debugger you want to use, and what program should be run under that debugger.
Launch.json configures VS Code to run the build task from tasks.json so that your program is automatically up-to-date each time you go to debug it.
If you open the folder containing your project.json, the C# extension can automatically generate these files for you if you have a basic project. When you open a project and the C# extension is installed, you should see the following prompt in VS Code:
Re: Coding with C#
axrusar just in viewtopic.php?f=231&p=2143334#p2143334 posted this:
https://developer.microsoft.com/en-us/w ... -machines/
https://developer.microsoft.com/en-us/w ... -machines/
-
- Level 3
- Posts: 156
- Joined: Thu Sep 30, 2021 2:46 pm
Re: Coding with C#
Thank you, downloading one of those images.rene wrote: ⤴Mon Feb 21, 2022 6:41 pm axrusar just in viewtopic.php?f=231&p=2143334#p2143334 posted this:
https://developer.microsoft.com/en-us/w ... -machines/
Still kinda obsessed with the fact that there must be a way to code C# directly in Linux, as the functions are there in VisualCode and other programs, but something is missing to make them work,
Re: Coding with C#
Oh, I'm sure, but once you then have setup all right so as to write C# you then run into bug after bug -- "implementation detail after implementation detail" I mean -- trying to run it. Those of us that have been here a long time know when not to bother with Linux and if the goal is compatibility with Windows that's by and large always (although, hush, don't tell Valve yet). Those of us fortunate enough to have carved out something other can then moreover elect to not bother with said goal. Study hard, you may also get there at some point
-
- Level 3
- Posts: 156
- Joined: Thu Sep 30, 2021 2:46 pm
Re: Coding with C#
I solved the issue with VisualCode.
1-I used the purge function to completely remove Visual Code.
2-I've displayed the hidden files in home folder and deleted the extensions and config files related to Visual Code.
3-I followed the tutorial here: https://www.youtube.com/watch?v=WeTesTCzep0
Thank you @rene for the headsup, I've also downloaded the Windows image and will now attack this part. Right now, in school, we're only doing small console programs so I hope it will work well on my Linux machine.
If I encounter "implementation details" issues when doing more advanced stuff, I'll know then that it would be better to use the Windows VM.
1-I used the purge function to completely remove Visual Code.
2-I've displayed the hidden files in home folder and deleted the extensions and config files related to Visual Code.
3-I followed the tutorial here: https://www.youtube.com/watch?v=WeTesTCzep0
Thank you @rene for the headsup, I've also downloaded the Windows image and will now attack this part. Right now, in school, we're only doing small console programs so I hope it will work well on my Linux machine.
If I encounter "implementation details" issues when doing more advanced stuff, I'll know then that it would be better to use the Windows VM.
-
- Level 3
- Posts: 156
- Joined: Thu Sep 30, 2021 2:46 pm
Re: Coding with C#
For Visual Studio on the Windows virtual machine, it's extremely slow. I've allocated 8 GB of RAM to it on the 16 I have on my computer.
I guess my computer is maybe not powerful enough to make this a fluid experience?
I guess my computer is maybe not powerful enough to make this a fluid experience?
Re: Coding with C#
I've used MonoDevelop to program in C# on LM : https://www.monodevelop.com/
The only problem is, it isn't really supported anymore ,
but it worked the last time I used it a couple of years ago.
The only problem is, it isn't really supported anymore ,
but it worked the last time I used it a couple of years ago.
-
- Level 2
- Posts: 74
- Joined: Wed Oct 16, 2019 6:41 am
Re: Coding with C#
Since I do a lot of C# coding I have Visual Studio Code natively in LM. I also have a Windows 10 VM where I run Visual Studio 2022. I have a folder shared with the VM where I do git checkouts. It works except that some projects which run a local IIS in Visual Studio doesn't like being on a "non-local" drive so I have to copy them inside the VM.
I also use the Linux client for Microsoft Teams.. yes someone described using Microsoft things on Linux as torture and I won't argue against that, but it works well enough for me.
I use this repo for the .Net things:
I also use the Linux client for Microsoft Teams.. yes someone described using Microsoft things on Linux as torture and I won't argue against that, but it works well enough for me.
I use this repo for the .Net things:
Code: Select all
deb [arch=amd64] https://packages.microsoft.com/ubuntu/20.04/prod focal main
Re: Coding with C#
I'm doing C# coding in LM. I use Visual Studio Code and dotnet Core which you can install using instructions on the microsoft website.
https://docs.microsoft.com/en-us/dotnet ... untu#2004-
However there is also Vala, which is C# like but uses none of the dotnet dependencies and compiles to standalone executables.
https://valadoc.org/
VSCode is a bit of a change from using Visual Studio, but once you get your head around using folders instead of projects then its pretty good.
https://docs.microsoft.com/en-us/dotnet ... untu#2004-
However there is also Vala, which is C# like but uses none of the dotnet dependencies and compiles to standalone executables.
https://valadoc.org/
VSCode is a bit of a change from using Visual Studio, but once you get your head around using folders instead of projects then its pretty good.
-
- Level 1
- Posts: 32
- Joined: Sat Dec 05, 2020 9:40 am
Re: Coding with C#
Make sure you have more multiple threads and crank the VRAM up. If you want a package free from telemetry you can also install VSCodium, it's just VS Code with the telemetry and Microsoft branding cut out. I've never used it for this language though, not sure how well it works, considering the nature of the language.thenerdyguy wrote: ⤴Wed Feb 23, 2022 12:05 pm For Visual Studio on the Windows virtual machine, it's extremely slow. I've allocated 8 GB of RAM to it on the 16 I have on my computer.
I guess my computer is maybe not powerful enough to make this a fluid experience?
-
- Level 2
- Posts: 52
- Joined: Mon Aug 05, 2019 1:07 pm
Re: Coding with C#
On Linux you need to get +300% more comfortable with using your terminal to compile your programs (whether it's C#, Go, Java, C++, C) and understand your programs.thenerdyguy wrote: We are learning C# ... Does that exist on Linux? Which one would you recommend?
On Windows you can use Visual Studio .NET, but that's because the compiler is not readily in your %PATH%.
And opening Windows Power Shell or cmd.exe terminal to your code can be weird when you start in C:\Windows\System32 on launch.
Visual Studio .NET is 900%cool as an IDE creating C# programs. You can add buttons and various widgets to a windows form and hit F5 and then all of a sudden you're 900%powerful.
But never fret..
Code: Select all
#make sure we're finding the latest the latest packages in the repos..
#we don't want to try to install missing packages because they
#updated to a slightly newer version.
sudo apt-get update
apt-cache search mono | grep -i 'C#'
#sudo apt install mono-cs-compiler-cli-whatever-package-name-here
You could try:
Code: Select all
apt-cache search kate #requires a lot of KDE package depedencies though
apt-cache search gvim #when it launches go :help
#to get the basics. (the GTK/GTK3 version is what you want)
apt-cache search gedit #nice.simple.clean. I'm 30%sure it has C# source code highlighting.
Code: Select all
//you know C#. Put a Hello World in here.
Then go:
Code: Select all
cd #go to ~
#this should compile your program. Let's just pray this is the right command
mcs MyFirstLinuxCSexperience.cs
#now you should have this file in your current directory:
file MyFirstLinuxCSexperience.exe
#should say something like "Mono executable" or something.
#To run your Hello World go:
mono MyFirstLinuxCSexperience.exe #yay it works.
Your .exe files compiled in Visual Studio .NET on Windows should run on Linux without a hinch. You might need to re-compile the .exe in Visual Studio .NET on Windows with a different older version of C#/.NET-framework.
So you just copy the .exe from Windows to Linux and go
mono MyExeFromWindowsFromCSharp.exe
. Even the GUI programs should run too assuming you have the Windows Forms C#/.NET mint/ubuntu/debian/deb package installed.
Code: Select all
apt-cache search windows | grep forms #to find the package to install to get Windows Forms running on Linux with mono
Re: Coding with C#
May I interject,rene wrote: ⤴Fri Feb 18, 2022 12:22 pm C# is a Microsoft product and as such a Windows-centric language. Making anything from Microsoft play nice with anything not produced by Microsoft amounts to torture. Feel free to torture yourself with e.g. the mountain of bugs that is Mono but as to "us" you were the last time you asked this same thing helped correctly through the advise to e.g. install Windows into a VM if you must do Windows-things.
Given that some of the many programmers have been convinced that Microsoft is the Future "Yuck"... Would being able for some of the custom applications that may have been developed to be able to work be of a strategic advantage given that it could run these apps make Mint the desired platform to migrate to as an open source solution?
Re: Coding with C#
"Mint" doesn't do for example "Mono", but yes, sure, as said, do feel free to torture yourself.