Msbuild 带有mvs2013或mvs2014的windows 10上的Wix不工作(使php可执行)

Msbuild 带有mvs2013或mvs2014的windows 10上的Wix不工作(使php可执行),msbuild,wix,Msbuild,Wix,带有mvs2013或mvs2014的windows 10上的Wix不工作 我得到一个错误: 错误无法从程序集\WixTasks.dll加载“GenerateCompileWithObjectPath”任务。无法加载文件或程序集的file:///c:\WixTasks.dll'或其依赖项之一。系统找不到指定的文件。确认声明正确,程序集及其所有依赖项可用,并且任务包含实现Microsoft.Build.Framework.ITask的公共类。SetupProject5 C:\Program File

带有mvs2013或mvs2014的windows 10上的Wix不工作

我得到一个错误: 错误
无法从程序集\WixTasks.dll加载“GenerateCompileWithObjectPath”任务。无法加载文件或程序集的file:///c:\WixTasks.dll'或其依赖项之一。系统找不到指定的文件。确认声明正确,程序集及其所有依赖项可用,并且任务包含实现Microsoft.Build.Framework.ITask的公共类。SetupProject5 C:\Program Files(x86)\MSBuild\Microsoft\WiX\v3.x\wix2010.targets

如果我试图将
WixTasks.dll
包含到项目中,那么当mvs2013或mvs2014在构建过程中崩溃时。我将
\WixTasks.dll
包含到解包的wix二进制文件文件夹中的
C:\SourceControl\vs2015\SetupProject1\SetupProject1\SetupProject1.wixproj
C:\SourceControl

//
C:\SourceControl\vs2015\SetupProject1\SetupProject1\SetupProject1.wixproj

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProductVersion>3.10</ProductVersion>
    <ProjectGuid>0adbe89f-e1ce-4345-90e6-64b8304fa42f</ProjectGuid>
    <SchemaVersion>2.0</SchemaVersion>
    <OutputName>SetupProject1</OutputName>
    <OutputType>Package</OutputType>
     <WixToolPath>C:\SourceControl</WixToolPath>
    <WixTargetsPath>$(WixToolPath)\wix.targets</WixTargetsPath>
    <WixTasksPath>$(WixToolPath)\WixTasks.dll</WixTasksPath>    
    <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
    <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <OutputPath>bin\$(Configuration)\</OutputPath>
    <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
    <DefineConstants>Debug</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <OutputPath>bin\$(Configuration)\</OutputPath>
    <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="Product.wxs" />
  </ItemGroup>
  <Import Project="$(WixTargetsPath)" />
  <!--
    To modify your build process, add your task inside one of the targets below and uncomment it.
    Other similar extension points exist, see Wix.targets.
    <Target Name="BeforeBuild">
    </Target>
    <Target Name="AfterBuild">
    </Target>
    -->

调试
x86
3.10
0adbe89f-e1ce-4345-90e6-64b8304fa42f
2
设置项目1
包裹
C:\SourceControl
$(WixToolPath)\wix.targets
$(WixToolPath)\WixTasks.dll
$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\WiX.targets
$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\WiX.targets
bin\$(配置)\
obj\$(配置)\
调试
bin\$(配置)\
obj\$(配置)\
在过去的两天里,我阅读了不同的在线论坛和例子。还有尼克·拉米雷斯的wix契约书。什么都没用。

定义以下MSBuild变量,一切都应该正常工作

<WixRootPath Condition=" '$(WixRootPath)' == '' ">$(MSBuildThisFileDirectory)Tools\wix\$(WixTargetVersion)\</WixRootPath>
<WixToolPath Condition=" '$(WixToolPath)' == '' ">$(WixRootPath)</WixToolPath>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(WixRootPath)Wix.targets</WixTargetsPath>
<WixCATargetsPath Condition=" '$(WixCATargetsPath)' == '' ">$(WixRootPath)sdk\Wix.CA.targets</WixCATargetsPath>
<WixTasksPath Condition=" '$(WixTasksPath)' == '' ">$(WixToolPath)WixTasks.dll</WixTasksPath>
<WixSdkPath Condition=" '$(WixSdkPath)' == '' ">$(WixRootPath)sdk\</WixSdkPath>
$(MSBuildThisFileDirectory)工具\wix\$(WixTargetVersion)\
$(WixRootPath)
$(WixRootPath)Wix.targets
$(WixRootPath)sdk\Wix.CA.targets
$(WixToolPath)WixTasks.dll
$(WixRootPath)sdk\
只要确保路径是正确的。这些路径用于wix 3.10.2二进制文件,我在构建机器上签出我的构建

