C# – Visual Studio Installer > PostBuildEvent error code ‘1’


I'm trying to run a .js file with PostBuildEvent in Visual Studio 2010 and fail when i build the solution with the error code

Error 2 'PostBuildEvent' failed with error code '1' 'Error no especificado'

I already check the names of the files, the path, and the code in my project and js file, and everything seems right…
the js file contain this

// http://blogs.msdn.com/b/heaths/archive/2006/02/01/64-bit-managed-custom-actions-with-visual-studio.aspx
var msiOpenDatabaseModeTransact = 1;
var msiViewModifyUpdate = 2

var filespec = WScript.Arguments(0);
var projdir = WScript.Arguments(1);
var installer = WScript.CreateObject("WindowsInstaller.Installer");
var database = installer.OpenDatabase(filespec, msiOpenDatabaseModeTransact);

// Update the Binary table...
var sql = "SELECT `Name`,`Data` FROM `Binary` where `Binary`.`Name` = 'InstallUtil'";
var view = database.OpenView(sql);
var record = view.Fetch();
record.SetStream(2, projdir + "InstallUtilLib.dll");
view.Modify(msiViewModifyUpdate, record);

Anyone already solve a problem like this??
Any help, please…

Best Solution

Since you are using Visual Studio Installer, location of JS File is also important. Your js file should be in the same directory as the .vdproj file for your setup project.

This should be of some help to you http://blogs.msdn.com/b/astebner/archive/2006/08/12/696833.aspx