replace running application


I want to replace an exe-file while it is running on other clients. In the project I added the code

Open in new window


Most of the time that works great but I have one customer where I can not replace the exe until the application is closed on one of the computers (not always the same). It seems that this computer prevents the replacement.

What can be the reason? (environment: virtual Server and Win7 clients, most of them 32bit)
Thanks for your help, Peter
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sinisa VukSoftware architectCommented:
Documentation said that you can use these flags if win detect running from net/rem. drive - not from local folder. Is you app on net share?
formiAuthor Commented:
yes, it is. Could it make any difference if it is run with unc-path or drive-letter?
ste5anSenior DeveloperCommented:
These flags are intended that a local copy of the executable is created in the page file and then the executable is run from there.

It does not necessarily mean, that the executable is not locked.

So I would guess in this case it is locked.

But what you can do: You can rename a locked executable..
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

formiAuthor Commented:
you are right: in most cases I can rename it even if the app is executed. But in some cases it is impossible to rename it. I get the message "the action can't be completed because the file is open in System".
ste5anSenior DeveloperCommented:
hmm, what is your basic problem?

Simple updates or frequent ones?

In the first case I can live with locked executables. When you need frequent updates, then I would consider a starter application and numbered executables.
formiAuthor Commented:
it's only a problem of convenience (I don't make twice a day updates of course). But because it works sometimes and sometimes not I would know the reason. So I hadn't to tell the customer to close 15 application (points of sales) just to replace the exe.
ste5anSenior DeveloperCommented:
hmm, use a messaging system for a remote shutdown and restart.
formiAuthor Commented:
I'm not allowed to shut down remote because this are points of sale. and with the flag IMAGE_FILE_NET_RUN_FROM_SWAP it should load the whole Image and not let it locked.
ste5anSenior DeveloperCommented:
The Problem is, that the documentation is pretty vague about when and under whether conditions a lock is accquired and released, when using IMAGE_FILE_NET_RUN_FROM_SWAP.

How is your share hosted?
formiAuthor Commented:
there is a virtual server environment, Windows Server 2012 Standard.
ste5anSenior DeveloperCommented:
I'm not allowed to shut down remote because this are points of sale.

When it's necessary for a clean update, then this is nonsense. Especially as your current mechanism leaves you in a state where you may have deployed a important update, but you cannot tell, whether an POS is using it..
Geert GOracle dbaCommented:
at start of the application check for a new version
if so copy it, then start the app

this requires a loading application

you can do a lot with such a loading application
> periodically check for updates
> send a windows message to the open applications
>> which then show a popup ... new version available

in other words ... you're looking for a better deployment system

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
formiAuthor Commented:
a possible way but it didn't really answer by question. Thanks anyway.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.