2

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);
view.Execute();
var record = view.Fetch();
record.SetStream(2, projdir + "InstallUtilLib.dll");
view.Modify(msiViewModifyUpdate, record);
view.Close();
database.Commit();

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

MarcoM
  • 92
  • 1
  • 10

2 Answers2

0

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

Melquiades
  • 8,496
  • 1
  • 31
  • 46
Nikhil Agrawal
  • 47,018
  • 22
  • 121
  • 208
0

In a desperate attempt to solve the problem, I found the solution. After checking everything else, i move my project to another folder, and I discovered that the path was too long.

The path of my project, despite having less than 255 characters, as indicated by the Microsoft site, cause the Visual Studio 2010 give back this error.

http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx

But attention, being a little explanatory error may result from other errors in other cases. In my case solved the problem.

MarcoM
  • 92
  • 1
  • 10