|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
The type or namespace name `WebClient' could not be found.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? 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 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 |
|
|
Re: The type or namespace name `WebClient' could not be found.Response inline.
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? It is System.Net.WebClient, so the latter should work. But the casing is wrong in the former. Works for me anyway: linux@linux:~> cat wc.cs using System; using System.Net; class Foo { static void Main() { WebClient cli = new WebClient(); Console.WriteLine(); } } linux@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@linux:~>
|
|
|
Re: The type or namespace name `WebClient' could not be found.I'm using xbuild. Would that cause the problem?
|
|
|
Re: The type or namespace name `WebClient' could not be found.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
|
| Free Forum Powered by Nabble | Forum Help |