zu starten, ich kopierte diesen Code von der Microsoft-Website:Mono Compilation Fehler in C#
using System;
namespace HelloWorld
{
class Hello
{
static void Main()
{
Console.WriteLine("Hello World!");
// Keep the console window open in debug mode.
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
}
}
}
Dies wird gespeichert als HelloWorld.cs Dies alles schön und gut ist.
Das eigentliche Problem beginnt, wenn ich mit der Kompilierung beginne. Zuerst versuche ich mcs HelloWorld.cs
verwendet, die diesen Fehler auftauchen:
bash: mcs: command not found
wenn ich mono --aot HelloWorld.cs
verwenden, ich diesen Fehler:
Cannot open assembly 'HelloWorld.cs': File does not contain a valid CIL image.
einen RPI 3 unter Verwendung von Raspbian und Mono Runtime v2.0.50727 verwenden.
Wie kann ich dieses Programm kompilieren?
Debug von dem Versuch, mono-komplett zu installieren:
[email protected]:~ $ sudo apt-get install mono-complete
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
mono-complete : Depends: mono-runtime (= 5.4.1.6-0xamarin1+raspbian9b1) but 3.2.8+dfsg-10 is to be installed
Depends: mono-runtime-sgen (= 5.4.1.6-0xamarin1+raspbian9b1) but it is not going to be installed
Depends: mono-utils (= 5.4.1.6-0xamarin1+raspbian9b1) but it is not going to be installed
Depends: mono-devel (= 5.4.1.6-0xamarin1+raspbian9b1) but it is not going to be installed
Depends: mono-mcs (= 5.4.1.6-0xamarin1+raspbian9b1) but it is not going to be installed
Depends: mono-roslyn (= 5.4.1.6-0xamarin1+raspbian9b1) but it is not going to be installed
Depends: mono-csharp-shell (= 5.4.1.6-0xamarin1+raspbian9b1) but it is not going to be installed
Depends: mono-4.0-gac (= 5.4.1.6-0xamarin1+raspbian9b1) but it is not going to be installed
Depends: mono-4.0-service (= 5.4.1.6-0xamarin1+raspbian9b1) but it is not going to be installed
Depends: monodoc-base (= 5.4.1.6-0xamarin1+raspbian9b1) but it is not going to be installed
Depends: monodoc-manual (= 5.4.1.6-0xamarin1+raspbian9b1) but it is not going to be installed
Depends: libmono-cil-dev (= 5.4.1.6-0xamarin1+raspbian9b1) but it is not going to be installed
Depends: ca-certificates-mono (= 5.4.1.6-0xamarin1+raspbian9b1) but it is not going to be installed
mono-runtime : Depends: mono-runtime-sgen (= 3.2.8+dfsg-10) but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
1. Wie tf würden Sie herunterladen mcs – ReedsShorts
2. Würden Sie nicht haben einen anderen Computer zu verwenden, um Run .NET Core und dann auf den Pi kopieren? Ich verwende nur das RPI. – ReedsShorts
Wenn du das RPI selbst kompilierst, dann musst du bei Mono bleiben. Du hättest "mcs" bekommen sollen, als du Mono installiert hast, damit es nur das Dateisystem durchsucht, um zu sehen, wo es ist. Sonst ist hier ein Link zum direkten Download: http://www.mono-project.com/docs/about-mono/languages/csharp/#working-with-mcs –