1

I have a visual studio setupproject to install my kernel driver "mydriver". When I right click and install my driver it is installing from inf file.

Now I wanted to do similar kind of action from custom action. Using standard action in setup project, I want to load the .inf and .sys file into C:\Program Files\Myfolder.

In the same installer project, I added "InfDefaultinstall.exe" as a custom action in Install section in custom action editor. In the arguments attribute of the custom action I added the file as "C:\Program Files\Myfolder\mydriver.inf".

The project built successfully and when I tried to install the package using "setup.exe", I am getting an error

"The system cannot find the specified file"

Can someone please give me a suggestion on this issue ?

Mohan
  • 1,871
  • 21
  • 34

2 Answers2

0

My answer from the MSDN forums:

I don't know how you are specifying the Program Files folder, but you should not be hard-coding it - you should be using the ProgramFilesFolder property in the Application Folder name.

You also need to tell is whether you are building a 32-bit or a 64-bit setup. A 32-bit x86 setup cannot install into "C:\Program Files\" because that is the 64-bit program files folder, and the install will redirect to "C:\Program Files(x86)\". So you may have an issue with those folders if your code can't find the file. You must use the x86 folder if it's a 32-bit setup.

Other than that, I'd skip the custom action, let the install proceed, and see where the files actually are.

Also be sure that you specify the complete full path to the inf file in your custom action code. You are not running as a call from Explorer where you get the convenience of a default working directory.

Mohan
  • 1,871
  • 21
  • 34
PhilDW
  • 20,260
  • 1
  • 18
  • 28
0

Try it:

[RunInstaller(true)]
public partial class CustomInstaller : System.Configuration.Install.Installer
{
    public override void Install(System.Collections.IDictionary stateSaver)
    {
        base.Install(stateSaver);
        string path = this.Context.Parameters["targetdir"]; 
        // Do something with path.
    } 
}

Getting Application path during the installation

Community
  • 1
  • 1