Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Solved] Mono - mcs compiler does not see installed libraries?

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
User avatar
dashek
Posts: 47
Joined: 2022-12-03 20:59
Has thanked: 7 times
Been thanked: 5 times

[Solved] Mono - mcs compiler does not see installed libraries?

#1 Post by dashek »

Hello,

I'm a C# novice, and I walked into such problem:

Code: Select all

using System.Xml.Linq;
during compilation throws an error:

Code: Select all

foo.cs(1,18): error CS0234: The type or namespace name `Linq' does not exist in the namespace `System.Xml'. 
Are you missing `System.Xml.Linq' assembly reference?
So, I checked if I have proper "libmono" package on my Debian box. It turned out, that i don't have one, so I installed "libmono-system-xml-linq4.0-cil" package. Tried to compile with just "mcs foo.cs" and the error persists.
Also tried with

Code: Select all

mcs -lib:/usr/lib/mono/4.5/System.Xml.Linq.dll foo.cs
without success.

Do I understand the situation properly? What should I try next?

Thank you for your help in advance.
Last edited by dashek on 2023-11-16 22:37, edited 1 time in total.

Random_Troll
Posts: 444
Joined: 2023-02-07 13:35
Been thanked: 105 times

Re: Mono - mcs compiler does not see installed libraries?

#2 Post by Random_Troll »

Have you tried adding an assembly reference, as suggested by the error message?

I don't use C# myself but a quick search suggests

Code: Select all

<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
It's always best to share the actual code when requesting assistance though, is that possible here? I'm sure there are other forum members more versed with C# than me and it might encourage them to participate.
Jeder nach seinen Fähigkeiten, jedem nach seinen Bedürfnissen.

User avatar
dashek
Posts: 47
Joined: 2022-12-03 20:59
Has thanked: 7 times
Been thanked: 5 times

Re: Mono - mcs compiler does not see installed libraries?

#3 Post by dashek »

Random_Troll wrote: 2023-05-29 08:34 Have you tried adding an assembly reference, as suggested by the error message?
Thank you! I thought that i knew what's an "assembly reference", but it turned out that I was wrong :lol:
The solution that worked:

Code: Select all

mcs /reference:System.Xml.Linq foo.cs

Post Reply