mcs command not found in git bash or powershell - c#

mcs command not found
Hello thank you for your time. I am a little inexperienced. I'm using visual studio code developer pack with all the c# extensions. I've tried using git bash and powershell and the mcs command is not found and I don't know where or how to download it. I'm not even sure what package managers I have. I'm working on a C# Objects project on TeamTreehouse.com and I don't want to keep using workspaces. I'm trying to compile and run the TreehouseDefense project.
Here is the command I typed into the terminal
mcs -out:TreehouseDefense.com *.cs && mono TreehouseDefense.com
Here is the error message I get
mcs : The term 'mcs' is not recognized as the name of bja cmdlet, function, script file, or operable program. ioCheck the spelling of the name, or if a path was
included, verify that the path is correct and try
again.
At line:1 char:1
+ mcs --version
+ ~~~
+ CategoryInfo : ObjectNotFound: (mcs:Str
ing) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
On my macbook air that command compiles and runs the project. Unfortunately the mac is out of commission right now. Also I tried downloading mcs from github but I couldn't find an executable file or anything. I'm not very good with github yet. I also searched for bash commands to download mcs but I couldn't find anything except for something to do with RedHat and I think it was the wrong mcs. I know I'm looking for a c# compiler but that's all I know. Also I installed node.js and tried to use npm to install mcs or mono but those packages apparently did not exist to npm

Related

The term 'livingdoc' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if

I am trying to generate the livingdoc through my feature files, but I am having some error messages coming up. I have already installed the SpecFlow.Plus.LivingDocPlugin via nuget package, and the next step was for me to run the command bellow in the command prompt:
livingdoc feature-folder C:\Users\UserId\Desktop\Projects\ProjectName\Projects\Project.Tests.Automation -t C:\Users\userId\Desktop\Projects\ProjectName\Projects\Project.Tests.Automation\bin\DEV\net6.0\TestExecution.json
ERROR MESSAGE:
livingdoc : The term 'livingdoc' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
livingdoc feature-folder C:\Users\UserId\Desktop\Projects\ProjectName ...
+ CategoryInfo : ObjectNotFound: (livingdoc:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Have you installed the SpecFlow.Plus.LivingDoc.CLI tool globally? This is also needed alongside the Nuget package you've installed.
Try running the following command in a CMD window:
dotnet tool install --global SpecFlow.Plus.LivingDoc.CLI
Then open a new CMD window and try to generate the living docs again.

Omnisharp can't start dotnet

I am using VS Code and Unity.
Under the output tab (omnisharp log) I get this error
Starting OmniSharp server at 5/27/2022, 3:16:43 AM
Target: /Users/<my.name>/unity/Test Project 3/Test Project 3.sln
[ERROR] Error: Command failed: dotnet --version
/bin/sh: dotnet: command not found
However, when I go the console, I can run dotnet --version just fine
dotnet --version
6.0.202
I now get the unity console telling me that the print command is invalid, but that error isn't highlighted in vs code.
Update: it seems to work if I open VS Code from the terminal. Doing research, it has something to do with the path. Still unsure why it doesn't normally work.
In your terminal enter: where dotnet
Set this directory for omnisharp.dotnetPath in your VSCode preferences.
.Net SDKs are available at this path in Program Files: C:\Program Files\dotnet\sdk
Do you have this .net SDK path set in your 'Environment Variables' -> 'System variables' -> 'Path'? If not, try that.

Visual Studio - cannot run dotnet command on Nuget Package Manager Console but ok in terminal

I am using Visual Studio in Macbook.
When I run dotnet in Nuget Package Manager Console, it shows:
dotnet : The term 'dotnet' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
dotnet
CategoryInfo: ObjectNotFound: (dotnet:String) [], CommandNotFoundException
FullyQualifiedErrorId: CommandNotFoundException
But I open terminal and run same command, it works.
How to solve it?

How to run nuget on Mac osx

I'm trying to open a Windows compiled c# solution in monodevelop on my Mac os x mountain lion, and the solution has nuget packages in it.
When I try to compile I get the following errors:
var/folders/bk/sqxq4pw50lsb807cw8x865gc0000gn/T/tmp4586d973.tmp:
line 1: wget: command not found
/Users/(my name)/Downloads/SteamBot-master/.nuget/NuGet.targets:
error : Command 'mozroots --import
--sync;wget -O '/Users/(my name)/Downloads/SteamBot-master/.nuget/NuGet.exe'https://nuget.org/nuget.exe'
exited with code: 127.
Task "Exec" execution -- FAILED
What should I do to make it work?
line 1: wget: command not found
The error is about 'wget' not existing. OS-X does not come with 'wget' out of the box (it has curl).
Use homebrew (my fav):
> brew install wget
Or Use MacPorts:
> sudo port wget
Or manually install from source
After you can execute 'which wget' or 'wget --version' and get a valid reply, try building your project again.

mono mcs 'Winforms Hello World' gives compile error CS006: Metadata file 'cscompmgd.dll' could not be found

I'm new to linux and mono. I installed mono to a new Raspberry Pi machine using
sudo apt-get install mono-complete.
I also did the update and upgrade using apt-get.
I then followed the helloWorld examples in the Mono Basics page in mono-project website:
http://www.mono-project.com/docs/getting-started/mono-basics/
I managed to build and run the first 'Console Hello World' example using the following:
mcs hello.cs
mono hello.exe
However, when I tried the next example 'Winforms Hello World', I encountered the following error when running 'mcs hello.cs -pkg:dotnet':
error CS0006: Metadata file 'cscompmgd.dll' could not be found
However, it works if i use gmcs instead of mcs.
I googled here and there but no luck.
I can find a link to this file 'cscompmgd.dll' in '/usr/lib/mono/2.0' directory in my Raspberry Pi.
The installed mono version is 3.2.8 (returned by using 'mono --version').
Does anyone know why it works with gmcs but it doesn't work with mcs?
Thank you.
Solved by adding the -lib: option like this:
mcs helloWinforms.cs -pkg:dotnet -lib:/usr/lib/mono/2.0
Solution with adding
-lib:/usr/lib/mono/2.0
was not the best in my case (it broke a dependency on some 4.0 elements, specifically 'System.Threading').
Dirty, but works
Another, very dirty solution is to copy the
/usr/lib/mono/2.0/cscompmgd.dll
to your project folder (or wherever the Makefile is) and add
-r:cscompmgd.dll
when compiling (or add the filename after list of other included libraries specified by '-r').
There is probably a way to do that without copying the file, but that is beyond my capabilities.
So you end up with:
mcs helloWinforms.cs -pkg:dotnet -r:cscompmgd.dll

Categories