Issue with clickonce bootstrapper and msbuild

2020-02-19 10:10发布

I have a CruiseControl .NET build server running on Windows Server 2003, and I am trying to build and publish my ClickOnce application using msbuild.

Everything is working fine, except when I enable the bootstrapper of my ClickOnce application. When this happens, I get the following error in the DeploymentGenerateBootstrapper target:

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets (3939,9):

error MSB3147: 

Could not find required file 'setup.bin' in 'E:\Projects\src\TestProject\Engine'.

.NET Framework 3.5 SP1 and 4 and latest Windows SDK for both are installed on the server, but the bootstrapper folder in C:\Program Files\Microsoft SDKs\Windows\versionNo\ does not exist. I tried copying the files from my workstation machine with no luck.

I do not want to install Visual Studio on server and only install the necessary SDKs.

I have also tried copying the bootsrapper folder from my machine

C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper

C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper

to build server but no luck.

Any ideas?

9条回答
够拽才男人
2楼-- · 2020-02-19 10:45

Hi I know this answer its soooooo late but just in case

I had to add the Path prop to the task, with the Path where the bootstrapper its located, in my case I used Visual Studio 2015 so the Path is:

**Program Files(x86)\Microsoft Visual Studio 14.0\SDK\Boostrapper**

MSBuild has a Task GenerateBootstrapper in my case

    <GenerateBootstrapper> 
       AplicationFile="$(AppName)"
       ApplicationName=..
       ApplicationUrl=..
       BootstrapperItems=..
       Culture=..
       ApplicationUrl=.. 
       Path="Program Files(x86)\Microsoft Visual Studio 14.0\SDK\Boostrapper\"
    </GenerateBootstrapper>

with this the MSBuild is able to recognize and generate the file

Now i'm stucked with the .net 4 bootstrapper but guess is another story...

查看更多
在下西门庆
3楼-- · 2020-02-19 10:48

I had a similar issue to this but in my case I do have Visual Studio installed on the box, and publishing from Visual Studio works fine. When publishing from the command line with msbuild.exe, the build failed with aforementioned error "MSB3147 Could not find required file 'setup.bin'".

The solution was to explicitly specify what version of Visual Studio to use during build.

<MSBuild
  Projects="MyProject.csproj"
  Targets="publish"
  Properties="Configuration=Release;PublishUrl=C:\AnyFolder;VisualStudioVersion=12.0"/>

I have Visual Studio 2013 on a Win7 x64 machine. My reading of the problem is that MSBuild was looking in the wrong place in the registry. By explicitly telling MS Build to use VS 12.0, it picked the correct registry location entry and consequently the correct path to BootstrapperSdkPath.

查看更多
▲ chillily
4楼-- · 2020-02-19 10:49

You can also pass the location of the bootstrapper packages to the common Publish target like this:

<PropertyGroup>
     <BootstrapperSdkPath>C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bootstrapper</BootstrapperSdkPath>
</PropertyGroup>

and then

<Target Name="Publish">
    <MSBuild Targets="publish" ... Properties="GenerateBootstrapperSdkPath=$(BootstrapperSdkPath); ..."/>
</Target>
查看更多
登录 后发表回答