473,408 Members | 2,405 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,408 software developers and data experts.

Overwriting .NET assemblies in use

It seems that I can overwrite a .net assembly even though it is in use
(in most cases). In some cases, the OS says File in use. Is there a
write-up somewhere on when a .net assembly can be messed with (e.g.
overwritten, renamed, deleted, etc...).

Regards
Jan 15 '07 #1
6 2832
Peter Bromberg [C# MVP] wrote:
Frank,
This rather concise post by Junfeng Zhang should prove helpful:

http://blogs.msdn.com/junfeng/archiv.../09/69919.aspx
That's interesting (in fact I've often wondered why my asp.net
assemblies run from folders with cockamamie names). But in a winform
app, the shadow folder functionality is not on, however, I can still
delete or rename the assembly when in use.
Jan 16 '07 #2
"Frank Rizzo" <no**@none.comwrote in message
news:%2***************@TK2MSFTNGP03.phx.gbl...
Peter Bromberg [C# MVP] wrote:
>Frank,
This rather concise post by Junfeng Zhang should prove helpful:

http://blogs.msdn.com/junfeng/archiv.../09/69919.aspx

That's interesting (in fact I've often wondered why my asp.net assemblies run from folders
with cockamamie names). But in a winform app, the shadow folder functionality is not on,
however, I can still delete or rename the assembly when in use.
Are you sure "the" assembly is un use? My guess is that the loaded assembly, is not the one
you are deleting/overwriting.
Assemblies are just regular files opened by the OS in read-only mode, no-one can ever delete
or overwrite the file as long as there is still an open handle to the file.

Willy.

Jan 16 '07 #3
Willy Denoyette [MVP] wrote:
"Frank Rizzo" <no**@none.comwrote in message
news:%2***************@TK2MSFTNGP03.phx.gbl...
>Peter Bromberg [C# MVP] wrote:
>>Frank,
This rather concise post by Junfeng Zhang should prove helpful:

http://blogs.msdn.com/junfeng/archiv.../09/69919.aspx

That's interesting (in fact I've often wondered why my asp.net
assemblies run from folders with cockamamie names). But in a winform
app, the shadow folder functionality is not on, however, I can still
delete or rename the assembly when in use.

Are you sure "the" assembly is un use? My guess is that the loaded
assembly, is not the one you are deleting/overwriting.
Assemblies are just regular files opened by the OS in read-only mode,
no-one can ever delete or overwrite the file as long as there is still
an open handle to the file.
Try this. Start a winform app. While it's running, try to rename the
exe. You will see that the OS will not complain about it.

>
Willy.
Jan 17 '07 #4
Hi Frank,

It is impossible to write to the EXE of a running application (or any of
its DLLs, for that matter). However, it is possible to rename the EXE and
copy a new EXE with the original name in its place. The application will
continue to run from the renamed EXE, and you won't be able to delete the
renamed EXE until you exit.

It is common to all the .exes including a .NET application. Please check
the following link for more information.

http://groups.google.com/group/comp....in32/browse_th
read/thread/d4caf1f10b94f46/34a25255651c63ae?lnk=st&q=exe+rename+share+write
&rnum=9#34a25255651c63ae

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.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/subscripti...t/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jan 17 '07 #5
"Frank Rizzo" <no**@none.comwrote in message news:uA**************@TK2MSFTNGP02.phx.gbl...
Willy Denoyette [MVP] wrote:
>"Frank Rizzo" <no**@none.comwrote in message
news:%2***************@TK2MSFTNGP03.phx.gbl...
>>Peter Bromberg [C# MVP] wrote:
Frank,
This rather concise post by Junfeng Zhang should prove helpful:

http://blogs.msdn.com/junfeng/archiv.../09/69919.aspx

That's interesting (in fact I've often wondered why my asp.net assemblies run from
folders with cockamamie names). But in a winform app, the shadow folder functionality
is not on, however, I can still delete or rename the assembly when in use.

Are you sure "the" assembly is un use? My guess is that the loaded assembly, is not the
one you are deleting/overwriting.
Assemblies are just regular files opened by the OS in read-only mode, no-one can ever
delete or overwrite the file as long as there is still an open handle to the file.

Try this. Start a winform app. While it's running, try to rename the exe. You will see
that the OS will not complain about it.
Who's talking about rename? Renaming a file does not result in a delete or overwrite of the
attached file (the exe), rename isn't even a file IO operation, it doesn't touch the file,
all it does is changing the name of the file in the MFT (NTFS).

Willy.

Jan 17 '07 #6
Hi Frank,

I'd like to know if this issue has been resolved yet. Is there anything
that I can help. I'm still monitoring on it. If you have any questions,
please feel free to post them in the community.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jan 23 '07 #7

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

Similar topics

6
by: Tom Dacon | last post by:
If you're not putting assemblies in the GAC, but are referencing shared code with copylocal=true into the projects that use them, is there any value to signing the assemblies? In the environment...
1
by: Afaq | last post by:
Hi, After adding large number of empty resource files (which will be updated later), we are not able to compile the project. the following is the output of the build process. It fails while...
19
by: tweak | last post by:
I have been messing around with buffers, and I found it peculiar that the code below will run without a segmentation fault. As far as I know, overwriting the allocated space from a call to...
8
by: Charles Law | last post by:
I'm sorry to keep harping on about this one, but it is really quite important for me to be able to list _all_ required assemblies in my Help About box. Herfried kindly posted some code before that...
11
by: Steven Jones | last post by:
I have a C program that prints out two lines as follows: Line 1 Line 2 What I would like is for this program to sleep for one second, and then print out two more lines, overwriting the...
3
by: Claudio Pacciarini | last post by:
Hi everyone, I have a question about .NET code sharing and reuse, and also about application design best practices / guidelines. Currently, we have many different .NET projects in source...
2
by: Smithers | last post by:
I have a Windows Forms application that implements a plug-in architecture whereby required assemblies are identified and loaded dynamically. Here are the relevant classes: A = application =...
4
by: illegal.prime | last post by:
Hi all, I'm getting unexpected results when trying to preload assemblies into an AppDomain I'm creating. Upon creation of the AppDomain - I attach an AssemblyResolve to both my current AppDomain...
27
by: Jason | last post by:
Hi, I need to open an existing file, seek to a position at X number of bytes, and write out Y number of bytes overwriting any existing bytes, but no erasing any other data. Is this possible? ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
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...
0
Oralloy
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,...
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.