If you look around on the WEB you will see loads of questions regarding sgen.exe not found post-build errors. It seems that it's possible to confuse the installation of the development environment (probably by doing anything other than accepting the defaults for everything - but let's not go there).
Of course sgen.exe must be installed somewhere in order to use it. The normal way to install sgen.exe is by way of the Visual Studio SDK, In fact, if you're developing Windows Apps, there is almost no good reason to NOT install the SDK. But as I have alluded to, simply installing the SDK may not solve the issue of your post-build step failing. The reason seems to be related to how sgen.exe is found.
The location of sgen.exe is supposedly specified by a macro (AKA Environment Variable) SGenToolPath which is used within Microsoft.Common.Targets (Commonly found at C:\Windows\Microsoft.NET\Framework\%VERSION_STRING%) I have searched every file, and the registry for the definition of that string (SGenToolPath ) with no luck. Since the macro is undefined, I am guessing that a default location is used. If you have customized your installation, it is likely that that default location will be incorrect.
Since I don’t use the single gigantic C: partition - I install software (including MSDev) to a ‘user’ partition which I denominate as the ‘U:’ drive -I replace the hardcoded path to sgen within the post-build step (Project->Properties->Build Events) with this:
“$(FrameworkSDKDir)\Bin\sgen.exe”
Since the FrameworkSDKDir variable seems to be Always correctly defined, this is a safe, and portable, method of referenceing sgen.exe
I hope this helps.