Lock-up problem with Sgen and Visual Studio 2005

Category: c# ide


B. Chernick on Thu, 17 Jun 2010 19:15:45

I've never done this before.  I've created a C# Database\Sql Server Project in VS 2005.  The only reason I'm using C# is because the only available pattern for this kind of program is also in C#. 

In the Signing tab I've created an snk file (no password).  In the Build Events tab, Post Build box, I've added the string: 

"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sgen.exe" /c:/keyfile:..\..\KeyFileToSignAssembly.snk /force "$(TargetPath)"

Unfortunately when I add this, the project locks on build during the sgen call and I have to use the task manager to kill VS. 

To the best of my knowledge everything on this machine should be in it's default installation position. 

Suggestions?  (Does the call string look normal?)


Rick van den Bosch on Fri, 23 Nov 2012 15:26:10


feels to me like sgen.exe is waiting for input (on the background) and is not getting this, hence locking the (post) build process.

Could you se what happens if you run the post build event by hand?

Kind regards

CoolDadTx on Fri, 23 Nov 2012 21:01:29

Especially with older versions of VS build outputs can be locked during and after the build so running any post-build output modification program is iffy.  Newer versions of VS support signing as a project property.  I can't remember back to VS2005 but I'd check to see if it supports signing via the project properties first.  If not then I'd recommend upgrading to a newer version of VS (2008 or higher will work) where signing is part of the build settings.  This eliminates the problem altogether.  Note that if you're just building a SQL project then you'll really want to use BIDS from SQL Server rather than a full version of VS.  SQL 2008 and higher ship with the VS2008 version.

Michael Taylor - 11/23/2012