system.badimageformatexception returned from custom installer

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a web project that I have converted from VS 2003 to VS 2005. The
installer is configured to use detect a newer version and if found to
uninstall the old version before installing the new version.

The installer in the new version VS 2005 contains custom actions that are
compiled with VS 2005. For launch conditions, I have configured the .NET
Framework to be at 2.0.50727 and Allow Later Version si set to True.

When I run the installer I receive the system.badimageformatexception which
references the dll that contains the custom installer code.

If I uninstall the 2003 version of the software and then do an install of
the 2005 version everything works fine. But if I have the 2003 version
installed and then run the installer for the 2005 version I receive the error
about the bad image.

Is this a bug? Am I doing something wrong? Are there workarounds? Will my
customers have to uninstall the old version manually before installing the
new version?

Thanks,

Leslie
 
Hi Leslie,
When I run the installer I receive the system.badimageformatexception
which references the dll that contains the custom installer code.

Would you please provide more detailed information about your custom
installer?

1. How do you invoke that dll from the customer action?

2. What about that dll, is it a .NET installer class?

3. How do you create that DLL and reference it in your setup project?

These information will help us isolate your issue, so I appreciate your
time in performing them. Let me know the results at your earliest
convenience. If you have any questions or concerns, please let me know. I
am standing by to help you.

Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Gary,

The answers to your questions are below.

1. How do you invoke that dll from the customer action?

The dll is created as a seperate project. and is manually added to the web
project in the web project's bin directory. The dll is identified as a custom
Action dll by going to the custom actions tab and then by right clicking
Install, navigating to the bin folder and then clicking Add Assembly. I do
not have any Conditions specified for the custom action and no
CustomActionData is passed. No entry point is identified and the
InstallerClass property is set to true.



2. What about that dll, is it a .NET installer class?

Yes it is an installer class. I have added an eventLogInstaller. In the
overridden Install function I log the install in the application event log.

3. How do you create that DLL and reference it in your setup project?

The dll is created as a seperate project. and is manually added to the web
project in the web project's bin directory. The dll is identified as a custom
Action dll by going to the custom actions tab and then by right clicking
Install, navigating to the bin folder and then clicking Add Assembly.



"Gary Chang[MSFT]" said:
Hi Leslie,
When I run the installer I receive the system.badimageformatexception
which references the dll that contains the custom installer code.

Would you please provide more detailed information about your custom
installer?

1. How do you invoke that dll from the customer action?

2. What about that dll, is it a .NET installer class?

3. How do you create that DLL and reference it in your setup project?

These information will help us isolate your issue, so I appreciate your
time in performing them. Let me know the results at your earliest
convenience. If you have any questions or concerns, please let me know. I
am standing by to help you.

Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Thanks for the detailed information, Leslie.

I thin that installer dll is a pure .NET class library assembly, isn't it?

According to the message, the problem is that dll is not a valid image. In
this regard, have you tried this dll with another setup project? I suggest
you can create an simple setup project and add the dll in question as its
custom action, then check it whether works alright.

By the way, I suggest you can add your assembly(installer dll) to the
Application Folder in the setup project's File System view, then add it as
a CA at the required stage (Install, Uninstall, Commit, Rollback).

Thanks!

Best regards,

Gary Chang
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Gary,

You are correct, this is a pure .NET class library assembly.

As far as being a valid image, keep in mind that if I run the setup that
contains this .NET 2.0 custom action, it works great if no prior version of
the application is installed.

The problem occurs when I have a prior version of the application (which is
developed against .NET 1.1) installed. In this scenario, the setup is to
detect the prior version which is the 1.1 version, uninstall it and then
install the 2005 version which contains the .NET 2.0 custom action.

I think the problem may be that somewhere in the install process the 1.1
version is trying to load and execute the 2.0 custom action.

Does this make sense? Is there a work around or a fix for this?

Thanks,

Leslie
 
Hi Leslie,
I think the problem may be that somewhere in the
install process the 1.1 version is trying to load and
execute the 2.0 custom action.

I don't think so. The exception "System.badimageformatexception" indicates
the target VA dll is not a valid image. Since you can run your installation
process, the launch condition you specified has already ensured the .NET
framework version 2.0 has already been in the target installation machine,
so the target machine should be able to load your .NET Framework 2.0's CA
DLL.
As far as being a valid image, keep in mind that if I
run the setup that contains this .NET 2.0 custom action,
it works great if no prior version of the application is installed.

Can you make sure that CA has really been invoked in that scenario?

The Windows installer would not use the .NET Framework to run the CA
according to the .NET Framework version of the application which it
attempts to uninstall.

Have you tried the tests I suggested? I suggest you can also create another
simple .NET Framework 2.0's installer class, replace the one in question
with it in your setup project for another test, this could verify your
assumption.


Thanks!

Best regards,

Gary Chang
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Mason,

I can repro the scenarios in my side. Based on my research, the problem is
when your Upgrade2005 installation package attempts remove the previous
product, for the reason it is an ASP.NET 1.1's application, the installer
process will load the CLR 1.1 to perform some necessary tasks. Afterwards,
the installer process will also use the CLR 1.1 to run your .NET Framework
2.0's installer assembly, so the error occurs.

According to my tests, if the previous product is not a .NET 1.1 (ASP.NET
1.1) application (e.g. a pure native application installed by a VS2003
setup project), the problem would not happen.

So in this regard, this behavior is by design. I suggest you had better use
the .NET Framework 1.1 installer class in your current solution. Since most
..NET 1.1's assembly could run well under .NET Framework 2.0, it would be an
acceptable workaround.

Thanks!

Best regards,

Gary Chang
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top