Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio 2012 使用Wix生成MSI_Visual Studio 2012_Wix_Windows Installer_Wix3 - Fatal编程技术网

Visual studio 2012 使用Wix生成MSI

Visual studio 2012 使用Wix生成MSI,visual-studio-2012,wix,windows-installer,wix3,Visual Studio 2012,Wix,Windows Installer,Wix3,我正在使用WIX3.8为我创建的VisualStudio项目创建MSI安装程序。我遵循了这个简单的Wix项目,但即使这样,我也会犯错误。这是我的 我已经添加了我的VS2012项目作为我的Wix安装程序的参考 这是我的Product.ws文件: <?xml version="1.0" encoding="UTF-8"?> <Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:iis='http://schem

我正在使用WIX3.8为我创建的VisualStudio项目创建MSI安装程序。我遵循了这个简单的Wix项目,但即使这样,我也会犯错误。这是我的

我已经添加了我的VS2012项目作为我的Wix安装程序的参考

这是我的
Product.ws
文件:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'
   xmlns:iis='http://schemas.microsoft.com/wix/IIsExtension'>
    <Product Id="*" Name="MyProjectInstaller2" Language="1033" Version="2.0.0.0" Manufacturer="Company" UpgradeCode="7f5b63be-bdad-4cc9-b4df-b3f1648c0539">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

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

        <Feature Id="ProductFeature" Title="MyProjectInstaller2" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
        </Feature>
    </Product>

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="MyProjectInstaller2" />
            </Directory>
        </Directory>
    </Fragment>

    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
            <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
            <!-- <Component Id="ProductComponent"> -->
        <File Source="$(var.MyProject.TargetPath)" />
            <!-- </Component> -->
        </ComponentGroup>
    </Fragment>
</Wix>

我已经搜索了互联网的内部,寻找这个基本问题的解决方案。为什么VS2012无法识别该元素?

您应该遵循下一个层次结构:ComponentGroup->Component->File等等。在您的示例中,我建议您将File元素放入单独的组件中,然后将该组件添加到ComponentGroup中。试着这样做:

<Component Directory="YOUR-DIRECTORY" Guid="your-guid" Id="SomeComponent">
    <File Source="$(var.MyProject.TargetPath)"/>
</Component>
<ComponentGroup Directory="INSTALLFOLDER" Id="ProductComponents">
    <ComponentRef Id="SomeComponent"/>
</ComponentGroup>

阅读您的

您需要删除
和周围的注释

如果取消注释
组件
元素会发生什么?请尝试or。我做了John做的事情,遇到了相同的问题。当然修复非常简单,但重点是本教程是错误的(这可能是第一次在VS中使用WiX的人的入门教程!)。显然,这一问题至少从2014年开始被提出。使用最新的v3.11/VS2017工具。
<Component Directory="YOUR-DIRECTORY" Guid="your-guid" Id="SomeComponent">
    <File Source="$(var.MyProject.TargetPath)"/>
</Component>
<ComponentGroup Directory="INSTALLFOLDER" Id="ProductComponents">
    <ComponentRef Id="SomeComponent"/>
</ComponentGroup>