无法识别WiX元素

时间:2015-06-03 08:34:04

标签: c# wix

我需要手动使用WiX和MSBuild,我正在尝试创建test.wixproj。我正在学习如何使用WiX创建一个部署者,我被阻止了。 我只是将我的img.png部署到一个已定义的库中。

我有这个(test.wixproj):

s.LinkFormat.Update

当我运行“MSBuild test.wixproj”时,我有这个错误:

  

test.wixproj< 2.1>:错误MSB4068:无法识别或不支持“Wix”项   上下文。

我迷路了,你能帮助我吗?我很难理解它是如何工作的。

EDIT1 :我正在尝试.wixproj和.wxs,现在我还有其他问题。

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" UpgradeCode="" Version="1.0.0.0" Language="1033" Name="My Application Name" Manufacturer="My Manufacturer Name">
        <Package InstallerVersion="300" Compressed="yes"/>
        <Media Id="1" Cabinet="myapplication.cab" EmbedCab="yes" />


        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="APPLICATIONROOTDIRECTORY" Name="Application test"/>
            </Directory>
        </Directory>


        <DirectoryRef Id="APPLICATIONROOTDIRECTORY">
            <Component Id="myimg" Guid="">
                <File Id="myimg" Source="...\Desktop\img.png" KeyPath="yes" Checksum="yes"/>
            </Component>

        </DirectoryRef>


        <Feature Id="MainApplication" Title="Main Application" Level="1">
            <ComponentRef Id="myimg.png" />
        </Feature>
    </Product>
</Wix>

我复制了此示例your link

EDIT2 :我认为这就是问题的根源。

The project was not found

1 个答案:

答案 0 :(得分:1)

ComponentRef应该通过Id引用Component。当没有具有该Id的Component时,您正在使用myimg.png作为ComponentRef Id。尝试将ComponentRef Id更改为&#34; myimg&#34;。

<ComponentRef Id="myimg" />

哦,作为旁注,如果您要在线发布,则应从代码中删除GUID。