I'm just working on a web project in VS code. I'm used to using the full blown IDE, but I'm developing for Linux, so I'm trying to see if I can accomplish the same things in VS code.
Basically it's gotten to a point where I need to add System.Web so I can use stuff from there, but I'm struggling to find how to do it. Usually I'd just right click the solution and go Add assembly reference, and all the .NET assemblies would be there.
I've found this answer, and I've added "System.Web.Http.Common": "4.0.20126.16343" to my project.json file. I can't find the dnu restore command though. I've read that it's deprecated, but can't find solid info on how to either install it or use its replacement if so. Is anyone able to help me?
EDIT: Sorry, I should mention I'm using Mono.
dnu-restore is now dotnet-restore. You can find the help here
And if you're still using the rc1.0 version the details on dnu-restore is https://github.com/aspnet/Home/wiki/DNX-Utility.
If you are on Windows right now:
In case .net core is not installed in your machine follow the guidelines here
To have the CLI's anyway, you'd need .net core SDK which can be found here
Open VS2015 Developer command prompt or your command prompt in administrator mode (preferably)
To create a new app: dotnet new
To run an existing app: dotnet restore and then dotnet run
If you are on an Ubuntu right now:
To add the package source for Ubuntu 14.04:
sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
sudo apt-get update
And for Ubuntu 16.04:
sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
sudo apt-get update
Then you can install it using:
sudo apt-get install dotnet-dev-1.0.0-preview2-003121
The new .NET Core SDK restore command is dotnet restore
To install the latest .NET Core SDK (Preview 2 version) and add any asssembly reference in Visual Studio Code, please refer to my post at How to add System.Data and System.Timers assembly references in Visual Studio Code 1.8?
Related
My initial error, in fact, comes from Unity that when I open a script (C#) from it to Visual Studio Code, it opens the code without "auto-completing" my lines of code, which makes learning more difficult.
To solve this problem, I used several tutorials, but none helped. That's why I decided to solve another problem that always appears when I open the Microsoft App, which is "The .NET Core SDK cannot be located: A valid dotnet installation could not be found.".
I installed the dotnet 6.0.44 version on my linux (zorin os 16.2) from commands on the official website and the OS identified it. However, no matter what I do, Visual Studio does not recognize it, not even in the terminal does it find it .
command contradiction
Dotnet version
obs:
Already re-installed SDK
I've had the same error on Zorin OS and other Ubuntu based distributions,
you have to install the SDK by this command:
$ sudo apt-get update && sudo apt-get install -y dotnet-sdk-7.0
If this gives you any errors, read the documentation here.
You can view your installed SDKs by executing
$ dotnet --list-skds
I'm new to Linux and want to code some C# on Linux for school. The problem is I don't know how to install C#. I already read the instructions from Microsoft, but I couldn't get it to work.
'arm64' is the Debian port name for the 64-bit Armv8 architecture, referred to as 'aarch64' in upstream toolchains. The snapd daemon and tooling that enables snap packages is available for arm64 architecture in Debian.
To install snapd:
sudo apt update
sudo apt install snapd
Either log out and back in again or restart your system to ensure that snap's paths are updated correctly. After this install the core snap in order to get the latest snapd:
sudo snap install core
C# is open source and cross platform now that Microsoft has released a version of .NET Core. To install .NET Core in Debian open the terminal and type:
sudo snap install dotnet-sdk --classic
sudo snap alias dotnet-sdk.dotnet dotnet # to run dotnet-sdk type dotnet
The instructions from Microsoft seem to assume that you are running Visual Studio Code on Windows, so they frequently don't work at all on Linux. The following instructions were tested on a Debian-based system (Ubuntu 20.04). I ran a few C# console apps for test purposes, but let's start with a simple one-line C# console app. Run these commands to build and run an example C# Hello World console app from the terminal:
cd ~
mkdir C#_Projects
cd C#_Projects
mkdir HelloWorld
cd HelloWorld
dotnet new console
dotnet build --output ./build_output
dotnet ./build_output/HelloWorld.dll
Results of dotnet ./build_output/HelloWorld.dll
Hello, World!
I have downloaded .net5 from official website, but dotnet command isn't recognised by my terminal.
Here's what I have found after some research-
my dotnet folder is present in /usr/local/share/dotnet
I used this command but it didn't work sudo ln -s /usr/local/share/dotnet /usr/local/bin/dotnet
now whenever I enter dotnet in terminal it shows zsh: permission denied: dotnet
I also tried this command and it didn't work sudo ln -s /usr/local/share/dotnet /usr/bin/dotnet
now whenever I enter dotnet in terminal it shows zsh: command not found: dotnet
when I open my .cs file in vscode it shows error as The .NET Core SDK cannot be located. .NET Core debugging will not be enabled. Make sure the .NET Core SDK is installed and is on the path.
here's a screenshot for reference
What should I do :(
Had the same(ish) issue after installing .NET 6 broke my current .NET 5 installation.
I fixed it by:
1. removing all files of the current dotnet installation.
This is done by deleting the dotnet folder located in /usr/local/share/
(Navigate there using Finders 'go to' feature, or just delete it using the terminal)
2. reinstalling the dotnet sdk
download from https://dotnet.microsoft.com
3. adding a symlink to the current dotnet executable.
sudo ln -s /usr/local/share/dotnet/x64/dotnet /usr/local/bin/
ℹ Note that the path to the dotnet executable is different from what you tried. Seems like a subfolder was added (/x64) at some point.
I was having issues today with this on my MacBook Air M1. Saw that lot of people were suggesting to use
sudo ln -s /usr/local/share/dotnet/x64/dotnet /usr/local/bin/
However, this didn't work for me. I looked in the /usr/local/share/dotnet/x64/dotnet dir, and the x64/ dir was not there. Which means that linkng was not going to happen.
So my solution was to take out the x64/ from the path from the command. Then I ran the dotnet command to verify. This worked for me.
Somehow I did not had the access to share folder, but you can grant access to the local user.
The dotnet is located in /usr/local/share/dotnet/dotnet on ARM64
So be sure to symbolic link the path right.
Also sudo dotnet if running terminal inside Visual Studio Code
I am trying to run the Unreal Engine-4 setup on Ubuntu 14.04 but when running the command
sudo apt-get install build-essential mono-gmcs mono-xbuild mono-dmcs libmono-corlib4.0-cil libmono-system-data-datasetextensions4.0-cil libmono-system-web-extensions4.0-cil libmono-system-management4.0-cil libmono-system-xml-linq4.0-cil cmake dos2unix clang-3.5 libfreetype6-dev libgtk-3-dev libmono-microsoft-build-tasks-v4.0-4.0-cil xdg-user-dirs
I am running into an error saying
The following packages have unmet dependencies:
mono-gmcs : Depends: mono-mcs (= 3.12.1-0xamarin1) but 4.0.2.5-0xamarin1 is to be installed
E: Unable to correct problems, you have held broken packages.
Any clues on how to proceed?
but 4.0.2.5-0xamarin1 is to be installed
It appears you are using Mono 3.x install instructions for Unreal Engine-4's setup.
In Mono 4.x, the gmcs compiler (a shell script to docs/mcs) has been dropped as support for only 4.x+ frameworks are supplied by the default installer.
Remove the "mono-gmcs" from your apt-get install list, and try again. I am not sure if anything is in Unreal 4 is dependent on a Mono 3.x install or if Mono 4.x will work...
You can alway pin your Mono version to 3.12.1. Remove:
deb http://download.mono-project.com/repo/debian wheezy main
from "/etc/apt/sources.list.d/mono-xamarin.list" and add:
deb http://download.mono-project.com/repo/debian wheezy/snapshots/3.12.0 main"
deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main"
Then you can:
sudo apt-get update
After that, try your Unreal Engine-4 setup routine again and the Mono version will match the setup steps on Unreal's web site.
I used to be able to run vb.net apps using just this
apt-get install mono-runtime
apt-get install mono-vbnc
But I now need at least 2.8.0 to run a certain app that has already been compiled on windows. I have the option between the following OS's
ubuntu-12.04-x86
ubuntu-12.04-x86_64
ubuntu-12.10-x86
ubuntu-12.10-x86_64
centos-5-x86
centos-5-x86_64
centos-5-elastix_2.0.1_amd64
centos-6-x86
centos-6-x86_64
debian-6.0-x86
debian-6.0-i386-minimal
debian-6.0-x86_64
debian-6.0-amd64-minimal
debian-7-x86
debian-7.0-x86_64
I've tried the following on multiple versions of ubuntu.
#!/bin/bash
echo Checking for prerequisites. Please enter password if prompted.
sudo apt-get update
sudo apt-get install libpng3 libpng3-dev libtool libtiff4 libtiff4-dev libexif12 libexif-dev libgif4 libgif-dev libpango1.0-dev libatk1.0-dev bison automake autoconf make gcc gtk-sharp2 build-essential xorg-dev libfreetype6 libfontconfig libfontconfig-dev gettext libglib2.0-dev git mono-complete libjpeg-dev
echo Downloading latest build of mono...
git clone git://github.com/mono/mono.git
echo Navigating to mono install directory.
cd mono
echo Building mono from source...
./autogen.sh --prefix=/usr/local
make
echo Installing mono, running with sudo
sudo make install
echo Done!
Checking the mono version says it has worked, but I cant actually run the app due to this error:
The assembly mscorlib.dll was not found or could not be loaded. It should have been installed in the 'usr/lib/mono/4.5/mscorlib.dll'.
Which OS should I use and how can I install mono 2.8.0 or later to run a C# app which has been compiled on windows?
Build a clean Linux OS from ISO, such as Ubuntu 12.04.
Install the stable Mono release on it, such as apt-get install mono-complete. This is required to bootstrap the later steps.
Install Git and check out Mono source code, and switch to a stable branch (such as mono-3.2.8-branch).
Build that version of Mono from source and install it.
I don't recommend 3.4.0 or 3.6.0 branch at this moment, as new commits are still added to them in the past week (June 17 today). 3.2.8 is also the Mono version bundled in Ubuntu 14.04.
What you have been wrong is to check out the master branch. No no, that's not a stable release you should use.