473,242 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,242 software developers and data experts.

An exception occurred in the OnBeforeInstall event handler of <name> Access to the path <path> is denied.

Hello I am developing a Windows Ce 5.0 mobile application. I followed the
example shown at :

Creating Self-Updating Applications With the .NET Compact Framework

I was able to build the Cab file installer and Setup for the application
just fine and I created the CustomInstaller in VB rather than C# in the

However on running of the Setup.exe file I receive the error:

"An exception occurred in the OnBeforeInstall event handler of
<application name>InstallDLL.CustomInstaller. --Access to the path
'C:\Windows\system32\TEMP\<application name>\InstallDLL.dll' is denied."

Here is the CustomInstaller class for reference

Imports System.ComponentModel
Imports System.Configuration.Install
Imports System.IO
Imports Microsoft.Win32
Public Class CustomInstaller

Private Const CEAPPMGR_PATH As String =
"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\CEAPPMGR.EXE"
"SOFTWARE\Microsoft\Windows CE Services"
Private Const INSTALLED_DIR As String = "InstalledDir"
Private Const CEAPPMGR_INI_FILE As String = "<application name>.ini"
Private Const APP_SUBDIR As String = "\<application name>"
Private TEMP_PATH As String = Environment.SystemDirectory &
"\TEMP\<application name>"

Public Sub New()
AddHandler BeforeInstall, AddressOf
AddHandler AfterInstall, AddressOf
AddHandler BeforeUninstall, AddressOf
End Sub

Private Function GetAppInstallDirectory() As String
' Get the ActiveSync install directory
Dim keyActiveSync As RegistryKey =
Registry.LocalMachine.OpenSubKey(ACTIVESYNC_INSTAL L_PATH)
If keyActiveSync Is Nothing Then
` Throw New Exception("ActiveSync is not installed.")
End If
' Build the target directory path under the ActiveSync
Dim activeSyncPath As String =
CType(keyActiveSync.GetValue(INSTALLED_DIR), String)
Dim installPath As String = activeSyncPath & APP_SUBDIR
Return installPath
End Function

Private Sub CustomInstaller_BeforeInstall(ByVal sender As Object,
ByVal e As InstallEventArgs)
' Find the location where the application will be installed
Dim installPath As String = GetAppInstallDirectory()
' Create the target directory
' Copy your application files to the directory
Dim installFile As String
For Each installFile In Directory.GetFiles(TEMP_PATH)
File.Copy(installFile, Path.Combine(installPath,
Path.GetFileName(installFile)), True)
' Get the path to ceappmgr.exe
Dim keyAppMgr As RegistryKey =
Dim appMgrPath As String =
CType(keyAppMgr.GetValue(Nothing), String)
' Run CeAppMgr.exe to install the files to the device
System.Diagnostics.Process.Start(appMgrPath, "\" &
"Path.Combine(installPath, CEAPPMGR_INI_FILE)" & "\")
End Sub

Private Sub CustomInstaller_AfterInstall(ByVal sender As Object,
ByVal e As InstallEventArgs)
'Delete the temp files
Dim tempFile As String
For Each tempFile In Directory.GetFiles(TEMP_PATH)
End Sub

Private Sub CustomInstaller_BeforeUninstall(ByVal sender As Object,
ByVal e As InstallEventArgs)
' Find where the application is installed
Dim installPath As String = GetAppInstallDirectory()
' Delete the files
Dim appFile As String
For Each appFile In Directory.GetFiles(installPath)
' Delete the folder
End Sub

End Class
Oct 5 '07 #1
0 2811

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Jim Hubbard | last post by:
I have some C# code that is supposed to wrap the defrag APIs and I am trying to convert it to VB.Net (2003). But, I keep having problems. The C# code is relatively short, so I'll post it...
by: paritycheck | last post by:
Hi Guys, I'm stuck with a terribly persistant "Access to the path *** is denied" problem. I'm trying to upload a foile using the file control. The code checks if a file of the same name as...
by: SteveK | last post by:
I'm getting the error: "Cannot implicitly convert type 'MovesDBMigrate.MotionNameElementTypes' to 'int'" for this line of code: m_nameElementTableNames = "Tbl_NameCharacters"; Of course if...
by: sharpener | last post by:
I'm new to C# and to newsgroups, so please bear with a possibly foolish query. I'll try to be sensible. The results of /// <summary> ... </summary> etc. appear immediately in the Object...
by: | last post by:
This question references to KB articles: http://support.microsoft.com/default.aspx?scid=kb;EN-US;315158 http://support.microsoft.com/default.aspx?scid=kb;EN-US;317012 I'm running Advanced Server...
by: TLM | last post by:
I am trying to build a web application that will contain links to files on a users local computer. I am assuming that the files will be in a known location and can display in a browser window. ...
by: ajos | last post by:
hi frnds, im trying to convert my servlets database configuration from ms access to mysql database.however im getting some error like no driver found exception. to verify this error ive...
by: Stefan Pascal | last post by:
Hello. I have a very strange problem on my system with running C# applications from a longer than usual (>127 chars) path. I was able to reproduce the following 2 cases: 1. Socket s = new...
by: fyitang | last post by:
hi guys, here is the sample: string strFileFullName = ""; try { FileInfo currentFile = GetOneFile("some directory"); strFileFullName = currentFile.FullName; // do someting...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.