Visual studio 2010 WIX 3.6安装程序-Visual Studio 2010(目录)

Visual studio 2010 WIX 3.6安装程序-Visual Studio 2010(目录),visual-studio-2010,wix,windows-installer,wix3.6,heat,Visual Studio 2010,Wix,Windows Installer,Wix3.6,Heat,我正在为一个web服务开发一个WIX3.6安装程序。但我在尝试使用HeatDirectory获取所有必要的输出时遇到了一个问题,无论我如何尝试,每个获取的文件都会出现以下错误: 系统找不到文件“SourceDir\Some.dll…” 错误发生在WcfService.wxs中;奇怪的是WcfService.wxs是由我的项目文件(下面)中的heatdirectory部分自动创建的。如果它必须知道它们在哪里创建WcfService.wxs,它怎么会说找不到这些.dll呢?这些错误甚至发生在我从我读

我正在为一个web服务开发一个WIX3.6安装程序。但我在尝试使用HeatDirectory获取所有必要的输出时遇到了一个问题,无论我如何尝试,每个获取的文件都会出现以下错误:

系统找不到文件“SourceDir\Some.dll…”

错误发生在WcfService.wxs中;奇怪的是WcfService.wxs是由我的项目文件(下面)中的heatdirectory部分自动创建的。如果它必须知道它们在哪里创建WcfService.wxs,它怎么会说找不到这些.dll呢?这些错误甚至发生在我从我读过的任何教程下载并构建WIX示例项目(按原样)时

目标:尽可能多地自动化.dll包含(即利用获取来处理依赖项项目等)

我正在运行Win7 64位,项目是.NET4

Product.wxs:

    <?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*" Name="CompleteInstall" Language="1033" Version="1.0.0.0" Manufacturer="Technologies" UpgradeCode="b2ae6aa5-263f-4f9a-a250-8599a7f2cb03">
    <Package InstallerVersion="200" Compressed="yes" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFiles64Folder">
        <Directory Id="CommonDir1" Name="Common Directory 1">
          <Directory Id="CommonDir2" Name="Common Directory 2">
            <Directory Id="INSTALLFOLDER" Name="Install Directory"/>
          </Directory>
        </Directory>
      </Directory>
    </Directory>

    <Feature Id="ProductFeature" Title="CompleteInstall" Level="1">
      <ComponentGroupRef Id="WcfService_Project" />
    </Feature>

    <Property Id="WIXUI_INSTALLDIR">INSTALLFOLDER</Property>
    <UIRef Id="WixUI_InstallDir" />
  </Product>
</Wix>
<Target Name="BeforeBuild">
    <MSBuild Projects="%(ProjectReference.FullPath)" Targets="Build" Properties="Configuration=$(Configuration);Platform=x86" Condition="'%(ProjectReference.ContentProject)'=='True'" />
    <PropertyGroup>
      <LinkerBaseInputPaths>%(ProjectReference.RootDir)%(ProjectReference.Directory)bin\$(Platform)\$(Configuration)\</LinkerBaseInputPaths>
    </PropertyGroup>
    <HeatDirectory OutputFile="%(ProjectReference.Filename)-temp.xml" 
                   Directory="%(ProjectReference.RootDir)%(ProjectReference.Directory)bin\$(Platform)\$(Configuration)\"
                   DirectoryRefId="INSTALLFOLDER" 
                   ComponentGroupName="%(ProjectReference.Filename)_Project"
                   SuppressCom="true" 
                   SuppressFragments="true" 
                   SuppressRegistry="true"
                   SuppressRootDirectory="true" 
                   AutoGenerateGuids="false" 
                   GenerateGuidsNow="true" 
                   ToolPath="$(WixToolPath)" 
                   Condition="'%(ProjectReference.ContentProject)'=='True'" />
    <XslTransformation XmlInputPaths="%(ProjectReference.Filename)-temp.xml"
                       XslInputPath="XslTransform.xslt" 
                       OutputPaths="%(ProjectReference.Filename).wxs" 
                       Condition="'%(ProjectReference.ContentProject)'=='True'" />
  </Target>
