sgen

sgen.exe, XmlSerializers.dll not being used

坚强是说给别人听的谎言 提交于 2019-12-25 03:59:21
问题 I need to produce XML serializers for certain of my classes in advance to avoid them being built when the application runs. I managed to (eventually) get sgen running as a post build operation. It appears to be working as it produces the expected DLL. However its not being used. I have configured the diagnostics to leave the files on disk and I can see them still being produced. This is with an existing class (ClassA) of moderate complexity. So I created a simple class (ClassB) and tested on

Compiling Mono from Visual Studio with sgen support

假装没事ソ 提交于 2019-12-23 04:29:49
问题 I have a Mono binary obtained from a build with Visual Studio. The option --gc=sgen used to enable sgen garbage collector is not available: Error: --gc=<NAME> option not supported on this platform. How to enable this option ? Is there any define ? 回答1: The sgen GC will be available on windows starting from the next mono releases, 2.11/2.12 (though not necessarily in the VS build). 来源: https://stackoverflow.com/questions/8214594/compiling-mono-from-visual-studio-with-sgen-support

SGEN, InternalsVisibleTo and assembly signing

寵の児 提交于 2019-12-19 04:20:40
问题 I'm trying to do something a bit unusual... I have this class Foo : public class Foo { public Foo(string name) { this.Name = name; } internal Foo() { } public string Name { get; internal set; } public int Age { get; set; } } Notice the internal setter for Name, and the internal default constructor. This would normally prevent the XML serialization, but I also marked the XML serialization assembly as "friend" with InternalsVisibleTo : [assembly: InternalsVisibleTo("TestXML2008.XmlSerializers")

Generating an Xml Serialization assembly for a custom XmlSerializer

旧时模样 提交于 2019-12-18 07:05:32
问题 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 are called I guess internally .NET still generates a serialization assembly but I would like to generate this assembly after compilation so it's not generated at runtime. How can I generate a serialization assembly for this custom serialization?

How to make sgen.exe keep the version of the assembly?

白昼怎懂夜的黑 提交于 2019-12-12 16:30:37
问题 I want to create a serialization assembly for my assembly. sgen does it fine, but I can't figure out how to get it to assign the serialization assembly the same version as the source assembly. Any ideas? 回答1: sgen seem to take source assembly version by default, it is quite reasonable. Here is how I run it, there is nothing special: "...PathToSDK...\Microsoft Visual Studio SDK\sgen.exe" /force /assembly:"$(TargetPath)" /compiler:"\"/keyfile:$(ProjectDir)..\key.snk"\" /compiler:/delaysign-

XML Serialization assembly for non-web projects

旧巷老猫 提交于 2019-12-10 23:56:36
问题 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 http://blog.devstone.com/aaron/archive/2008/02/07/2778.aspx et al). Thus the calls to serializers generate file i/o exceptions that are very unfortunate, and for which there is no cure. The method suggested above does not appear to work with VS2010 and SGEN

How to force Sgen to create .net 3.5 serializers assembly

孤街醉人 提交于 2019-12-09 20:53:48
问题 I have a sgen build step in my .NET 3.5 library. In VS2010 this generates .NET 4 MyLib.XmlSerializers.dll, which cannot be loaded from .NET 3.5 apps. Does anyone know how to change build step to get correct version of the assembly? Is it possible to IL merge serializers assembly and library into single dll? This is my sgen build step: <Target Name="AfterBuild" DependsOnTargets="AssignTargetPaths;Compile;ResolveKeySource" Inputs="$(MSBuildAllProjects);@(IntermediateAssembly)" Outputs="$

Serialize() not using .XmlSerializers.dll produced with Sgen

丶灬走出姿态 提交于 2019-12-08 04:09:29
问题 I have a sgen step in my .NET 3.5 library, producing a correct XYZ.XmlSerializers.dll in the output directory. Still having poor serialization performance, I discovered that .NET was still invoking a csc at runtime. Using process monitor, I saw that .NET was searching for a dll named "XYZ.XmlSerializers.-1378521009.dll". Why is there a '-1378521009' in the filename ? How to tell .NET to use the 'normal' DLL produced by sgen ? 回答1: Poking around a bit with Reflector, this seems to happen when

MSBuild cannot find SGen when compiling a solution

断了今生、忘了曾经 提交于 2019-12-07 02:19:57
问题 I've looked at several other SGen-related questions on here and either their answers don't apply or their answers don't fix this for me. I have installed several SDKs to fix this issue with no luck. Reference types should not be changed since this is the only place this is a problem. Once suggestion is to put SGen.exe into the C:\Windows\Microsoft.NET\Framework\v3.5 folder, but that's not been done on the box where this is not a problem. In this scenario, SGen.exe actually exists and is right

How to exclude specific types from serialization?

旧时模样 提交于 2019-12-06 21:10:55
问题 I run sgen against my assembly with a metric ton of types. I want to exclude 2 types from serialization. I don't seem to be able to find a way to do it. I see that sgen has a /type switch to specify a specific type, but nothing to exclude a specific type. Is there a way to exclude specific types from serialization? 回答1: Apart from putting the types you wish to exclude in a different assembly, you cannot exclude types from the serializer generation. Update Other posters have come up with