Missing Assembily Reference

848 views Asked by At

I have produced a custom class serializer for a sole class contained in 'VcdcClassStructure.dll' using sgen as-per the documentation. The documents now state that all I need to do is

  1. Add assembaly references to both 'VcdcClassStructure.dll' and the sgen-generated 'VcdcClassStructure.XmlSerializers.dll'.

  2. Add references to the namespace that contains the newly generated serialization classes via

    using VcdcClassStructure; using Microsoft.Xml.Serialization.GeneratedAssembly;`

(I have confirmed that the namespaces are correct using DotPeek).

I have then changed my code from

XmlSerializer serializer = new XmlSerializer(typeof(message));
serializer.Serialize(writer, vcdMsg);

to

messageSerializer serializer = new messageSerializer();
serializer.Serialize(writer, vcdMsg);

but on compilation I am getting

The type or namespace name 'VcdcClassStructure' could not be found (are you missing a using directive or an assembly reference?)

and

The type or namespace name 'Xml' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

I have reference the relevant assemblies and added the using code for the namespace. Why is the compiler complaining about these references?

Thanks for your time.


Edit. To prove that I have not missed any of the steps above.

enter image description here

1

There are 1 answers

5
Marc Gravell On BEST ANSWER

I've checked, and the process described works correctly. I would have to assume, therefore, that you've made an error in the steps. It works fine (note: the type I created in the library was SomeType, hence the names):

enter image description here

You might want to try going through the steps again.