我认为构建任务应该在WIX环境变量定义的路径中查找,但我不是100%确定

我认为用设置的路径定义所有变量应该可以解决所有问题,因为错误提到在C:\WixTasks.dll中查找。通常,它查找的路径类似于$(WixInstallPath)WixTasks.dll,但如果$(WixInstallPath)没有正确定义,它将为空,默认为C:\WixTasks.dll。您确实定义了$(WixTasksPath),但我认为由于某种原因它被覆盖了

不管怎样,你的系统现在有问题,但你可以通过这种方式解决


编辑:如果上述操作不起作用,请从下载wix二进制文件,并将其解压缩到名为“wix”的文件夹或任何您想调用的文件夹中。然后将WixRootPath设置为与该位置相等。

Nick Ramirez的工作解决方案,2015年,第1章“从命令行构建WiX安装程序”,示例4“BuildMachineInstaller”

下载并解压缩wix二进制文件,例如从。 1.为您的项目创建一些文件夹,例如带有文件
Product.wxs的
C:\SourceControl\own\box1
2.将二进制文件提取到某个文件夹,例如
C:\SourceControl\own\box1\tools\wix
3.启动windows命令行工具
cmd
并更改到项目文件夹。执行
candle
light
命令,如下所示:

C:\SourceControl\own\box1>
C:\SourceControl\own\box1\tools\wix\candle*.wxs-o obj\

C:\SourceControl\own\box1>
C:\SourceControl\own\box1\tools\wix\light obj\*.wixobj-o bin\CommandLineInstaller.msi


无论如何,如果有人能给出一些工作示例文件,并描述如何使用MSBuild或Visual Studio Build和wix生成*.exe或*.msi,我将不胜感激。Pact书籍中的其他示例并不是通过纯粹的复制来实现的,尽管它们对于一般理解非常有用。

我刚刚遇到了这个问题,并发现wix2010.targets文件的顶部有以下属性组

<PropertyGroup>
<WixInstallPath Condition=" '$(WixInstallPath)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Installer XML\3.11@InstallRoot)</WixInstallPath>
<WixInstallPath Condition=" '$(WixInstallPath)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows Installer XML\3.11@InstallRoot)</WixInstallPath>

$(注册表:HKEY\U LOCAL\U MACHINE\SOFTWARE\Microsoft\Windows Installer XML\3。11@InstallRoot)
$(注册表:HKEY\U LOCAL\U MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows Installer XML\3。11@InstallRoot)

检查引用的注册表路径时,3.11没有条目,但3.10有条目。安装的版本报告为3.10。因此,将属性组更新为以下内容为我纠正了这个问题

<PropertyGroup>
<WixInstallPath Condition=" '$(WixInstallPath)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Installer XML\3.10@InstallRoot)</WixInstallPath>
<WixInstallPath Condition=" '$(WixInstallPath)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows Installer XML\3.10@InstallRoot)</WixInstallPath>

$(注册表:HKEY\U LOCAL\U MACHINE\SOFTWARE\Microsoft\Windows Installer XML\3。10@InstallRoot)
$(注册表:HKEY\U LOCAL\U MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows Installer XML\3。10@InstallRoot)


希望这有帮助。

我在使用VS2015和处理使用不同版本Wix的git分支时遇到了这个问题。(我正在升级到最新的Wix版本,但并非所有分支都有。)


如果在使用不同版本Wix的git分支之间切换,则必须终止并重新启动VS。VS会打开一些Wix文件,这些文件在任何其他版本的Wix下都无法工作。如果您忘记执行此操作,您的VS构建将失败,并显示“无法从程序集C:\Program Files(x86)\WiX Toolset v3.10\bin\WixTasks.dll”加载“GenerateCompileWithObjectPath”任务的消息(非常神秘)

我按照以下说明解决了此问题:

从下载WIX311.exe 从下载Votive2017.vsix

从解决方案/项目中删除任何旧的WiX nuget数据包

按照以下说明操作(可以省略/静音)

来自上述网站的内容

要安装: 步骤1:从web下载源代码并获取安装程序wix311.exe。 步骤2:运行以下命令:wix311.exe/install/quiet