Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This is how I managed to do it by modifying the MSBUILD script in my .CSPROJ file:</p> <p>First, open your .CSPROJ file as a file rather than as a project. Scroll to the bottom of the file until you find this commented out code, just before the close of the Project tag: </p> <pre><code>&lt;!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. &lt;Target Name="BeforeBuild"&gt; &lt;/Target&gt; &lt;Target Name="AfterBuild"&gt; &lt;/Target&gt; --&gt; </code></pre> <p>Now we just insert our own AfterBuild target to delete any existing XmlSerializer and SGen our own, like so:</p> <pre><code>&lt;Target Name="AfterBuild" DependsOnTargets="AssignTargetPaths;Compile;ResolveKeySource" Inputs="$(MSBuildAllProjects);@(IntermediateAssembly)" Outputs="$(OutputPath)$(_SGenDllName)"&gt; &lt;!-- Delete the file because I can't figure out how to force the SGen task. --&gt; &lt;Delete Files="$(TargetDir)$(TargetName).XmlSerializers.dll" ContinueOnError="true" /&gt; &lt;SGen BuildAssemblyName="$(TargetFileName)" BuildAssemblyPath="$(OutputPath)" References="@(ReferencePath)" ShouldGenerateSerializer="true" UseProxyTypes="false" KeyContainer="$(KeyContainerName)" KeyFile="$(KeyOriginatorFile)" DelaySign="$(DelaySign)" ToolPath="$(TargetFrameworkSDKToolsDirectory)" Platform="$(Platform)"&gt; &lt;Output TaskParameter="SerializationAssembly" ItemName="SerializationAssembly" /&gt; &lt;/SGen&gt; &lt;/Target&gt; </code></pre> <p>That works for me.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload