Team build for ClickOnce application with bootstrapper

(Chinese Version)

 

When one builds an ClickOnce application which requires bootstrapper, the team build might fail with the error message in the build report resembles this:

“C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(3604,9): error MSB3147: Could not find required file 'setup.bin' in 'BuildAgent_work_folder\Sources\Project_Root\Engine'. “

The error is raised from a MSBuild task named GenerateBootstrapper. It looks on local machine for the resources to make the bootstrapper setup.exe file. The task searches the bootstrapper resource files (setup.bin and its friends) installation path by checking registry keys one by one:

1. HKLM\Software\Microsoft\GenericBootstrapper\1.0\path

2. HKLM \Software\Microsoft\.NetFramework\SDKInstallRoot<Version> \Bootstrapper

3. HKLM \Software\Microsoft\VisualStudio\ <Version> \InstallDir\Bootstrapper

In each step of the search, if MSBuild finds the registry value is set, it uses the value as the bootstrapper resource installation path and stops searching. If none of these registry value are found, it takes the root path of the ClickOnce project being built. MSBuild tries to locate \engine\setup.bin file under bootstrapper resource installation path. If the file is not found there, MSB3147 occurs.

The bootstrapper files comes as part of .Net Framework SDK. During the SDK installation a set of files/folders are copied to the disk. The registry value is created and set to point to the installation path. On a computer that does not have .Net Framework SDK/Visual Studio IDE installed, none of the registry key would be set. In such case MSBuild will try to find the resource files under the ClickOnce project root and fail there.

So the solution would be to install .Net Framework SDK on the build machine. If one installs windows SDK or Visual Studio IDE, .Net Framework SDK will be installed as a part .