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.
Related
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
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.
I have installed the preview version of Microsoft's new code editor "Visual Studio Code". It seems quite a nice tool!
The introduction mentions you can program c# with it, but the setup document does not mention how to actually compile c# files.
You can define "mono" as a type in the "launch.json" file, but that does not do anything yet. Pressing F5 results in: "make sure to select a configuration from the launch dropdown"...
Also, intellisense is not working for c#? How do you set the path to any included frameworks?
Launch.json:
"configurations": [
{
// Name of configuration; appears in the launch configuration drop down menu.
"name": "Cars.exe",
// Type of configuration. Possible values: "node", "mono".
"type": "mono",
// Workspace relative or absolute path to the program.
"program": "cars.exe",
},
{
"type": "mono",
}
Since no one else said it, the short-cut to compile (build) a C# app in Visual Studio Code (VSCode) is SHIFT+CTRL+B.
If you want to see the build errors (because they don't pop-up by default), the shortcut is SHIFT+CTRL+M.
(I know this question was asking for more than just the build shortcut. But I wanted to answer the question in the title, which wasn't directly answered by other answers/comments.)
Intellisense does work for C# 6, and it's great.
For running console apps you should set up some additional tools:
ASP.NET 5; in Powershell: &{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}
Node.js including package manager npm.
The rest of required tools including Yeoman yo: npm install -g yo grunt-cli generator-aspnet bower
You should also invoke .NET Version Manager: c:\Users\Username\.dnx\bin\dnvm.cmd upgrade -u
Then you can use yo as wizard for Console Application: yo aspnet Choose name and project type. After that go to created folder cd ./MyNewConsoleApp/ and run dnu restore
To execute your program just type >run in Command Palette (Ctrl+Shift+P), or execute dnx . run in shell from the directory of your project.
SHIFT+CTRL+B should work
However sometimes an issue can happen in a locked down non-adminstrator evironment:
If you open an existing C# application from the folder you should have a .sln (solution file) etc..
Commonly you can get these message in VS Code
Downloading package 'OmniSharp (.NET 4.6 / x64)' (19343 KB) .................... Done!
Downloading package '.NET Core Debugger (Windows / x64)' (39827 KB) .................... Done!
Installing package 'OmniSharp (.NET 4.6 / x64)'
Installing package '.NET Core Debugger (Windows / x64)'
Finished
Failed to spawn 'dotnet --info' //this is a possible issue
To which then you will be asked to install .NET CLI tools
If impossible to get SDK installed with no admin privilege - then use other solution.
Install the extension "Code Runner". Check if you can compile your program with csc (ex.: csc hello.cs). The command csc is shipped with Mono. Then add this to your VS Code user settings:
"code-runner.executorMap": {
"csharp": "echo '# calling mono\n' && cd $dir && csc /nologo $fileName && mono $dir$fileNameWithoutExt.exe",
// "csharp": "echo '# calling dotnet run\n' && dotnet run"
}
Open your C# file and use the execution key of Code Runner.
Edit: also added dotnet run, so you can choose how you want to execute your program: with Mono, or with dotnet. If you choose dotnet, then first create the project (dotnet new console, dotnet restore).
To Run a C# Project in VS Code Terminal
Install CodeRunner Extension in your VS Code (Extension ID: formulahendry.code-runner)
Go to Settings and open settings.json
Type in code-runner.executorMap
Find "csharp": "scriptcs"
Replace it with this "csharp": "cd $dir && dotnet run $fileName"
Your project should Run in VS Code Terminal once you press the run button or ALT + Shift + N
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
I'm trying to build a native monobjc bundle from the command line using xbuild (on OSX 10.8). I've built my Cocoa Application using Xamarin Studios and the Monobjc addin. I can successfully run "Create Monobjc Bundle" > "Export As Native Application" and get an app that is redistributable. However, when I try to run the xbuild command from the Terminal, I get the following:
$xbuild /p:Configuration=Release TestProject.csproj /t:BundleNative
Build FAILED.
Errors:
/Users/Test/Documents/test/TestProject.csproj (BundleNative) ->
/Library/Frameworks/Mono.framework/Versions/2.10.12/lib/mono/4.0/Monobjc.CocoaApplication.targets (CoreBundleNative target) ->
/Library/Frameworks/Mono.framework/Versions/2.10.12/lib/mono/4.0/Monobjc.CocoaApplication.targets: error : clang: warning: argument unused during compilation: '-pthread'
/Library/Frameworks/Mono.framework/Versions/2.10.12/lib/mono/4.0/Monobjc.CocoaApplication.targets: error : Error executing task EncryptFiles: Required property 'EncryptionSeed' not set.
0 Warning(s)
2 Error(s)
I've set the <EncryptionSeed> attribute of the csproj to some arbitrary value to see if that was the issue. But alas, I've gotten nowhere. As you can see I'm using Mono 2.10.12 (the SDK) and Monobjc 4.0.2167.11 that was installed via Xamarin. Any help would be appreciated.
UPDATE 1:
I fixed the encryption seed error by installing the newest monobjc bridge via the monobjc package from the monobjc download page (5.0.2165.0), however still the error about the pthread, which occurs during the embed application step:
Compiling...
Arguments: ' -Os -gdwarf-2 -arch i386 -mmacosx-version-min=10.8 -I"bin/Release//Embed" -c "bin/Release//Embed/main.c" -o "bin/Release//Embed/main.o" -D_THREAD_SAFE -I/Library/Frameworks/Mono.framework/Versions/2.10.12/include/mono-2.0 '
-pthread -L/Library/Frameworks/Mono.framework/Versions/2.10.12/lib -lmono-2.0 -lpthread
Linking...
Arguments: ' -arch i386 -mmacosx-version-min=10.8 -L"bin/Release//Embed" -pthread -L/Library/Frameworks/Mono.framework/Versions/2.10.12/lib -lmono-2.0 -lpthread -lz -lmonobjc -lTest_exe -lMono_Posix_dll -lMono_Security_dll -lMonobjc_AppKit_dll -lMonobjc_dll -lMonobjc_Foundation_dll -lMonobjc_ScriptingBridge_dll -lmscorlib_dll -lMSWordInterface_dll -lSystem_Configuration_dll -lSystem_Core_dll -lSystem_dll -lSystem_Runtime_Serialization_dll -lSystem_Security_dll -lSystem_Xml_dll -lmachine_config -o "bin/Release//Embed/Test" "bin/Release//Embed/main.o" '
/Library/Frameworks/Mono.framework/Versions/2.10.12/lib/mono/4.0/Monobjc.CocoaApplication.targets: error : clang: warning: argument unused during compilation: '-pthread'
Embedding done
The EncryptionSeed tag was introduced in the latest Monobjc MonoDevelop Addin to handle resources encryption and is only handled by Monobjc 5.0 serie.
As for the clang message, this is not quite an error. If you read the description, you will notice that this is a warning. The clang compiler is called through the Process class which allow the capture of the standard output and error streams. Unfortunately, the warnings are reported on the standard error stream: this is why the embedding task reports some errors when there are only warnings.
Please file a bug if you think the problem is a showstopper.