Questions tagged [sgen]

The Microsoft XML Serializer Generator Tool - creates xml serialiser assembly from an existing assembly.

The Microsoft XML Serializer Generator Tool - creates xml serialiser assembly from an existing assembly.

https://learn.microsoft.com/en-us/dotnet/standard/serialization/xml-serializer-generator-tool-sgen-exe

92 questions
6
votes
2 answers

SGEN doesn't work after upgrading from VS2008 to VS2010

I just recently upgraded a VS2008/.NET 3.5 SP1 project to VS2010 and .NET 4. I have a post-build event which calls SGEN to generate the XmlSerializers assembly. Whenever I try to run it I get the following error. "C:\Program Files\Microsoft…
sourcenouveau
  • 29,356
  • 35
  • 146
  • 243
6
votes
3 answers

sgen.exe build error "Unable to load one or more of the requested types"

I am building a solution which contains several solutions. All but one of them build without any problems. The problematic one emits the following message: Error 2 Unable to load one or more of the requested types. Retrieve the…
ATL_DEV
  • 9,256
  • 11
  • 60
  • 102
5
votes
1 answer

MyAssembly.XmlSerializers.dll not generated

I am using WCF Test Client to make a request to a service, however i get the following error: Could not load file or assembly 'aDoc_Client.XmlSerializers' or one of its dependencies. The system cannot find the file specified. Server stack trace: …
BrunoMartinsPro
  • 1,646
  • 1
  • 24
  • 48
5
votes
2 answers

Unable to generate a temporary class - Cryptographic failure while signing assembly

I have a signed class library that I want to create assemblies for via the sgen tool. However, I get an error when I try to run the following command: $ sgen.exe /a:testsign.dll /force /compiler:/keyfile:..\..\testsign.pfx /verbose /n Error:…
default
  • 11,485
  • 9
  • 66
  • 102
4
votes
2 answers

SGEN error reflecting type

I have implemented the change mentioned in the accepted answer of Generating an Xml Serialization assembly as part of my build
Seph
  • 8,472
  • 10
  • 63
  • 94
4
votes
0 answers

Providing private key for SGEN

My .NET assembly is signed with digital certificate from comodo. I use SGEN to generate serialization assembly. SGEN requires a key file in order to generate such assembly for a signed source. I tried the following lines: sgen.exe /force…
Alex
  • 1,357
  • 3
  • 18
  • 41
4
votes
1 answer

Missing SecurityProtocolType.Ssl3 enum value during XML serialization

I have the following simple XML serializable type: [XmlType] public class TestType { public System.Net.SecurityProtocolType ProtocolType { get; set; } } var instanceToSerialize = new TestType { ProtocolType = SecurityProtocolType.Ssl3 |…
huseyint
  • 14,953
  • 15
  • 56
  • 78
4
votes
2 answers

Pre-generating XmlSerializers using Sgen and ILMerge. Trouble with arrays

I use XmlSerializer extensively and rather than allowing .NET to generate the necessary serialization assemblies at runtime, I'd like to generate these assemblies ahead of time and bundle them with my application. I am able to use Sgen to generate…
anthony
  • 40,424
  • 5
  • 55
  • 128
3
votes
1 answer

.XmlSerializers.dll how to use it - confused by examples over the Internet

I'm quite newbie to C#. I've started to use SGEN generated XmlSerializers.dll and I'm really confused right now. Despite that I cannot find any true step by step tutorial how to use it properly I'm also confused by different advices. I read a lot of…
binball
  • 2,255
  • 4
  • 30
  • 34
3
votes
3 answers

What is the most efficient way to Deserialze an XML file

Aloha, I have a 8MB XML file that I wish to deserialize. I'm using this code: public static T Deserialize(string xml) { TextReader reader = new StringReader(xml); Type type = typeof(T); XmlSerializer serializer = new…
edosoft
  • 17,121
  • 25
  • 77
  • 111
3
votes
2 answers

Why won't Visual Studio 2005 generate an Xml Serialization assembly?

Why isn't Visual Studio 2005 generating a serialization setting when I set the project setting "Generate Serialization Assembly" to "On"?
Adam Tegen
  • 25,378
  • 33
  • 125
  • 153
2
votes
1 answer

XML Serialization assembly for non-web projects

I am attempting to solve the well known problem of automatically generated serialization assemblies in VS 2010, both VB.NET and C#. The "Generate Serialization Assemblies" option in project settings does nothing for non-web projects (see…
alexkai
  • 61
  • 6
2
votes
2 answers

Generating an Xml Serialization assembly for a custom XmlSerializer

I have methods in my class for serializing/deserializing using a different XML structure than what would be produced with the default serializer. The methods create an XmlSerializer for my type but with a whole bunch of overrides. When these methods…
Rory
  • 40,559
  • 52
  • 175
  • 261
2
votes
1 answer

Serialization of internal class to xml

I ran into problems when trying to xml serialize a class to xml after I changed it from public to internal. Before I changed protection level it was working fine, so I am looking for a way to get around the public only restriction. The reason I want…
Martin Brenden
  • 257
  • 2
  • 8
2
votes
0 answers

Generating serializers with SGEN - error about missing netstandard reference event thou it is referenced

I am trying to run SGEN against one of dlls. I am getting error: "error CS0012: The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral,…
PiotrR
  • 95
  • 7