/p command line parameter equivalent in SGen task

Hi,

Is there a way to specify in the SGen task that it should call sgen.exe with the /p parameter? I did not see anything in the help file. There is an AddCommandLineCommands function in the SGen task, but how do I envoke that from the build profile?

It makes a huge difference timewise.

Thanks.

[302 byte] By [Gerhardo] at [2008-2-28]
# 1

Hi Gerhardo,
In Beta 2 the task did not have support for this parameter. Since then, it has been added, with the property name "UseProxyTypes". Looking at the current internal microsoft.common.targets file, it's hard coded to "true":

<SGen
BuildAssemblyName="$(TargetFileName)"
BuildAssemblyPath="$(IntermediateOutputPath)"
References="@(ReferencePath)"
ShouldGenerateSerializer="true"
UseProxyTypes="true"
KeyContainer="$(KeyContainerName)"
KeyFile="$(KeyOriginatorFile)"
DelaySign="$(DelaySign)"
ToolPath="$(SGenToolPath)">

<Output TaskParameter="SerializationAssembly" ItemName="SerializationAssembly"/>

</SGen>

If you need to get this to work for Beta 2, I don't see a workaround off the top of my head, except for using the <Exec> task to invoke Sgen directly. You would paste in the GenerateSerializationAssemblies target from Microsoft.Common.targets into your own project below where Microsoft.common.targets is imported by the project. This will override that target with your copy. Then you can remove the call to the <SGen> task and replace it with the equivalent use of the <Exec> task including the /p switch.

Let us know if you get stuck.
Dan (msbuild@microsoft.com)

DanMoseley at 2007-9-9 > top of Msdn Tech,Visual Studio,Visual Studio MSBuild...
# 2
Thanks. I already went down the path you suggested and pasted the task into my project and then replaced with with a call to sgen.exe. The SGen task must be doing extra work, however. The project references other assemblies. When you look at the assemblies in the Reference path and pass those in to the exec call as a parameter, the path is not correct. The path is relative and in relation to original project file. If you continue to use the InterMediate output path, sgen can't find the references. I'd have to copy them or generate the assembly later on which seemed like a lot of extra trouble. I think I'll wait until it is fixed.
Gerhardo at 2007-9-9 > top of Msdn Tech,Visual Studio,Visual Studio MSBuild...

Visual Studio

Site Classified