473,396 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Loading EXE in the Application [Assembly]?

Hi,

I am trying to load an executable as assembly (this exe is not .net
made, it is just an exe made using install shield). I am using the
following code to load

Assembly myAssembly = Assembly.LoadFrom(@"C:\setup.exe");
it is giving me the error that "BadImageFormatException"
Plzzzz Help...
Regards
-Sajin

Jun 18 '07 #1
5 1914
Sajin,

If the assembly is not managed, then you can not call the static methods
on the Assembly class to execute it.

If you need to execute the assembly, you will want to pass the path of
the executable to the static Start method on the Process class, like so:

Process.Start(@"C:\setup.exe");

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"sajin" <sa***@iprlab.comwrote in message
news:11*********************@j4g2000prf.googlegrou ps.com...
Hi,

I am trying to load an executable as assembly (this exe is not .net
made, it is just an exe made using install shield). I am using the
following code to load

Assembly myAssembly = Assembly.LoadFrom(@"C:\setup.exe");
it is giving me the error that "BadImageFormatException"
Plzzzz Help...
Regards
-Sajin

Jun 18 '07 #2
Hi,

Of course, because it;s not an assembly. It's not even managed code.

What are you trying to do?

I think that you want to execute the program, if that;s so use Process.Start

"sajin" <sa***@iprlab.comwrote in message
news:11*********************@j4g2000prf.googlegrou ps.com...
Hi,

I am trying to load an executable as assembly (this exe is not .net
made, it is just an exe made using install shield). I am using the
following code to load

Assembly myAssembly = Assembly.LoadFrom(@"C:\setup.exe");
it is giving me the error that "BadImageFormatException"
Plzzzz Help...
Regards
-Sajin

Jun 18 '07 #3
Hi,
I have a setup file which is created by Install shield, it is signed
with test.cert and a private key, i want to read the public key from
the exe.if i use .net exe, it is giving me the answer
public X509Certificate GetAuthenticodeCertificate(Assembly target)
{
X509Certificate certificate = null;
foreach (object item in target.Evidence)
{
Publisher publisher = item as Publisher;
if (publisher != null)
{
certificate = publisher.Certificate;
break;
}
}

return certificate;
}

i have to pass the exe as assembly to this function.

On Jun 18, 8:32 pm, "Ignacio Machin \( .NET/ C# MVP \)" <machin TA
laceupsolutions.comwrote:
Hi,

Of course, because it;s not an assembly. It's not even managed code.

What are you trying to do?

I think that you want to execute the program, if that;s so use Process.Start

"sajin" <s...@iprlab.comwrote in message

news:11*********************@j4g2000prf.googlegrou ps.com...
Hi,
I am trying to load an executable as assembly (this exe is not .net
made, it is just an exe made using install shield). I am using the
following code to load
Assembly myAssembly = Assembly.LoadFrom(@"C:\setup.exe");
it is giving me the error that "BadImageFormatException"
Plzzzz Help...
Regards
-Sajin- Hide quoted text -

- Show quoted text -

Jun 18 '07 #4
That's the thing, it won't give you an answer because the Assembly is a
^managed^ assembly in the GetAuthenticodeCertificate method. You are not
working with a managed assembly, it's that simple.

You have to get the certificate through other means.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"sajin" <sa***@iprlab.comwrote in message
news:11**********************@j4g2000prf.googlegro ups.com...
Hi,
I have a setup file which is created by Install shield, it is signed
with test.cert and a private key, i want to read the public key from
the exe.if i use .net exe, it is giving me the answer
public X509Certificate GetAuthenticodeCertificate(Assembly target)
{
X509Certificate certificate = null;
foreach (object item in target.Evidence)
{
Publisher publisher = item as Publisher;
if (publisher != null)
{
certificate = publisher.Certificate;
break;
}
}

return certificate;
}

i have to pass the exe as assembly to this function.

On Jun 18, 8:32 pm, "Ignacio Machin \( .NET/ C# MVP \)" <machin TA
laceupsolutions.comwrote:
>Hi,

Of course, because it;s not an assembly. It's not even managed code.

What are you trying to do?

