gpt4 book ai didi

C# 应用程序和汇编 hell !

转载 作者:行者123 更新时间:2023-11-30 18:42:33 25 4
gpt4 key购买 nike

我在我的家用电脑上使用 Windows 7、VS 2008 和 .net Framework 2.0 创建了一个 C# 项目。我的应用程序正在使用“Irklang”声音库。使用 InnoSetup 5 我已经为我的应用程序创建了设置。安装程序包括所有需要的文件,它可以很好地安装它们,但是当我在其他计算机上安装我的应用程序时,我遇到了一些令人困惑的错误。第一个看起来像这样:

enter image description here

当我创建带有“regserver”标记“irklang.dll”的安装脚本(在安装过程中注册)时,我在安装我的程序时遇到了这个错误:“无法注册 DLL/OCX:RegSrv32 失败,退出代码为 0x4 ”。消息有标准的“中止、忽略、重试”按钮,但一如既往,“重试”无法解决问题。

我该怎么办?如何修复这个甚至不应该困扰普通程序员的错误?

这是我的 Inno setup 安装文件:

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[CustomMessages]
dotnetmissing=This setup requires the .NET Framework v2.0. Please download and install the .NET Framework v.2 and run this setup again. Do you want to download the framework now?

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{10087152-8A1D-4C0B-9BFC-E463C2F8E3C0}
AppName=Kucni rad
AppVersion=1.5
;AppVerName=Kucni rad 1.5
DefaultDirName={pf}\Kucni rad
DefaultGroupName=Kucni rad
OutputDir=C:\Users\Boza\Desktop
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes



[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Code]
function InitializeSetup(): Boolean;
var
ErrorCode: Integer;
NetFrameWorkInstalled : Boolean;
Result1 : Boolean;
begin

NetFrameWorkInstalled := RegKeyExists(HKLM,'SOFTWARE\Microsoft\.NETFramework\policy\v2.0');
if NetFrameWorkInstalled =true then
begin
Result := true;
end;

if NetFrameWorkInstalled = false then
begin
NetFrameWorkInstalled := RegKeyExists(HKLM,'SOFTWARE\Microsoft\.NETFramework\policy\v2.0');
if NetFrameWorkInstalled =true then
begin
Result := true;
end;

if NetFrameWorkInstalled =false then
begin
//Result1 := (ExpandConstant('{cm:dotnetmissing}'), mbConfirmation, MB_YESNO) = idYes;
Result1 := MsgBox(ExpandConstant('{cm:dotnetmissing}'),
mbConfirmation, MB_YESNO) = idYes;
if Result1 =false then
begin
Result:=false;
end
else
begin
Result:=false;
ShellExec('open',
'http://download.microsoft.com/download/5/6/7/567758a3-759e-473e-bf8f-52154438565a/dotnetfx.exe',
'','',SW_SHOWNORMAL,ewNoWait,ErrorCode);
end;
end;
end;
end;


[Dirs]
Name: "{app}\Sounds"

[Files]
Source: "C:\Users\Boza\Desktop\Novi kucnirad\kucnirad\bin\Debug\kucnirad.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\Boza\Desktop\Novi kucnirad\kucnirad\bin\Debug\Sounds\*"; DestDir: "{app}\Sounds"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\Boza\Desktop\Novi kucnirad\kucnirad\bin\Debug\ikpMP3.dll"; DestDir: "{app}"; Flags: ignoreversion regserver
Source: "C:\Users\Boza\Desktop\Novi kucnirad\kucnirad\bin\Debug\irrKlang.NET2.0.dll"; DestDir: "{app}"; Flags: ignoreversion regserver

; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\Kucni rad"; Filename: "{app}\kucnirad.exe"
Name: "{group}\{cm:UninstallProgram,Kucni rad}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\Kucni rad"; Filename: "{app}\kucnirad.exe"; Tasks: desktopicon

[Run]
Filename: "{app}\kucnirad.exe"; Description: "{cm:LaunchProgram,Kucni rad}"; Flags: nowait postinstall skipifsilent

编辑:我得到了它!这不是我的应用程序的问题,而是下载的 DLL 本身的问题!似乎是 IrrKlang.dll 1.3 版(我使用的最新版本)导致了问题! 1.1 版工作正常!

最佳答案

RegSrv32 用于 COM dll,从外观上看,irklang.dll 是一个 .NET dll。

.NET DLL 如果需要对 COM 可用,可以使用 RegAsm.exe 进行注册。

关于C# 应用程序和汇编 hell !,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5641704/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com