Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Missing reference??

Posted on 2011-02-12
3
Medium Priority
?
2,099 Views
Last Modified: 2012-05-11
I've got a C# web service that uses the "XmlDictionaryWriter" object as shown in the code below.  Using the object explorer I can see this is part of "System.XML".  But niether including the reference nor explicit declaration can find the namespace.

This gets extra strange because I have a second project which uses the same exact class, and "XmlDictionaryWriter" IS found.  What is going on here?  One reference is stopping my build.
using System;
using System.ServiceModel.Channels;
using System.Xml;

namespace Batch
{
    public class SampleHeader : MessageHeader
    {
        private string name;
        private string value;

        public SampleHeader(string name, string value)
        {
            this.name = name;
            this.value = value;
        }

        public override string Name { get { return name; } }
        public override string Namespace { get { return "http://monkey.sample.com/doc/2007-01-01/"; } }

        protected override void OnWriteHeaderContents(XmlDictionaryWriter xmlDictionaryWriter, MessageVersion messageVersion)
        {
            xmlDictionaryWriter.WriteString(value);
        }
    }
}

Open in new window

0
Comment
Question by:Phil5780
3 Comments
 
LVL 16

Expert Comment

by:BurnieP
ID: 34880192
Hi,

Do you have

using System.Xml.XmlDictionaryWriter;

defined in your using section?
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 2000 total points
ID: 34880211
@BurnieP

XmlDictionaryWriter is a class, not a namespace   = )

You need to add a reference to System.Runtime.Serialization. The namespace is still System.Xml though.
0
 

Author Closing Comment

by:Phil5780
ID: 34880375
Solved by recreating my project as an ASP.NET website and not a WSDL project.  It appears XMLDictionaryWriter is not available in a web service project.  (No new references added)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question