Could not find required file 'setup.bin'

2019-01-06 15:08发布

I'm unable to build a Setup Project in VS2010, for a Windows Service project. It fails with this error:

Could not find required file 'setup.bin' in 'C:\MyProject\Engine'.

My environment is Windows 7 Professional x64 with Visual Studio 2010 Version 10.0.40219.1 SP1Rel

I've downloaded Microsoft Windows SDK for Windows 7 and .NET Framework 4, repaired, then rebooted, then installed the unchecked components except Visual C++ compiler, then installed KB2519277.

These are the existing registry entries:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\GenericBootstrapper\3.5
    Path = c:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Bootstrapper\

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\GenericBootstrapper\4.0
    Path = c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\

These are the existing files:

C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Engine\setup.bin

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Engine\setup.bin

An existing workaround is to copy the Engine directory to the project directory, however this has to be done every time you make a new project.

How can this be fixed properly?

6条回答
再贱就再见
2楼-- · 2019-01-06 15:52

Before going down the rabbit hole, verify that you need the bootstrapper. If you do not, then you can turn it off by doing one of the following. This will also resolve the error.

The GUI way:

  1. Right Click on the Project
  2. Click Properties
  3. Click the Publish Tab on the left
  4. Click the Prerequisites... button
  5. Uncheck Create setup program to install prerequisite components

Project Properties

This answer came from this post.

The manually edit csproj file way:

  1. Add <BootstrapperEnabled>false</BootstrapperEnabled> to the bottom of the first <PropertyGroup> element
查看更多
smile是对你的礼貌
3楼-- · 2019-01-06 15:53

With Process Monitor I found that, right before trying to access the path, a DLL is used to retrieve this path. The following may be borderline legal, but I'd like to share my findings anyway.

The DLL is located at C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Build.Tasks.v4.0.dll and the class being used is Microsoft.Build.Tasks.Deployment.Bootstrapper.BootstrapperBuilder. Using your favourite disassembly tool, you can find that ultimately three attempts are made at retrieving the path.

  1. HKLM\Software\Microsoft\GenericBootstrapper\11.0\Path
  2. HKLM\Software\Wow6432Node\Microsoft\GenericBootstrapper\11.0\Path
  3. Environment.CurrentDirectory

I'm unsure why it says 11.0, as far as I can remember VS 2012 has not been installed on this machine before.

So there's a bug in the SDK installer or there's a bug in the DLL. Either way, creating the 11.0 registry key and adding the value resolves this issue. Note: Visual Studio must be restarted, because after attempting to retrieve the path, it is cached.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\GenericBootstrapper\11.0]
"Path"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Bootstrapper\\"
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\GenericBootstrapper\11.0]
"Path"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Bootstrapper\\"
查看更多
时光不老,我们不散
4楼-- · 2019-01-06 16:00

This solution worked for me (VS 2013): http://www.codewrecks.com/blog/index.php/2014/05/31/error-msb3147-could-not-find-required-file-setup-bin-in/

Change the PATH of the msbuild.exe to: C:\Program Files (x86)\MsBuild\12.0\Bin\msbuild.EXE

查看更多
狗以群分
5楼-- · 2019-01-06 16:06

I had the same problem with a TFS build.

You can resolve the problem by setting the visual studio version in the MSBuild arguments of the definition build:

/property:VisualStudioVersion=12.0;

MSBuild arguments in build definition

查看更多
神经病院院长
6楼-- · 2019-01-06 16:08

It's a multi step solution.

First make sure you have the .Net SDKs installed.

Then make sure the following registry entry exists: HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\GenericBootstrapper\11.0

It must contain a 'Path' entry with the value pointing to the location of the bootstrapper: C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bootstrapper\

The following powershell script does that for you:

$registryPath = "Registry::HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\GenericBootstrapper\11.0"
$registryValue = "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bootstrapper\" 
function CreateRegistryValues {

    if(-not (Test-Path $registryPath ) )
    {
        Push-Location
        Set-Location -Path Registry::HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\GenericBootstrapper
        # First add the registry item
        New-Item -Name '11.0' -Value $registryValue
        #Then add a property on it for 'Path' and the folder in bootstrapper that contains the 'Engine' folder 
        New-ItemProperty `
            -Path  $registryPath `
            -Name 'Path' `
            -PropertyType String `
            -Value $registryValue
        Pop-Location
    }else{
        Write-Warning "You already have the registry key ($registryPath) set. `r`n No action was taken `r`n "
    }
}

Finally, you must copy the contents of the 'Engine' folder included as part of the Visual Studio tooling to the location listed in the registry value:

C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bootstrapper\" 
查看更多
家丑人穷心不美
7楼-- · 2019-01-06 16:12

MY SOLUTION TO THE PROBLEM: cannot publish, because setup.bin cannot be found

When using the PUBLISH wizard in vs2008, the application cannot be published because setup.bin cannot be found.


The short answer is:

Paste the engine folder into the location that is indicated in the ERROR message in the vs2008 IDE.

The engine folder can be found in the Microsoft SDKs folder.


The long answer is:

In my case, vs2008 was looking for setup.bin in C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\engine\.

This location was indicated in the error within the vs2008 IDE.

The engine folder did not exist at the above location, because the engine folder was not there.

The engine folder was in fact at C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Engine.

This engine folder location was found by searching the registry for an occurrence of setup.bin

I copied the engine folder from Microsoft SDKs folder and pasted it into the Microsoft Visual Studio 9.0 folder.

This folder copy resolved the problem and allowed me to publish an app.

Here are the specific steps I took:

  1. Search the registry for setup.bin

  2. When setup.bin is found in the registry, inspect the key and note the folder location of setup.bin (in my case this was C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Engine)

  3. In the VS2008 IDE, look in the ERROR window and note the folder location for the setup.bin error (in my case this was C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\engine\)

  4. The vs2008 IDE was expecting setup.bin to be in C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\engine\, but this engine folder did not exist

  5. Copy the engine folder from C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Engine, and paste this folder into the IDE folder at C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\

查看更多
登录 后发表回答