<?xml version="1.0" encoding="utf-8"?><Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="INSTALLFOLDER">
            <Component Id="cmpE6EBA3D8D6D4DB0C93E73200C78DCC51" Guid="{C88B5CF9-8807-45DF-AA6F-732437B74BB6}">
                <File Id="fil0118BBA61671E80581CA9C9AA6DD3E8D" KeyPath="yes" Source="SourceDir\Some.dll" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="WcfService_Project">
            <ComponentRef Id="cmpE6EBA3D8D6D4DB0C93E73200C78DCC51" />
        </ComponentGroup>
    </Fragment>
</Wix>

安装文件夹
项目文件:

    <?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*" Name="CompleteInstall" Language="1033" Version="1.0.0.0" Manufacturer="Technologies" UpgradeCode="b2ae6aa5-263f-4f9a-a250-8599a7f2cb03">
    <Package InstallerVersion="200" Compressed="yes" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFiles64Folder">
        <Directory Id="CommonDir1" Name="Common Directory 1">
          <Directory Id="CommonDir2" Name="Common Directory 2">
            <Directory Id="INSTALLFOLDER" Name="Install Directory"/>
          </Directory>
        </Directory>
      </Directory>
    </Directory>

    <Feature Id="ProductFeature" Title="CompleteInstall" Level="1">
      <ComponentGroupRef Id="WcfService_Project" />
    </Feature>

    <Property Id="WIXUI_INSTALLDIR">INSTALLFOLDER</Property>
    <UIRef Id="WixUI_InstallDir" />
  </Product>
</Wix>
<Target Name="BeforeBuild">
    <MSBuild Projects="%(ProjectReference.FullPath)" Targets="Build" Properties="Configuration=$(Configuration);Platform=x86" Condition="'%(ProjectReference.ContentProject)'=='True'" />
    <PropertyGroup>
      <LinkerBaseInputPaths>%(ProjectReference.RootDir)%(ProjectReference.Directory)bin\$(Platform)\$(Configuration)\</LinkerBaseInputPaths>
    </PropertyGroup>
    <HeatDirectory OutputFile="%(ProjectReference.Filename)-temp.xml" 
                   Directory="%(ProjectReference.RootDir)%(ProjectReference.Directory)bin\$(Platform)\$(Configuration)\"
                   DirectoryRefId="INSTALLFOLDER" 
                   ComponentGroupName="%(ProjectReference.Filename)_Project"
                   SuppressCom="true" 
                   SuppressFragments="true" 
                   SuppressRegistry="true"
                   SuppressRootDirectory="true" 
                   AutoGenerateGuids="false" 
                   GenerateGuidsNow="true" 
                   ToolPath="$(WixToolPath)" 
                   Condition="'%(ProjectReference.ContentProject)'=='True'" />
    <XslTransformation XmlInputPaths="%(ProjectReference.Filename)-temp.xml"
                       XslInputPath="XslTransform.xslt" 
                       OutputPaths="%(ProjectReference.Filename).wxs" 
                       Condition="'%(ProjectReference.ContentProject)'=='True'" />
  </Target>
<?xml version="1.0" encoding="utf-8"?><Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="INSTALLFOLDER">
            <Component Id="cmpE6EBA3D8D6D4DB0C93E73200C78DCC51" Guid="{C88B5CF9-8807-45DF-AA6F-732437B74BB6}">
                <File Id="fil0118BBA61671E80581CA9C9AA6DD3E8D" KeyPath="yes" Source="SourceDir\Some.dll" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="WcfService_Project">
            <ComponentRef Id="cmpE6EBA3D8D6D4DB0C93E73200C78DCC51" />
        </ComponentGroup>
    </Fragment>
</Wix>

