Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

I have some code which copies 2 files to a folder. These 2 files are included in the current application folder. Is it possible to embed these 2 files into the .exe and copy them to a destination folder? Here's my code so far:

 

Dim CurrentLocationDll As String = Application.StartupPath & "\FILE.dll"
       Dim DestinationFolder As String = System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\FOLDER"
       If (FileIO.FileSystem.FileExists(CurrentLocationDll)) Then

           ProgressBar1.PerformStep()
           If (FileIO.FileSystem.FileExists(DestinationFolder & "\FILE.dll")) Then
               FileIO.FileSystem.MoveFile(DestinationFolder & "\FILE.dll", DestinationFolder & "\FILE.dll.bak")
               ProgressBar1.PerformStep()
           End If

           FileIO.FileSystem.CopyFile(CurrentLocationDll, DestinationFolder & "\FILE.dll")
           ProgressBar1.PerformStep()
       End If

Posted

I looked through the guides, didn't need it in the end xD

 

Managed to find an example with a .dll and it worked for me. Thanks for helping

  • Administrators
Posted
One thing to be careful with though is the fact than on XP or later only administrators will have permissions to write to the Program Files folder (I'm assuming that is where your application is being installed) so for non-admins this technique might not work. On Vista or later there is a good chance the end user will be annoyed by UAC prompts even if they are admins every time they run this app.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...