Hi,
I am unsure where to post this. I have an MSIL dll.
----
..assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
.ver 1:0:5000:0
}
..namespace Test
{
.class public obj1 extends [mscorlib]System.Object
{
.method public hidebysig specialname rtspecialname instance void .ctor()
cil managed
{
.maxstack 1
ldarg.0
call instance void [mscorlib]System.Object:: .ctor()
ret
}
}
}
---
that I compile with ilasm.exe
When I try to reference it in C# I get
"A reference to 'Test.dll' could not be loaded. This is not a valid assembly
or COM Component. Only assemblies with extension 'dll' and COM Components
can be referenced. Pleae make sure the file is accessible, and that it is a
valid assembly or COM Component".
The line to compile the module is
C:\WINNT\Micros oft.NET\Framewo rk\v1.1.4322\il asm.exe obj1.msil /dll
/res:obj1.rct /output:Test.dll
the obj1.rct file is join to the mail. If you can't read it just create a
resource file in C# and add the version.
NB:
Another test was to try to load it via the System.Reflecti on.Assembly
System.Reflecti on.Assembly a = System.Reflecti on.Assembly.Loa d("obj1.dll") ;
this throws an exception with "File or assembly name
C:\Files\msil\t est\obj1.dll, or one of its dependencies, was not found."
Thanks in advance
Yoz 2 6538
Yoz,
Your DLL lacks an assembly manifest (it's just a module), that's why
you can't reference it. Add something like
..assembly MyAsm
{
.ver 1:2:3:4
}
to your code. Another test was to try to load it via the System.Reflecti on.Assembly
System.Reflect ion.Assembly a = System.Reflecti on.Assembly.Loa d("obj1.dll") ;
this throws an exception with "File or assembly name C:\Files\msil\ test\obj1.dll, or one of its dependencies, was not found."
Assembly.Load takes an assembly name, not a file path. To load an
assembly from a file path you use Assembly.LoadFr om.
Mattias
--
Mattias Sjögren [MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Thanks a lot.
Sorry, I am just a begginer :-)
"Mattias Sjögren" <ma************ ********@mvps.o rg> wrote in message
news:e8******** ******@tk2msftn gp13.phx.gbl... Yoz,
Your DLL lacks an assembly manifest (it's just a module), that's why you can't reference it. Add something like
.assembly MyAsm { .ver 1:2:3:4 }
to your code.
Another test was to try to load it via the System.Reflecti on.Assembly
System.Reflect ion.Assembly a =
System.Reflecti on.Assembly.Loa d("obj1.dll") ; this throws an exception with "File or assembly name C:\Files\msil\ test\obj1.dll, or one of its dependencies, was not found."
Assembly.Load takes an assembly name, not a file path. To load an assembly from a file path you use Assembly.LoadFr om. Mattias
-- Mattias Sjögren [MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ Please reply only to the newsgroup. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bob |
last post by:
I'm taking a first look at MSIL and downloaded a sample project. In the file I
see this message:
* Build with "ilasm /EXE mandelbrot.il" on .Net RTM
I can find ilasm nowhere, not on my hard drive, not on the VS.Net installation
discs, not on the web. And my search for RTM gives me info on the compact
framswork or response time monitoring... apparetnely I'm still a newbie looking
for a clue...
|
by: Wiktor Zychla |
last post by:
Hello,
are there any good references to .NET history? I would like to read some
more about the development of the ILasm language and the C# language. were
they developed separately? is it true that the first c# compilers targeted
JVM because the .NET RE was not ready at that time? how the ideas of old
VJ++ platform affected the .NET development?
unfortunately, I didn't find any good resources on that topic over the
Internet. I am even...
|
by: Wiktor Zychla |
last post by:
Hello,
for some reason I need to use attributes in ILAsm code and read these
attributes in C# code. My problem is with the attribute declaration inside
ILAsm code. I know that I define any attribute by using ILasm's ".custom"
keyword but I do not understand how to initialize the attribute Value blob
when the attribute contains some fields. I just do not understand that
binary format:
..custom instance void MyAttribute::.ctor(bool) =...
|
by: Ioannis Vranos |
last post by:
I have some thoughts lately, to get on ILASM. However may someone tell
me whether the introduction of generics etc will have as a result
additions or changes to the .NET assembly language?
Regards,
|
by: suresh_C# |
last post by:
Dear All,
What is difference between Portable Executable (PE) file and a Assembly?
Thanks,
Mahesh
| |
by: gpsmobiler |
last post by:
Hi,
I found through a lot of exhausting searching, that the following C#
code will cause the IL code below:
const byte ICON_MONO12BY12 =0;
....... IL-file....
.field literal private static unsigned int8 'a' = uint8 (0)
|
by: masoud moosavi |
last post by:
hello,
please give me the syntax of the ilasm language programmin,or write a
simple program ,
thanks a lot
|
by: ajk |
last post by:
Hi
When doing a .NET compiler what are the benefits of generating ILAsm
directly compared to generating another higher level language like C#
first and then using the C# compiler?
Round-tripping will not work and debugging may be easier, any other
reasons why it would be prefered to generate ILAsm?
tia/ajk
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |