How can I use Mono.Unix on Linux? - c#

I have a C# app originally written in Windows that I'm now running in Linux on MonoDevelop. It works fine but now I need to recognise symbolic links. I found this answer but when I add:
using Mono.Unix;
I get the error "The type or namespace name 'Unix' does not exist in the namespace 'Mono'. Are you missing an assembly reference (CS0234)?"

You need to do what the error message says. Unintuitively, Mono.Unix lives in Mono.Posix.dll, so you need to add that as reference.

Related

Namespace name "Device" does not exist in the namespace

I have a problem using System.Device and can't find a solution
I'm developing a software and want to get the position of the device. By referencing the .NET Framework I want to use the GeoCoordinateWatcher.
In my code I included System.Device.Location and added two packages to the project (GeoCoordinate and System.Device.Location.Portable). While running and debugging the code in monodevelop no error occurs, but when I compile the code with mcs the error mentioned in the title occurs:
Namespace name "Device" does not exist in the namespace
Im using a RasPi for coding and compiling.
Any idea what the problem is?
System.Device is not supported by Mono:
https://github.com/mono/mono/tree/master/mcs/class

Error with UWP application in Visual Studio 2017

In my current UWP application, I am receiving 19062 errors, all of which begin with "The .winmd file (filename) contains type (type name) outside its root namespace (namespace name)." Examples of the full error code are shown below.
I have attempted the following to resolve the error:
Restarting Visual Studio
Rebuilding the Solution
Reinstalling the most recent version of the Windows SDK
Restarting my computer
The project was building fine a few days ago. Since then, I have not done anything to my computer which would result in such an issue with my solution.
Here are the error code examples:
"The .winmd file 'Windows.Foundation.UniversalApiContract.winmd' contains type 'Windows.ApplicationModel.Search.ISearchQueryLinguisticDetails' outside its root namespace 'Windows.Foundation.UniversalApiContract'. Make sure that all public types appear under a common root namespace that matches the output file name."
"The .winmd file 'Windows.Foundation.UniversalApiContract.winmd' contains type 'Windows.Graphics.Display.DisplayInformation'. The use of the Windows namespace is reserved."
"The .winmd file 'Windows.Foundation.UniversalApiContract.winmd' contains type 'Windows.UI.Xaml.Automation.IValuePatternIdentifiers' outside its root namespace 'Windows.Foundation.UniversalApiContract'. Make sure that all public types appear under a common root namespace that matches the output file name."
I am relatively new to UWP, and am failing to interpret the error. Any help would be much appreciated. Thanks in advance for any help.
Jordan.
The project needed to be cleaned to avoid these errors. OP confirmed in comments that it was a cause.

C# and MonoDevelop on Ubuntu - missing system libraries contents

I wanted to make a use of Mono on Ubuntu 14.04.3 LTS in order to write some client-server app using C# language.
I followed this tutorial and installed everything Mono needs to be compiling and running C# .NET apps on Ubuntu.
Then I installed MonoDevelop 5.9.6 according to this tutorial which was actually installing three packages: monodevelop, l monodevelop-nunit, monodevelop-versioncontrol (I skipped database package as I don't need it for now).
I created simple console application in MonoDevelop and now I am trying to use some code which referencen to System.Net.Sockets (and other) system library class. I added to my project's references the System.Net.dll, which is located under usr/lib/mono/4.5 after Mono installation.
Apparently I cannot compile my app as I get the errors like:
Error CS0234: The type or namespace name `Sockets' does not exist in the namespace `System.Net'. Are you missing an assembly reference? (CS0234) (Communicator.Presentation)
I completely cannot get what is going on here. I've searched through net and forums and cannot find the answer for that issue.
I am also providing the screenshot from my PC with MonoDevelop opened where you can see that System.Net reference is added to the project, but the inside classes are not visible. When I type "System.Net." it only allows me to choose "System.Net.IPEndPointCollection" and nothing else:
EDIT:
What is also weird it that if i double-click on that System.net reference in MonoDevelop in the "Assembly Browser" windows I can see the contents of this "System.net.dll" and especially System.Net.Sockets is present there...:
You don't need System.Net.dll to be included, as you are looking for System.Net.Sockets namespace which exists inside System.dll. So you need to add reference to System.dll. See this link for more details.
So you need following reference:
using System;
I am also attaching my Ubuntu with MonoDevelop snapshots. In these snapshots, you can see that I don't have any reference to System.Net.dll, inside my project references, just System.dll is needed.
Hope this helps.

how to solve the type and namespace could not be found

I am trying to make a cross platform application using MONO. i developed the project into c#(windows) and I want to run that project into Linux. For that purpose i am using MONO.But when i am running my project then I am getting error that the type and namespace could not be found.Actually I have created two partition of the project ,one is main function and other is the rest of the logic.And to access the other functionality i am using the namespace.but when i am running i am getting error
Here is the line where i am getting error in line 2 and 3
You need to pass the referenced assembly path using -pkg switch. I think you did not reference VehicleRoutPlannerCore dll while compiling.
Please refer to http://linux.die.net/man/1/mcs
you should invoke it like
mcs -pkg:path-to-VehicleRoutPlannerCore-assembly VehicleRoutingConsole.cs

Why am I getting the following error when compiling this assembly?

I'm attempting to use the following command line command to compile an assembly of the code from my project:
C:/"Program Files"/Unity/Editor/Data/Mono/bin/gmcs
-target:library -out:C:/Users/Austin/Desktop/PixelExpanse.dll
-recurse:C:/Users/Austin/Desktop/Projects/Repos/trunk/PixelExpanse/SpaceColonyRefactor/Assets/Source/*.cs
-d:RUNTIME -r:C:/"Program Files"/Unity/Editor/Data/Managed/UnityEngine.dll
As you can see, I am, I believe, correctly referencing the UnityEngine.dll.
The code that would be compiled contains references to UnityEngine.UI and UnityEngine.EventSystems. But when I run the above command, I get the following compile error:
error CS0234: The type or namespace name 'EventSystems' does not exist in the namespace 'UnityEngine'. Are you missing an assembly reference?
From what I have been able to find through googling, it SEEMS like an error people were getting when using a pre-4.6 assembly, because thats when EventSystems and UI were both introduced. But I don't know how I could be missing that in the dll I'm referencing as Unity 5 is the only version that has ever touched this computer.
As a side note, I have posted this question to Unity Answers and have yet to receive a response. I expect it's because assembly compilation is beyond the scope of what most users there choose to undertake. Hence my asking it here.
The namespace UnityEngine.EventSystems actually appears in UnityEngine.UI.dll and not UnityEngine.dll so it seems you need to reference the former too when compiling manually from the command-line. Unity projects have this by default (see below).
This is verified by opening up the assembly in your reflector tool of choice, here I am using JetBrains dotPeek:
This is how my test project appears with default Unity references. Note that by default a reference to UnityEngine.UI already appears in the Unity-created project:
When I built my Windnows desktop app via Unity, the above dlls appeared in:
<drive>:<projectOutFolder>\<projectName>_Data\Managed
You can try:
right click on "project panel", and after "Reimport All".
It's can be happen due to switch between platforms, e.g. IOS, or Desktop.. thus, folrders are deleted by became unecessary..
Solve for me: Unity 5.2, Win 7, 32bits;
Good luck!
I checked the UnityEngine.dll and the Eventsystems/UI namespace is not included. Despite, there is a dll in Unity5\Editor\Data\UnityExtensions\Unity\GUISystem\UnityEngine.UI.dll which includes these namespaces.
For mac, it's /Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll.

Categories