Question

I have a C# assembly project which I have selected to build in Visual Studio 2010, which is set to serialize itself. When I try to build the project, I get this error:

Error 1 The specified task executable location "C:..\MyProjectName\bin\x64\Debug\sgen.exe" is invalid.

Does anyone know how I can solve this issue?

I need this assembly serialized for the purposes of my project. Now a little history. This machine I'm using is new and I happened to make the mistake of installing Visual Studio 2010 after Visual Studio 2012; not sure if this is the reason why it can't find sgen.exe. There are no build steps that call on sgen, I'm pretty sure its done by VS as part of the build cycle. Secondly, its trying to look for sgen in the output directory...I don't understand why its trying to do that, I thought sgen was a framework component that gets installed elsewhere. This project builds successfully on another computer of mine.

Was it helpful?

Solution

most probably because of build targets got changed. edit your csproject file and try replacing these tags

<PropertyGroup>
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
  </PropertyGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
  <PropertyGroup>
    <PreBuildEvent />
    <PostBuildEvent />
  </PropertyGroup>
  <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top