[Mono-list] The type or namespace name `WebClient' could not be found.

Andy Hume andyhume32 at yahoo.co.uk
Wed Aug 27 12:12:41 EDT 2008



Chris F wrote:
> 
> I'm using xbuild.  Would that cause the problem?
> 

In short: https://bugzilla.novell.com/show_bug.cgi?id=389887  I don't know
if anyone is working to fix that.

A workaround, I presume, would be to remove that assembly from the GAC.  ?
gacutil -u "System, Version=2.1.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"

Or, simply copy the arguments from the xbuild output log, replace the 2.1
reference with the 2.0 one, and run gmcs manually with them...

Or, use MonoDevelop.  It can cope with csproj's.  And doesn't use xbuild?  A
MonoDevelop person can confirm?  If so what's the status of xbuild...

Andy



Chris F wrote:
> 
> 
> Andy Hume wrote:
>> 
>> Response inline.
>> 
>> 
>> Chris F wrote:
>>> 
>>> I'm trying to compile a C# app on Ubuntu with Mono 1.9.1
>>> Mono was compiled with only --prefix.
>>> 
>>> The code is:
>>> 
>>> using System;
>>> using System.Web;
>>> using System.IO;
>>> using System.Xml;
>>> .
>>> .
>>> .
>>> 
>>> WebClient imgClient = new WebClient();
>>> 
>>> 
>>> Now when I compile:
>>> Target CoreCompile:
>>>                 Tool /opt/mono-1.9.1/bin/gmcs execution started with
>>> arguments: /noconfig /debug:full /debug+ /optimize-
>>> /out:bin/Debug/ECommerceBridge.Plugins.dll PluginBase.cs
>>> Properties/AssemblyInfo.cs UserFilesManager.cs CredentialsManager.cs
>>> CartManager.cs /target:library /unsafe- /define:DEBUG;TRACE
>>> /reference:/opt/mono-1.9.1/lib/mono/gac/log4net/1.2.9.0__b32731d11ce58905/log4net.dll
>>> /reference:/d0/ecommercebridge/Bin/ECommerceBridge.API.dll
>>> /reference:/d0/ecommercebridge/Bin/Modules.Model.dll
>>> /reference:/d0/ecommercebridge/Bin/MySql.Data.dll
>>> /reference:/opt/mono-1.9.1/lib/mono/gac/System/2.1.0.0__b77a5c561934e089/System.dll
>>> /reference:/opt/mono-1.9.1/lib/mono/gac/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
>>> /reference:/opt/mono-1.9.1/lib/mono/gac/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
>>> /reference:/opt/mono-1.9.1/lib/mono/gac/System.Web/2.0.0.0__b03f5f7f11d50a3a/System.Web.dll
>>> /reference:/opt/mono-1.9.1/lib/mono/gac/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
>>> /warn:4
>>> UserFilesManager.cs(51,9):   error CS0246:  The type or namespace name
>>> `WebClient' could not be found. Are you missing a using directive or an
>>> assembly reference?
>>> UserFilesManager.cs(90,17):   error CS0246:  The type or namespace name
>>> `WebClient' could not be found. Are you missing a using directive or an
>>> assembly reference?
>>> 
>> 
>> There's something wrong there. 
>> "...gac/System/2.1.0.0__b77a5c561934e089/System.dll" is a reference to
>> the Silverlight version of System.dll.  It should reference version 2.0. 
>> I don't know why that has happened.  Are you compiling in MonoDevelop? 
>> Maybe someone else can explain why that might happen.
>> 
>> Or are you using xbuild?
>> 
>> 
>> Chris F wrote:
>>> 
>>> From what I gather System.Net is included in System.
>>> Also I've tried adding: using System.net that doesn't work
>>> Tried prepending WebClient with System.Net that doesn't work
>>> 
>> 
>> It is System.Net.WebClient, so the latter should work.  But the casing is
>> wrong in the former.
>> 
>> Works for me anyway:
>> 
>> linux at linux:~> cat wc.cs 
>> using System;
>> using System.Net;
>> 
>> class Foo
>> {
>>     static void Main()
>>     {
>>         WebClient cli = new WebClient();
>>         Console.WriteLine();
>>     }
>> }
>> linux at linux:~> gmcs wc.cs 
>> wc.cs(8,19): warning CS0219: The variable `cli' is assigned but its value
>> is never used
>> Compilation succeeded - 1 warning(s)
>> linux at linux:~> 
>> 
>> 
>> 
>> Chris F wrote:
>>> 
>>> I've added it as a direct reference in an ItemGroup in the csproj file..
>>>     <Reference Include="System.Net" />
>>> 
>>> It doesn't like that at all.
>>> 
>>> How can I get this to compile?
>>> I'm at my wits end.
>>> 
>>> Thanks
>>> 
>>> Chris
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/The-type-or-namespace-name-%60WebClient%27-could-not-be-found.-tp19171520p19184351.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list