Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6686181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:08:33+00:00 2026-05-26T05:08:33+00:00

I am using protocol buffer in .net http://code.google.com/p/protobuf-net/ . I installed the visual studio

  • 0

I am using protocol buffer in .net http://code.google.com/p/protobuf-net/.

I installed the visual studio support version, which I can just write proto file in project and it generates csharp class files automatically.

A lot of times that I need to dump the files into xml(or another text format if available) file. I found that there is a method Serializer.Serialize() which takes an XmlWriter parameter. I tried to use it but it complains that the protobuf type I defined must be convertible to system.Xml.Serialization.IXmlSerializable.

In my case, what I should do in order for my type can be convertible to System.Xml.Serialization.IXmlSerializable? I don’t want to change the cs file directly since it is generated on the fly when the proto file is changed.

thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:08:33+00:00Added an answer on May 26, 2026 at 5:08 am

    Protobuf-net does not write xml; that API is intended to allow you to write protobuf data as an opaque BLOB (base-64) within an xml stream. However, protobuf-net is usually very happy to allow side-by-side use with XmlSerializer – it respects most of the same metaphors. Most likely, simply using new XmlSerializer(typeof(YourRootType)) to serialize your object will work fine. In fact, part of the internal processing for code-generation from .proto relies on this duality.

    If you want explicit xml markers in your generated code (i.e. [XmlType(...)], etc), simply use the p:xml command-line option, which (if you are using the IDE tools) can also be achieved by using ;xml in the “Custom Tool Namespace” (this really isn’t obvious, but it is one of the few places I found where it would accept extra data):

    enter image description here

    Basically, anything entered on the “Custom Tool Namespace” is assumed (by protobuf-net) to be a semicolon list starting with the desired namespace, followed by options for the generator; hence ;xml uses the default namespace, then adds the “xml” option, the same as doing p:xml on the command line.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using google's protocol buffer compiler for c++ its not clear which is faster: optimize
I am using protobuf-net in my .net project to use protocol buffer. The project
I'm setting up a net.tcp WCF service using instructions here: http://blogs.msdn.com/swiss_dpe_team/archive/2008/02/08/iis-7-support-for-non-http-protocols.aspx One of the
I'm writing a system that has a set of protocol buffers (using protobuf-net), I
Using google's Protocul Buffers , I have a service already written in Java which
I need to test for general URLs using any protocol (http, https, shttp, ftp,
I have 4 files message.proto udp.h udp.cpp main.cpp message.proto is a google protocol buffer
I am using protobuf-net on the project I am working on for the data
The Weirdness I have compiled Google Protocol Buffers using no extra parameters for a
Do you know about any example using together Google Protocol Buffers and GWT?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.