2

When i try to build and run my project i get the following build errors:

HourScreen.cs(13,13): Error CS0433: The imported type `System.Net.WebRequest' is defined    multiple times (CS0433)
HourScreen.cs(17,17): Error CS0433: The imported type `System.Net.WebResponse' is defined multiple times (CS0433)

The lines on which the errors happen look like this:

WebRequest request = WebRequest.Create(uri);
WebResponse response = request.GetResponse();

I include the following into the project:

using System;
using System.Net;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using System.Text.RegularExpressions;

using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.Preferences;
using Android.Graphics;

I think one of the includes must be playing up but i have no idea which. Removing one causes a huge load of other errors. Can anyone see where im going wrong?

EDIT:

I've included the build log: http://pastebin.com/FrmzfhcY

4
  • It won't be namespace related but assembly related. Please edit your post to show how this assembly was compiled, i.e. so we can see every references. Commented Dec 7, 2011 at 16:57
  • I could not find the assembly browser in MonoDevelop, how can i access it? Sorry but i'm still quite new to this. Commented Dec 8, 2011 at 8:08
  • There's a "Build Output" button in MonoDevelop's "Error List" pane that will show you the compilation log. That should include everything referenced (and be easy to copy-paste). Commented Dec 8, 2011 at 12:53
  • I've added the build log to my question. Commented Dec 8, 2011 at 13:15

1 Answer 1

2
HourScreen.cs(167,17): error CS0433: The imported type `System.Net.WebResponse' is defined multiple times
                /Developer/MonoAndroid/usr/lib/mono/2.1/System.dll (Location of the symbol related to previous error)
                /Mono for Android/Bups_Urenverantwoording 1.0/Bups_Urenverantwoording/bin/Debug/System.Net.dll (Location of the symbol related to previous error)

The log has your answer. Mono for Android provides it's own System.Net stack in System.dll but you're also including other assemblies, like System.Net.dll which includes the same type.

Since you also reference System.Windows.dll I assume you're trying to include some code from Silverlight (or Moonlight) and that won't work. At least not for for System.Net.dll (not sure what you're trying to use from System.Windows.dll).

Sign up to request clarification or add additional context in comments.

1 Comment

I had added a file from a different project into my new project. That file had a load of includes to different System.Window which wernt even used. Removing them solved the error. Thanks for your help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.