Asp.net web api WiX 3.8网站安装程序-执行MSI时不会发生任何事情
我正在使用WIX3.8为MVCWebAPI项目构建一个网站安装程序。我已经成功地按照教程的步骤创建了MSI文件,该文件只需将所有web应用程序文件复制到我的IIS文件夹中即可。然而,在执行它时,我没有看到任何文件被复制,MSI退出时没有任何错误。我还检查了事件日志,其中显示安装程序已成功运行。以下是MS生成文件:Asp.net web api WiX 3.8网站安装程序-执行MSI时不会发生任何事情,asp.net-web-api,wix,installation,Asp.net Web Api,Wix,Installation,我正在使用WIX3.8为MVCWebAPI项目构建一个网站安装程序。我已经成功地按照教程的步骤创建了MSI文件,该文件只需将所有web应用程序文件复制到我的IIS文件夹中即可。然而,在执行它时,我没有看到任何文件被复制,MSI退出时没有任何错误。我还检查了事件日志,其中显示安装程序已成功运行。以下是MS生成文件: <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="3.5" DefaultT
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebSiteSource>..\API\</WebSiteSource>
<SetupF>..\Setup\</SetupF>
<PublishF>publish\</PublishF>
<Publish>$(SetupF)$(PublishF)</Publish>
<WebSiteContentCode>WebAPIContent.wxs</WebSiteContentCode>
<WebSiteContentObject>WebSiteContent.wixobj</WebSiteContentObject>
<MsiOut>bin\Release\Setup.msi</MsiOut>
</PropertyGroup>
<!-- Defining group of temporary files which is the content of the web site. -->
<ItemGroup>
<WebSiteContent Include="$(WebSiteContentCode)" />
</ItemGroup>
<!-- The list of WIX input files -->
<ItemGroup>
<WixCode Include="Product.wxs" />
<WixCode Include="$(WebSiteContentCode)" />
</ItemGroup>
<Target Name="Build">
<!-- Compile in release mode -->
<MSBuild Projects="..\API\API.csproj" Targets="ReBuild" Properties="Configuration=Release" />
</Target>
<Target Name="PublishWebsite">
<!-- Remove complete publish folder in order to be sure that evrything will be newly compiled -->
<Message Text="Removing publish directory: $(SetupF)"/>
<RemoveDir Directories="$(SetupF)" ContinueOnError="false" />
<Message Text="Start to publish website" Importance="high" />
<MSBuild Projects="..\API\API.csproj" Targets="ResolveReferences;_CopyWebApplication" Properties="OutDir=$(Publish)bin\;WebProjectOutputDir=$(Publish);Configuration=Release" />
</Target>
<Target Name="Harvest">
<!-- Harvest all content of published result -->
<Exec
Command='"$(Wix)bin\heat" dir $(Publish) -dr INSTALLFOLDER -ke -srd -cg apicomponents -var var.publishDir -gg -out $(WebSiteContentCode)'
ContinueOnError="false"
WorkingDirectory="." />
</Target>
<Target Name="WIX">
<Message Text="TEST: @(WixCode)"/>
<Exec
Command='"$(Wix)bin\candle" -dpublishDir=$(Publish) -dMyWebResourceDir=. @(WixCode, ' ')'
ContinueOnError="false"
WorkingDirectory="." />
<Exec
Command='"$(Wix)bin\light" WebAPIContent.wixobj Product.wixobj -out $(MsiOut)'
ContinueOnError="false"
WorkingDirectory="." />
<Message Text="Install package has been created." />
</Target>
</Project>
..\API\
..\设置\
发表\
$(SetupF)$(PublishF)
WebAPIContent.wxs
WebSiteContent.wixobj
bin\Release\Setup.msi
Product.wxs
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="ApiSetup" Language="1033" Version="1.0.0.0" Manufacturer="Fingent" UpgradeCode="20e8d558-9fc4-4bd3-9842-76ae40edd994">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of API is already installed." />
<Media Id="1" Cabinet="api.cab" EmbedCab="yes" />
<Feature Id="ProductFeature" Title="api.Setup" Level="1">
<ComponentGroupRef Id="apicomponents" />
</Feature>
</Product>
<Fragment>
<!-- Will default to C:\ if that is the main disk -->
<Directory Id="TARGETDIR" Name="SourceDir">
<!-- Will reference to C:\wwwroot-->
<Directory Id="INETPUB" Name="Inetpub">
<!-- Will reference to c:\wwwroot\api-->
<Directory Id="INSTALLFOLDER" Name="api" />
</Directory>
</Directory>
</Fragment>
</Wix>
正如你所看到的,我使用了Heat来生成文件列表。它的WXS文件已经正确生成,我也得到了OBJ文件和MSI,但在执行之后什么也没做。请帮助。问题可能是由于以下原因造成的: 1) 在
HeatFile.wxs
生成中。HeatFile.wxs
可能已成功生成,但它可能不包含需要安装软件的目录
为此,在生成HeatFile.wxs
时,将-dr yourinstallationdirectory
标记添加到命令行
Complete命令如下所示:
heat.exe dir "path to directory which needs to be harvested" -dr INSTALLDIR -cg Components -gg -g1 -srd -var var.MyDir -out HeatFile.wxs
2) 但是,您发现您的TARGETDIR
原来是D:\
驱动器。这是因为wix搜索具有最多可用磁盘空间的目录,并在默认情况下在该目录中安装msi
但您可以使用以下标记更改根目录:
< SetDirectory Id="TARGETDIR" Value="C:\" / >
希望这有帮助:)结果是targetdir是我的D驱动器,而不是C:。我在那里找到了文件。不知道如何将其设置为C驱动器。哇!在发布问题7个月后给出答案!谢谢你不辞劳苦。我正在着手另一个安装项目,这次要复杂得多。如果有任何问题,我都会联系你。WiX肯定是一个复杂的野兽!!事实上,我也从一个月前开始研究wix。所以,当我遇到一个类似的问题时,我在谷歌上搜索并到达这里,然而,我在这里没有找到任何解决方案。我再次阅读了我的全部代码,发现了这个bug。然后我想发布解决方案,这样可能会有所帮助。:\:)