%(ProjectReference.RootDir)%(ProjectReference.Directory)bin\$(平台)\$(配置)\
WcfService.wxs:

    <?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*" Name="CompleteInstall" Language="1033" Version="1.0.0.0" Manufacturer="Technologies" UpgradeCode="b2ae6aa5-263f-4f9a-a250-8599a7f2cb03">
    <Package InstallerVersion="200" Compressed="yes" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFiles64Folder">
        <Directory Id="CommonDir1" Name="Common Directory 1">
          <Directory Id="CommonDir2" Name="Common Directory 2">
            <Directory Id="INSTALLFOLDER" Name="Install Directory"/>
          </Directory>
        </Directory>
      </Directory>
    </Directory>

    <Feature Id="ProductFeature" Title="CompleteInstall" Level="1">
      <ComponentGroupRef Id="WcfService_Project" />
    </Feature>

    <Property Id="WIXUI_INSTALLDIR">INSTALLFOLDER</Property>
    <UIRef Id="WixUI_InstallDir" />
  </Product>
</Wix>
<Target Name="BeforeBuild">
    <MSBuild Projects="%(ProjectReference.FullPath)" Targets="Build" Properties="Configuration=$(Configuration);Platform=x86" Condition="'%(ProjectReference.ContentProject)'=='True'" />
    <PropertyGroup>
      <LinkerBaseInputPaths>%(ProjectReference.RootDir)%(ProjectReference.Directory)bin\$(Platform)\$(Configuration)\</LinkerBaseInputPaths>
    </PropertyGroup>
    <HeatDirectory OutputFile="%(ProjectReference.Filename)-temp.xml" 
                   Directory="%(ProjectReference.RootDir)%(ProjectReference.Directory)bin\$(Platform)\$(Configuration)\"
                   DirectoryRefId="INSTALLFOLDER" 
                   ComponentGroupName="%(ProjectReference.Filename)_Project"
                   SuppressCom="true" 
                   SuppressFragments="true" 
                   SuppressRegistry="true"
                   SuppressRootDirectory="true" 
                   AutoGenerateGuids="false" 
                   GenerateGuidsNow="true" 
                   ToolPath="$(WixToolPath)" 
                   Condition="'%(ProjectReference.ContentProject)'=='True'" />
    <XslTransformation XmlInputPaths="%(ProjectReference.Filename)-temp.xml"
                       XslInputPath="XslTransform.xslt" 
                       OutputPaths="%(ProjectReference.Filename).wxs" 
                       Condition="'%(ProjectReference.ContentProject)'=='True'" />
  </Target>
<?xml version="1.0" encoding="utf-8"?><Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="INSTALLFOLDER">
            <Component Id="cmpE6EBA3D8D6D4DB0C93E73200C78DCC51" Guid="{C88B5CF9-8807-45DF-AA6F-732437B74BB6}">
                <File Id="fil0118BBA61671E80581CA9C9AA6DD3E8D" KeyPath="yes" Source="SourceDir\Some.dll" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="WcfService_Project">
            <ComponentRef Id="cmpE6EBA3D8D6D4DB0C93E73200C78DCC51" />
        </ComponentGroup>
    </Fragment>
</Wix>

因此您的WcfService.wxs包括:

<File Id="fil0118BBA61671E80581CA9C9AA6DD3E8D" KeyPath="yes" Source="SourceDir\Some.dll" />


这是指
SourceDir\Some.dll
。此文件必须存在于编译项目的pc上。您可能需要更改路径

当我从用Wix建立一个基本网站转到我们的一个制作网站时,我遇到了与你类似的问题

假设您遵循的是这个示例

如果您查看下一页的评论-

第一条评论提到更改Pareasethesia示例中的beforebuild方法

        <Target Name="BeforeBuild"> 
    
    <MSBuild Projects="%(ProjectReference.FullPath)" Targets="Package" Properties="Configuration=$(Configuration);Platform=AnyCPU" Condition="'%(ProjectReference.WebProject)'=='True'" /> 
    <PropertyGroup> <DefineConstants Condition="'%(ProjectReference.WebProject)'=='True'"> %(ProjectReference.Name).PackageDir=%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\ </DefineConstants> </PropertyGroup> <HeatDirectory OutputFile="%(ProjectReference.Filename).wxs" Directory="%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\" DirectoryRefId="INSTALLDIR" ComponentGroupName="%(ProjectReference.Filename)_Project" AutogenerateGuids="true" SuppressCom="true" SuppressFragments="true" SuppressRegistry="true" SuppressRootDirectory="true" ToolPath="$(WixToolPath)" Condition="'%(ProjectReference.WebProject)'=='True'" Transforms="%(ProjectReference.Filename).xsl" PreprocessorVariable="var.%(ProjectReference.Name).PackageDir" /> 