I think that you want to execute the program, if that;s so use
Process.Start

"sajin" <s...@iprlab.comwrote in message

news:11*********************@j4g2000prf.googlegro ups.com...
Hi,
I am trying to load an executable as assembly (this exe is not .net
made, it is just an exe made using install shield). I am using the
following code to load
Assembly myAssembly = Assembly.LoadFrom(@"C:\setup.exe");
it is giving me the error that "BadImageFormatException"
Plzzzz Help...
Regards
-Sajin- Hide quoted text -

- Show quoted text -


Jun 18 '07 #5
So is there any solution?

On Jun 18, 8:52 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
That's the thing, it won't give you an answer because the Assembly is a
^managed^ assembly in the GetAuthenticodeCertificate method. You are not
working with a managed assembly, it's that simple.

You have to get the certificate through other means.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"sajin" <s...@iprlab.comwrote in message

news:11**********************@j4g2000prf.googlegro ups.com...
Hi,
I have a setup file which is created by Install shield, it is signed
with test.cert and a private key, i want to read the public key from
the exe.if i use .net exe, it is giving me the answer
public X509Certificate GetAuthenticodeCertificate(Assembly target)
{
X509Certificate certificate = null;
foreach (object item in target.Evidence)
{
Publisher publisher = item as Publisher;
if (publisher != null)
{
certificate = publisher.Certificate;
break;
}
}
return certificate;
}
i have to pass the exe as assembly to this function.
On Jun 18, 8:32 pm, "Ignacio Machin \( .NET/ C# MVP \)" <machin TA
laceupsolutions.comwrote:
Hi,
Of course, because it;s not an assembly. It's not even managed code.
What are you trying to do?
I think that you want to execute the program, if that;s so use
Process.Start
"sajin" <s...@iprlab.comwrote in message
>news:11*********************@j4g2000prf.googlegro ups.com...
Hi,
I am trying to load an executable as assembly (this exe is not .net
made, it is just an exe made using install shield). I am using the
following code to load
Assembly myAssembly = Assembly.LoadFrom(@"C:\setup.exe");
it is giving me the error that "BadImageFormatException"
Plzzzz Help...
Regards
-Sajin- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -

Jun 18 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Brent | last post by:
I maintain a Sql Server database application whose forms are compiled in a .dll and kept in a remote web folder. The main .exe looks to the web folder to see if this .dll exists. If so, then it...
2
by: Foehammer | last post by:
Hello, I'm trying to load an assembly dynamically using an app domain. This is a proof-of-concept for a larger project, so please excuse the lame class names. TestLib is the dll where all the...
4
by: Mark | last post by:
I wan't to be able to deserialize a class from an assembly that is not in the application domain. To do that I must have the Type from the Assembly. How do you get a Type from an assembly that is...
9
by: Ender | last post by:
I have an application that I would like third party developers to be able to create Plug-ins that will be dynamically loaded into our application to extend functionality. I have utilized the...
6
by: Pete Davis | last post by:
I'm confused about what precisely the limitations are on loading plugins in separate app domains. In all my previous apps that supported plugins, I've loaded them into the same domain as the app,...
5
by: Mantorok | last post by:
Hi I have a project that references one of our components, is there a way in ..Net to get a list of references that the application is depending on? The reason for this is so I can load...
0
by: npthomson | last post by:
Hi all, This could get a bit complicated but I'll try to be as clear as possible. I've written an application that discovers plugins at runtime using reflection from a subdirectory of the...
2
by: wzhao2000 | last post by:
Back in COM time, it's possible to use #import statement in cpp to load COM object type info and use it at coding time. When the application is started, the underlying COM DLL will not be loaded...
1
by: =?Windows-1252?Q?Tor_B=E5dshaug?= | last post by:
BlankHi, I am having trouble loading assemblies from the database in my ASP.NET app. I have a default.aspx in my app that is served from a database via a custom virtual path provider. This works...
8
by: =?Utf-8?B?TWFyaw==?= | last post by:
We've got a wierd failure happening on just one machine. One part of our product uses a 3rd party search implementation (dtSearch). DtSearch has a native core (dten600.dll), late-bound, and a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.