<p>After changing the output directory of a visual studio project it started to fail to build with an error very much like:   </p>

<pre><code>C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin\sgen.exe /assembly:C:\p4root\Zantaz\trunk\EASDiscovery\EASDiscoveryCaseManagement\obj\Release\EASDiscoveryCaseManagement.dll /proxytypes /reference:C:\p4root\Zantaz\trunk\EASDiscovery\EasDiscovery.Common\target\win_x32\release\results\EASDiscovery.Common.dll /reference:C:\p4root\Zantaz\trunk\EASDiscovery\EasDiscovery.Export\target\win_x32\release\results\EASDiscovery.Export.dll /reference:c:\p4root\Zantaz\trunk\EASDiscovery\ItemCache\target\win_x32\release\results\EasDiscovery.ItemCache.dll /reference:c:\p4root\Zantaz\trunk\EASDiscovery\RetrievalEngine\target\win_x32\release\results\EasDiscovery.RetrievalEngine.dll /reference:C:\p4root\Zantaz\trunk\EASDiscovery\EASDiscoveryJobs\target\win_x32\release\results\EASDiscoveryJobs.dll /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Shared.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.Misc.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinChart.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinDataSource.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinDock.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinEditors.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinGrid.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinListView.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinMaskedEdit.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinStatusBar.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinTabControl.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinToolbars.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinTree.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.v8.1.dll" /reference:"C:\Program Files\Microsoft Visual Studio 8\ReportViewer\Microsoft.ReportViewer.Common.dll" /reference:"C:\Program Files\Microsoft Visual Studio 8\ReportViewer\Microsoft.ReportViewer.WinForms.dll" /reference:C:\p4root\Zantaz\trunk\EASDiscovery\PreviewControl\target\win_x32\release\results\PreviewControl.dll /reference:C:\p4root\Zantaz\trunk\EASDiscovery\Quartz\src\Quartz\target\win_x32\release\results\Scheduler.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.configuration.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Design.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.DirectoryServices.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.Services.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /compiler:/delaysign- 
    Error: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1902,9): error MSB6006: "sgen.exe" exited with code 1.
</code></pre>

<p>I changed the output directory to target/win_x32/release/results but the path in sgen doesn't seem to have been updated.  There seems to be no reference in the project to what path is passed into sgen so I'm unsure how to fix it.  As a workaround I have disabled the serialization generation but it would be nice to fix the underlying problem.  Has anybody else seen this?</p>

[{'answer_id': 6875, 'author': 'pauldoo', 'author_id': 755, 'author_profile': 'https://Stackoverflow.com/users/755', 'pm_score': 0, 'selected': False, 'text': '<p>I\'ve not seen this particular problem, but recently for us a "C1001: An internal error has occurred in the compiler" type crash from cl.exe was fixed after installing some random and unrelated (or so we thought) Windows security updates.</p>\n\n<p>We knew the code didn\'t crash the compiler on other machines using the same version and service pack level of Visual Studio, but we were really clutching at straws when we tried the Windows security updates.</p>\n'}, {'answer_id': 27302, 'author': 'sphereinabox', 'author_id': 2775, 'author_profile': 'https://Stackoverflow.com/users/2775', 'pm_score': 0, 'selected': False, 'text': "<p>It looks reasonable enough to me, unless something is imposing a 4096 character limit [you list 4020 characters] </p>\n\n<p>A 4096 limit to me seems a bit absurd, it'd be 2048 or 32767 or 8192 from stuff I've found by searching for the command-line limits.</p>\n"}, {'answer_id': 27317, 'author': 'sphereinabox', 'author_id': 2775, 'author_profile': 'https://Stackoverflow.com/users/2775', 'pm_score': 4, 'selected': True, 'text': '<p>see <a href="http://msdn.microsoft.com/en-us/library/bk3w6240(VS.80).aspx" rel="noreferrer">msdn</a> for the options to sgen.exe [you have the command line, you can play with it manually... delete your .XmlSerializers.dll or use /force though]</p>\n\n<p>Today I also ran across how to more <a href="http://www.kiwidude.com/blog/2007/02/vs2005-when-sgen-doesnt-work.html" rel="noreferrer">manually specify the sgen options</a>.  I wanted this to not use the /proxy switch, but it appears it can let you specify the output directory.  I don\'t know enough about msbuild to make it awesome, but this should get you started [open your .csproj/.vbproj in your non-visual studio editor of choice, look at the bottom and you should be able to figure out how/where this goes]</p>\n\n<p>[the below code has had UseProxyTypes set to true for your convenience]</p>\n\n<pre><code>&lt;Target Name="GenerateSerializationAssembliesForAllTypes"\n  DependsOnTargets="AssignTargetPaths;Compile;ResolveKeySource"\n  Inputs="$(MSBuildAllProjects);@(IntermediateAssembly)"\n  Outputs="$(OutputPath)$(_SGenDllName)"&gt;\n    &lt;SGen BuildAssemblyName="$(TargetFileName)"\n      BuildAssemblyPath="$(OutputPath)" References="@(ReferencePath)"\n      ShouldGenerateSerializer="true" UseProxyTypes="true"\n      KeyContainer="$(KeyContainerName)" KeyFile="$(KeyOriginatorFile)"\n      DelaySign="$(DelaySign)" ToolPath="$(SGenToolPath)"&gt;\n        &lt;Output TaskParameter="SerializationAssembly"\n          ItemName="SerializationAssembly" /&gt;\n     &lt;/SGen&gt;\n&lt;/Target&gt;\n&lt;!-- &lt;Target Name="BeforeBuild"&gt;\n&lt;/Target&gt; --&gt;\n&lt;Target Name="AfterBuild"\n  DependsOnTargets="GenerateSerializationAssembliesForAllTypes"&gt;\n&lt;/Target&gt;\n</code></pre>\n'}, {'answer_id': 2852635, 'author': 'Paul', 'author_id': 44636, 'author_profile': 'https://Stackoverflow.com/users/44636', 'pm_score': 0, 'selected': False, 'text': '<p>I ran into this issue when I had referenced an assembly on a web site project in the GAC that had been since uninstalled, and for some reason that reference triggered a serialization assembly generation, and sgen choked on the reference (since it no longer existed). After removing the reference and turning serialization assembly generation to Off, I no longer had the issue.</p>\n'}, {'answer_id': 28133125, 'author': 'Benoit', 'author_id': 2134482, 'author_profile': 'https://Stackoverflow.com/users/2134482', 'pm_score': 5, 'selected': False, 'text': '<p>If you are having this problem while building your VS.NET project in Release mode here is the solution:</p>\n\n<p>Go to the project properties and click on the Build tab and set the value of the "Generate Serialization Assembly" dropdown to "Off".</p>\n\n<p>Sgen.exe is "The XML Serializer Generator creates an XML serialization assembly for types in a specified assembly in order to improve the startup performance of a XmlSerializer when it serializes or deserializes objects of the specified types." (<a href="https://msdn.microsoft.com/en-us/library/bk3w6240%28v=vs.110%29.aspx" rel="noreferrer">MSDN</a>)</p>\n'}]
['https://Stackoverflow.com/questions/6623', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/361/']