Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/290.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/7/symfony/6.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
C# 通过WIX安装程序安装了CLI项目EXE的C不起作用 我有一个C项目,通过DLL调用C++ CLI。它向C返回一个字符串,该字符串显示在按钮事件的文本框中。我已经添加了这个dllnamed MyDll.dll,方法是将它作为引用添加到我的C项目属性中。我正在尝试使用wix工具集创建一个安装程序。这是源代码_C#_C++_Dll_Wix_Command Line Interface - Fatal编程技术网

C# 通过WIX安装程序安装了CLI项目EXE的C不起作用 我有一个C项目,通过DLL调用C++ CLI。它向C返回一个字符串,该字符串显示在按钮事件的文本框中。我已经添加了这个dllnamed MyDll.dll,方法是将它作为引用添加到我的C项目属性中。我正在尝试使用wix工具集创建一个安装程序。这是源代码

C# 通过WIX安装程序安装了CLI项目EXE的C不起作用 我有一个C项目,通过DLL调用C++ CLI。它向C返回一个字符串,该字符串显示在按钮事件的文本框中。我已经添加了这个dllnamed MyDll.dll,方法是将它作为引用添加到我的C项目属性中。我正在尝试使用wix工具集创建一个安装程序。这是源代码,c#,c++,dll,wix,command-line-interface,C#,C++,Dll,Wix,Command Line Interface,C代码 C++CLI代码 C++CLI头 我的WXS文件 我的安装程序运行良好。它将在指定的路径上安装一个exe和一个dllMyDll.dll。但是当我运行exe时,它什么也不做。如果我用在我的C项目的bin文件夹中创建的exe替换安装的exe,那么它可以正常工作。我如何解决这个问题 谢谢错误在于这两行: <File Source="$(var.MyProject.TargetPath)" /> <File Source="$(var.M

C代码

C++CLI代码

C++CLI头

我的WXS文件

我的安装程序运行良好。它将在指定的路径上安装一个exe和一个dllMyDll.dll。但是当我运行exe时,它什么也不做。如果我用在我的C项目的bin文件夹中创建的exe替换安装的exe,那么它可以正常工作。我如何解决这个问题


谢谢

错误在于这两行:

          <File Source="$(var.MyProject.TargetPath)" />
          <File Source="$(var.MyProject.TargetPath)" Name="MyDll.dll" ShortName="AF" />
其中变量包含指向源exe和dll文件的路径

#include "stdafx.h"

#include "MyDll.h"

namespace MyDll
{
    Class1::Class1(){}
    Class1::~Class1(){}
    Class1::!Class1(){}

    String^ Class1::MyFunc([Out] String^ str)
    {
        str = "My C++/Cli DLL";
        return outVal = str;
    }
}
// MyDll.h

#pragma once

using namespace System;
using namespace System::Runtime::InteropServices;

namespace MyDll {

    public ref class Class1
    {
        // TODO: Add your methods for this class here.
    public:
        Class1::Class1();
        Class1::~Class1();
        Class1::!Class1();

        String^ MyFunc([Out] String^ str);

        String^ outVal;
    };
}
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="installer_test" Language="1033" Version="1.0.0.0" Manufacturer="Company" UpgradeCode="a928c48a-8e5b-4038-b871-939ff8a9349f">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

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

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

  <Fragment>
    <Property Id="ROOTDRIVE">
      <![CDATA[E:\]]>
    </Property>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFiles" Name="ProgramFiles">
        <Directory Id="TopFolder" Name="EXE3">
          <Directory Id="INSTALLFOLDER" Name="Main folder">
            <Component Id="cmpMain" Guid="{0509AAED-64A8-43F6-8935-70FB12305189}" KeyPath="yes" Feature="ProductFeature">
              <File Source="$(var.MyProject.TargetPath)" />
              <File Source="$(var.MyProject.TargetPath)" Name="MyDll.dll" ShortName="AF" />
            </Component>


          </Directory>
        </Directory>
      </Directory>
    </Directory>
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER"></Property>
    <UIRef Id="WixUI_InstallDir"/>
  </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)"/>-->
         <!-- TODO: Insert files, registry keys, and other resources here. -->
      <!--   </Component> -->



    </ComponentGroup>
    </Fragment>
</Wix>
          <File Source="$(var.MyProject.TargetPath)" />
          <File Source="$(var.MyProject.TargetPath)" Name="MyDll.dll" ShortName="AF" />
<File Source="$(var.MyProject.TargetPathExe)" />
<File Source="$(var.MyProject.TargetPathDll)" />