1

I have seen some posts that mention the xmlserializer being called at runtime in .Net.

I have a sharepoint web-part that calls a webservice to retrieve data, and then is supposed to display that data on the web-part. But I get this error: System.Runtime.InteropServices.ExternalException: Cannot execute a program. The command being executed was "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\csc.exe" /noconfig /fullpaths @"C:\Users\my_deploy_spFarm_user\AppData\Local\Temp\OICE_356C17F3-2ED2-423C-8BBE-CA5C05740FD7.0\eelwfhnn.cmdline

Now the posts I have read here, state that the problem is that the compiler is trying to to create an XML serialization assembly on the fly, but does not have privilege to do so.

I have seen some suggestions to use the post-build events to create this XML Serialization Assembly at Compile-time. However I am not sure of how to do that, and also I am not sure if this assemply would get included in the .wsp package?

Andras
  • 65
  • 6

2 Answers2

1

I'd take a good look at whether you really want the full, automatically generated serializer, or whether you just want to emit/parse some relatively straightforward XML - if the latter, you'll solve this problem by not using stuff that needs generated code, i.e. use the XmlReader/XmlWriter directly.

Rawbert
  • 112
  • 2
  • As this seems like the more straightforward choice, I ended up rewriting the webservice, and used a simple webrequest/webresponse to retrieve the needed info instead. If it wasn't for the time-constraints on this task, I would have investigated how to do the pre-compiling of the serialization assembly instead, so that this error would go away. – Andras Dec 27 '11 at 22:55
0

This link has the basic command to create the pre-compiled serializers.

Francisco Aquino
  • 9,097
  • 1
  • 31
  • 37
  • The link you provided does give insight on the sgen.exe command, but I'm still in doubt of how to use it in the post-compile events on the project, and how I would write such a command... – Andras Dec 27 '11 at 22:56
  • Post-build: sgen.exe $(TargetPath) – Francisco Aquino Dec 28 '11 at 15:07
  • 1
    MSBuild Task way (non post-build event) of calling SGen to generate the {AssemblyName}.Serilizers.dll assembly. http://stackoverflow.com/questions/134224/generating-an-xml-serialization-assembly-as-part-of-my-build – Daniel McQuiston Mar 20 '12 at 19:37