</Target>

%(ProjectReference.Name).PackageDir=%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(配置)\Package\PackageTmp\
我不得不删除transform属性并更改DirectoryRefId,但到目前为止还不错


希望这能为您指明正确的方向。

问题在于缺少HeatDirectory预处理器变量属性。我通过在wixproj文件中添加以下内容修复了此问题:

<PropertyGroup>
  <DefineConstants>BasePath=%(ProjectReference.RootDir)%(ProjectReference.Directory);</DefineConstants>
</PropertyGroup>
<HeatDirectory OutputFile="%(ProjectReference.Filename).wxs" 
               DirectoryRefId="INSTALLFOLDER" 
               Directory="%(ProjectReference.RootDir)%(ProjectReference.Directory)"
               ComponentGroupName="%(ProjectReference.Filename)_Project"
               SuppressCom="true"
               SuppressFragments="true"
               SuppressRegistry="true"
               SuppressRootDirectory="true"
               AutoGenerateGuids="false"
               GenerateGuidsNow="true"
               ToolPath="$(WixToolPath)"
               Condition="'%(ProjectReference.ContentProject)'=='True'" 
               PreprocessorVariable="var.BasePath"/>

BasePath=%(ProjectReference.RootDir)%(ProjectReference.Directory);
如您所见,我需要首先定义一个常量变量以供本地使用。我将变量设置为WCF项目的根路径。其次,我使用该变量作为预处理器变量。最后,我能够动态/递归地获取从MsBuild生成的文件。下一步:排除不必要的文件。我将提及这一点

请参见以下我的完整wixproj:

<?xml version="1.0" encoding="utf-8"?>
<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.5</ProductVersion>
    <ProjectGuid>{4005592f-cc0e-41a3-8e64-33b2824e7fd9}</ProjectGuid>
    <SchemaVersion>2.0</SchemaVersion>
    <OutputName>MyWCF.WCF.Webservice</OutputName>
    <OutputType>Package</OutputType>
    <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>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <OutputPath>bin\$(Configuration)\</OutputPath>
    <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="MyWCF.WcfService.wxs" />
    <Compile Include="IISConfig.wxs" />
    <Compile Include="InstallUi.wxs" />
    <Compile Include="Product.wxs" />
    <Compile Include="UIDialogs.wxs" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\MyWCF.WcfService\MyWCF.WcfService.csproj">
      <Name>MyWCF.WcfService</Name>
      <Project>{8e528b38-2826-4793-a66d-f6ff181e1139}</Project>
      <Private>True</Private>
      <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
      <RefTargetDir>INSTALLFOLDER</RefTargetDir>
      <ContentProject>True</ContentProject>
      <DoNotHarvest>True</DoNotHarvest>
      <PackageThisProject>True</PackageThisProject>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <WixExtension Include="WixIIsExtension">
      <HintPath>$(WixExtDir)\WixIIsExtension.dll</HintPath>
      <Name>WixIIsExtension</Name>
    </WixExtension>
    <WixExtension Include="WixUtilExtension">
      <HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath>
      <Name>WixUtilExtension</Name>
    </WixExtension>
    <WixExtension Include="WixUIExtension">
      <HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
      <Name>WixUIExtension</Name>
    </WixExtension>
    <WixExtension Include="WixNetFxExtension">
      <HintPath>$(WixExtDir)\WixNetFxExtension.dll</HintPath>
      <Name>WixNetFxExtension</Name>
    </WixExtension>
  </ItemGroup>
  <ItemGroup>
    <Content Include="ConfigurationInitialize.wxi" />
  </ItemGroup>
  <Import Project="$(WixTargetsPath)" />
  <PropertyGroup>
    <PreBuildEvent />
  </PropertyGroup>
  <Target Name="BeforeBuild">
    <MSBuild Projects="%(ProjectReference.FullPath)" Targets="Package" Properties="Configuration=$(Configuration);Platform=$(Platform)" Condition="'%(ProjectReference.PackageThisProject)'=='True'" />
    <PropertyGroup>
      <DefineConstants>BasePath=%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Platform)\$(Configuration)\Package\PackageTmp\</DefineConstants>
    </PropertyGroup>
    <HeatDirectory OutputFile="%(ProjectReference.Filename).wxs" 
                   Directory="%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Platform)\$(Configuration)\Package\PackageTmp"
                   DirectoryRefId="INSTALLFOLDER"
                   ComponentGroupName="%(ProjectReference.Filename)_Project"
                   SuppressCom="true"
                   SuppressFragments="true"
                   SuppressRegistry="true"
                   SuppressRootDirectory="true"
                   AutoGenerateGuids="false"
                   GenerateGuidsNow="true"
                   ToolPath="$(WixToolPath)" Condition="'%(ProjectReference.PackageThisProject)'=='True'"
                   PreprocessorVariable="var.BasePath" />
  </Target>
