using assemblies


T

Tony Johansson

Hello!

Assume I have two projects. In the first one I build the assembly test.exe
and in the second one I build the class library myLibrary.dll
This test.exe is using the class library called myLibrary.dll so I have a
reference to this class library.

Normally when I build this test.exe the class library myLibrary.dll. is
copied to the local directory where the assembly test.exe is located.

But now to my question if I delete the myLibrary.dll in the folder where
test.exe is located and then just run the test.exe without
rebuilding the test.exe the class library is copied to the folder where the
test.exe is located.

So is this normal that a run of a program cause a copy of a dll.
For me this was a surprise because I thought that I had to rebuild to have
my class library
copied to the folder where the test.exe is located.

//Tony
 
Ad

Advertisements

H

Hans Kesting

Tony Johansson formulated the question :
Hello!

Assume I have two projects. In the first one I build the assembly test.exe
and in the second one I build the class library myLibrary.dll
This test.exe is using the class library called myLibrary.dll so I have a
reference to this class library.

Normally when I build this test.exe the class library myLibrary.dll. is
copied to the local directory where the assembly test.exe is located.

But now to my question if I delete the myLibrary.dll in the folder where
test.exe is located and then just run the test.exe without
rebuilding the test.exe the class library is copied to the folder where the
test.exe is located.

So is this normal that a run of a program cause a copy of a dll.
For me this was a surprise because I thought that I had to rebuild to have
my class library
copied to the folder where the test.exe is located.

//Tony
How do you run that "test.exe"?
- doubleclick on the filename: that shouldn't copy the dll
- (Ctrl+)F5 from within Visual Studio: that still does a build

Hans Kesting
 
I

Ignacio Machin ( .NET/ C# MVP )

Hello!

Assume I have two projects. In the first one I build the assembly test.exe
and in the second one I build the class library myLibrary.dll
This test.exe is using the class library called myLibrary.dll so I have a
reference to this class library.

Normally when I build this test.exe the class library myLibrary.dll. is
copied to the local directory where the assembly test.exe is located.

But now to my question if I delete the myLibrary.dll in the folder where
test.exe is located and then just run the test.exe without
rebuilding the test.exe the class library is copied to the folder where the
test.exe is located.

So is this normal that a run of a program cause a copy of a dll.
For me this was a surprise because I thought that I had to rebuild to have
my class library
copied to the folder where the test.exe is located.

//Tony
From the IDE, when you press F5 the IDE does the process (or the steps
that are neeeded) to compile & run the app, one of these steps is copy
the references that are included, are not part of the framework (or
more exactly that are marked as copy local) as well as any other file
marked as content.
 
C

Chris Dunaway

Assume I have two projects. In the first one I build the assembly test.exe
and in the second one I build the class library myLibrary.dll
This test.exe is using the class library called myLibrary.dll so I have a
reference to this class library.
The others have answered your question, but I wanted to point out one
thing. If you have control of both project, then you should not be
referencing the .dll in your .exe project. Instead, you should use a
project reference. In other words, reference the project, not
the .dll.

Chris
 
Ad

Advertisements

Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top