By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,187 Members | 1,629 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,187 IT Pros & Developers. It's quick & easy.

Overwrite file in use

P: n/a
Hi,

I need to write a function that can replace some (.dll) files. That's easy
to do but what if there are some files in use ? How can I replace those
files ? is there a method to 'force' an overwrite ?
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Gene,

This is quiete simple, you cannot.

Cor
Nov 21 '05 #2

P: n/a
"Gene Vangampelaere" <ge****************************@infohos.remove.thi s.be>
schrieb:
I need to write a function that can replace some (.dll) files. That's easy
to do but what if there are some files in use ? How can I replace those
files ? is there a method to 'force' an overwrite ?


The only way I can think of is using p/invoke to delay the operation until
the next reboot:

How To Move Files That Are Currently in Use
<URL:http://support.microsoft.com/?scid=kb;EN-US;140570>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #3

P: n/a
Gene,
In addition to the other comments:

Are these .dll files in use by your app or another app. Is the app that
using them a .NET app?

If the .dll files are in use by a .NET app, then I understand you can use
the Shadow Copy Files feature of an AppDomain (which is what ASP.NET uses).

To enable Shadow Copy Files for an AppDomain you need to set the
AppDomainSetup.ShadowCopyFiles & AppDomainSetup.ShadowCopyDirectories
properties when creating a new AppDomain.

The following article should get you started:
http://msdn.microsoft.com/library/de...rp05162002.asp

Its in C#, however it should be easily converted to VB.NET.

Hope this helps
Jay

"Gene Vangampelaere" <ge****************************@infohos.remove.thi s.be>
wrote in message news:Oa**************@tk2msftngp13.phx.gbl...
Hi,

I need to write a function that can replace some (.dll) files. That's easy
to do but what if there are some files in use ? How can I replace those
files ? is there a method to 'force' an overwrite ?

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.