</Project>

调试
x86
3.5
{4005592f-cc0e-41a3-8e64-33b2824e7fd9}
2
MyWCF.WCF.Webservice
包裹
$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\WiX.targets
$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\WiX.targets
bin\$(配置)\
obj\$(配置)\
bin\$(配置)\
obj\$(配置)\
MyWCF.WcfService
{8e528b38-2826-4793-a66d-f6ff181e1139}
真的
二进制文件;内容;卫星
安装文件夹
真的
真的
真的
$(WixExtDir)\WixIIsExtension.dll
WixIIsExtension
$(WixExtDir)\wixutiltextension.dll
Wixutil扩展
$(WixExtDir)\WixUIExtension.dll
WixUIExtension
$(WixExtDir)\WixNetFxExtension.dll
WixNetFxExtension
基本路径=%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(平台)\$(配置)\Package\PackageTmp\
更新:如果

<PropertyGroup>
<DefineConstants Condition="'%(ProjectReference.WebProject)'=='True'">
%(ProjectReference.Name).PackageDir=%(ProjectReference.RootDir)
%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\
</DefineConstants>
。我不做变换,所以我忽略了。 对于HeatDirectory,它应该可以工作,而不必将proj文件放在底部

这可能会降低我的声誉,但我发现有趣的是,我曾为一个项目工作,但在尝试另一个项目时,它不起作用。
在查看输出后,它似乎选择了合适的热量和蜡烛项目,但光线似乎随机选择了一个。在比较了这两个项目之后,我注意到工作项目的最后一个项目是要收获的项目。当我将.wixproj文件中的项目移动到最后一个引用时,它成功了。

我现在用的是3.5.2519。我知道这是一个老版本,但我们有一些项目需要在Visual Studio中实现并实际获取wxs文件。

您能发布完整的wxs文件吗?可能你没有为某个.dll输入正确的目录…@Wimmel,我已经用完整的wxs更新了原始帖子。谢谢@Wimmel,请记住,我说过,我从多个源下载的示例项目也会出现同样的问题。您指的是
WcfService\u项目
,它应该是另一个作为片段的文件。例如,见。在链接问题中使用
Source=“PathToFile”
。该
PathToFile
应指向一个现有文件。@Wimmel,这实际上是对wxs的引用,该wxs是从目录中产生的。请看我上面的更新,我已经为您添加了wxs。旁注:我也看到了你在我发帖前提供的例子。感谢您迄今为止的帮助,我非常感谢。据我所知,SourceDir是source.dll存在路径的关键字。WcfService.wxs实际上是目录的产品(WcfService.wxs是自动创建的)。问题是如何修复它。我已经更新了我的ori