2011-04-12 64 views
3

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

enter image description here

当我创建安装脚本flaging“irklang.dll”与“REGSERVER”(安装过程中需注册),我得到了我的安装程序的过程中这个错误:“无法注册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工作正常!

+4

当安装程序运行时,Regsvr32需要管理员权限。你能得到该对象的.net版本吗? – 2011-04-12 21:21:11

+0

您可以从融合日志中获得更多信息。如果异常详细信息不包含融合日志信息,则可以通过其他方式获得它,例如以下描述的方法:http://blogs.msdn.com/b/suzcook/archive/2003/05/29/57120。 aspx – Cirdec 2011-04-12 21:47:09

+0

如果您尝试在32位计算机上安装64位DLL,或者反过来(使用64位工具的32位DLL),也会发生此类事情。 – 2011-04-12 22:13:52

回答

0

RegSrv32是为COM DLL和从它的外观irklang.dll是一个.NET DLL。

.NET DLL可以使用RegAsm.exe注册,如果它们需要可用于COM。

+0

请再来? :)真的,我不知道注册dll-s,大多数情况下,一切正常工作时安装它是工作... – Nemo 2011-04-12 21:40:42

0

我假设这是在Windows Vista或7上?添加到您的InnoSetup文件中,要求用户成为管理员。

即在脚本的[Setup]部分添加“PrivilegesRequired = admin”。

+0

它适用于Windows 7,因为它是在Win7上创建,编译和编译的。它不能在WinXP上运行! – Nemo 2011-04-12 21:39:43

+0

@Nemo在这里发表你的剧本。 – AngryHacker 2011-04-12 21:43:02

+0

@Nemo另外它在你的机器上工作的原因是因为DLL已经在你的机器上注册了。 – AngryHacker 2011-04-12 21:44:03

0

错误消息确实表示无法加载IrrKlang.NET2.0 或其某个依赖关系,因此您可能会发现它需要其他dll才能工作,而这恰好是您的计算机之一。

最好回到你得到这个DLL应该有这种记录。

更新。

显然,这需要MSVCR80.DLL和MSVCM80.DLL see here

+0

我知道!我已经安装了“vcredist_x86”,我的测试计算机上也有VS2008 - 没有运气! :\ – Nemo 2011-04-12 22:27:11

+0

您可以尝试从sysinternals下载并运行Process Monitor。这将向您显示您的应用程序正在尝试加载的任何文件,并可能指向其他要求。 – sgmoore 2011-04-12 22:43:28

0

我一直在寻找通过谷歌和整个this forum post来了。看来,根据你使用的是哪个版本的库,.NET 2.0可能存在一个已知的问题。他们建议将此添加到您的app.config中:

<startup useLegacyV2RuntimeActivationPolicy="true"> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> 
</startup> 
相关问题