Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to update executable file in same VS solution

Posted on 2006-11-30
6
Medium Priority
?
173 Views
Last Modified: 2010-04-23
In a VS .Net 2003 solution I have a project called «App1».

From this project «App1» I can download an updated version of the exe called «App1_UPDATED.exe», put it in the same folder as «App1» and close the application.

Question:
Next time I start this VS .Net 2003 solution, I would like to check if there is a file called «App1_UPDATED.exe», and if so, delete «App1.exe», rename «App1_UPDATED.exe» to «App1.exe» and launch the newly updated «App1.exe».

What would be the best way ?

scml
0
Comment
Question by:scml
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 
LVL 16

Accepted Solution

by:
Hillwaaa earned 500 total points
ID: 18049349
Hi scml,

If I understand you correctly, you could do the following in your application startup code:

        Dim pathToAppUpdated As String = "c:\somepath\app_updated.exe"
        Dim pathToApp As String = "c:\somepath\app.exe"
        If IO.File.Exists(pathToAppUpdated) Then
            IO.File.Delete(pathToApp)
            IO.File.Copy(pathToAppUpdated, pathToApp)
            IO.File.Delete(pathToAppUpdated)
        End If

Cheers,
Hillwaaa
0
 
LVL 15

Expert Comment

by:Solar_Flare
ID: 18049374
Why do you want to do this? each time you build the app1 project it will overwrite the app1.exe file.
0
 
LVL 15

Expert Comment

by:Solar_Flare
ID: 18049381
sorry i misunderstood. disregard that last comment.
0
 
LVL 15

Assisted Solution

by:Solar_Flare
Solar_Flare earned 500 total points
ID: 18049425
to do what you want you will need to use a separate application, as your application will not be able to remove/update itself. The process app1.exe cannot be running when you try to do it otherwise you will get an error.


you could create a startup application called something like "start.exe" which checks to see if an updated version exists then starts the application

dim path as string = application.startuppath
if system.io.file.exists(path & "\app1_updated.exe") then
     IO.File.Move(path & "\app1_updated.exe", path & "\app1.exe")
end if

'now run the application
system.diagnostics.process.start(path & "\app1.exe")

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question