.net - SGEN, InternalsVisibleTo and assembly signing -


I'm trying to do something a little unusual ...

I have this class Foo :

  public square fu {public fu (string name) {this.Name = name; } Internal Foo () {} public string name {get; Internal set; } Public int Age {Received; Set; }}  

Notice the internal setter and internal default constructor for the name. This can normally be prevented XML serialization, but I also marked XML serialization assembly as a "friend" with InternalsVisibleTo:

  [assembly: InternalsVisibleTo ( "TestXML2008.XmlSerializers")]  

And I added an MSBuild function to pre-order the ordering assembly:

   & Lt; / SGen & gt; & Lt; / Target & gt;  

This works fine :. Name property is correctly serialized and deserialized

Now I'd like to enter your assembly ... So I define a key file for my assembly, and I nternational Vijitebl to match the key modify hereby declare:

  [assembly: International Vijiteto ( "Test XML2008.XmlSerializers, PublicKey = c5cd51bf2cc4ed49")]  

but now resides SGN fail Is:

generate a temporary class (result = 1) Unable to
The property or indexer can not be assigned 'test XML2008.Foo.Name' - it is read only

The SGN function should be selected through a macros important file, But apparently this is not enough ... I have tried to clearly specify the key file without SGN work whenever I use sgen.exe on the command line, I have only one result ...

Or I'm missing something? I can not understand why when I sign the Assembly, then why does not this work ...

See more about the information on how to obtain a public key.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -