Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
568 views
in Technique[技术] by (71.8m points)

deployment - How to update an assembly for a running c# process (AKA hot deploy)?

I have a .exe assembly and a set of referenced assemblies that I would like to be able to deploy updated code for. I don't need to actually change the running code, but the next time I launch the executable I would want it to pick up the updated code. Currently when I attempt to copy over the running file I get an error about the .exe being used by another process.

To summarize; how can I update the code while the .exe is in use?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It is easy to do. You can rename the file, Windows has a lock on the handle, not the directory entry for the file. Now you can just copy the update without problems. All that's left to do is to get rid of the renamed file after your app starts up again. If necessary.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...