我有一个WiX安装程序和自定义操作项目。我添加了C#库作为Custom action&Project项目的参考。这个C#dll使用DllImport到一个C ++ dll。安装时我收到错误:无法加载DLL class ChangeViewController: UIViewController {
@IBOutlet weak var usdamount: UITextField!
@IBOutlet weak var label: UILabel!
var noImput = "Merci de saisir une valeur"
var currencynum = Int()
override func viewDidLoad() {
super.viewDidLoad()
label.text = ""
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// rejet du clavier
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?){
view.endEditing(true)
super.touchesBegan(touches, with: event)
}
@IBAction func currency(_ sender: UISegmentedControl) {
switch sender.selectedSegmentIndex{
case 0:
currencynum = 0
break
case 1:
currencynum = 1
break
default:
break
}
}
@IBAction func convert(_ sender: AnyObject) {
if usdamount.text == "" {
label.text = noImput
} else {
let num = Int(usdamount.text!)
switch currencynum {
case 0:
let convertednum = Double(num!) * 14500
label.text = "\(num!) Euro(s) = \(convertednum) Rupiah(s)"
break
case 1:
let convertednum = Double(num!) * 0.000067
label.text = "\(num!) Rupiah = \(convertednum) Euros"
break
default:
break
}
}
}
}
:找不到指定的模块。我将mycpp.dll
添加到CA项目并尝试使用属性:嵌入式资源,复制到输出目录 - 但没有结果。如何让我的安装程序找到mycpp.dll
?
答案 0 :(得分:1)
我以前遇到过这个问题。在阅读了wix的MSBuild文件之后,我最终找到了一个属性,该属性用作包含自定义操作dll的自解压程序包中所需的dll的列表。
在wix.ca.targets(在sdk文件夹中)中有一个名为CustomActionContents的属性,在运行makesfxca时使用。
这是对这组msbuild目标的评论,它们打包了你的自定义动作dll。
<!--
==================================================================================================
PackCustomAction
Creates an MSI managed custom action package that includes the custom action assembly,
local assembly dependencies, and project content files.
[IN]
@(IntermediateAssembly) - Managed custom action assembly.
@(Content) - Project items of type Content will be included in the package.
$(CustomActionContents) - Optional space-delimited list of additional files to include.
[OUT]
$(IntermediateOutputPath)$(TargetCAFileName) - Managed custom action package with unmanaged stub.
==================================================================================================
-->
和
<!--
Items to include in the CA package:
- Reference assemblies marked CopyLocal
- Project items of type Content
- Additional items in the CustomActionContents property
-->
所以看起来您可以将mycpp.dll的引用标记为本地副本,它将自动被选中,或者您可以在自定义操作项目中添加新属性(可能编辑csproj并添加属性)包含dll的路径,它将被拾取。