I have a Setup Project within a Visual Studio 2008 Solution, and within the
same Solution a DLL Assembly containing an Installer class.
The Setup Project incorporates the Primary Output of the DLL and uses the
Installer class for an "AfterInstall" Custom Action.
Here is a code snippet from the AfterInstall event of the DLL Installer
class:
' This is the target Path
Dim tarPath As String = Me.Context.Parameters.Item("TARDIR").ToString
tarPath = System.IO.Path.Combine(tarPath, "Data\Gbr.001")
' Get Source path
Dim sorPath As String = Me.Context.Parameters.Item("SORDIR").ToString
If Right(sorPath, 1) <> "\" Then sorPath += "\"
Dim sorExist As Boolean = False
Dim fls() As System.IO.FileInfo = Nothing
Try
'Dim x As String = Threading.Thread.CurrentPrincipal.Identity.Name.ToString
Dim dInfo As System.IO.DirectoryInfo = New System.IO.DirectoryInfo(sorPath)
fls = dInfo.GetFiles()
sorExist = True
Catch ex As Exception
sorExist = False
End Try
The dInfo DirectoryInfo class is constructed using a UNC path as the
argument, in this case of the format \\Servername\Share\Folder. The UNC
path points to a remote server on the same LAN as my development PC.
I debug the project by right-clicking on the Setup project and choosing to
Install. When the MSI Setup Installer requests that I choose a debugger, I
choose my VS2008 IDE and I can hit a breakpoint immediately after dInfo has
been instantiated.
At this point, the situation is always the same: dInfo reports that "Access
is Denied" to the UNC path.
The UNC path is definitely good in the sense that I can browse to it; and
moreover, permissions have been configured such that EVERYONE has Full
Control of the Share, and Everyone has full control of the underlying NTFS
folders.
So taken at face value the issue would appear possibly to be that the
process does not have sufficient permission to access Network Resources from
the local PC? I have noticed that the Windows Installer Service runs under
the Local System Account, which presumably cannot access network resources.
Will I need to revise my strategy to avoid trying to access network
resources from an MSI Installer?
As a temporary workaround, I have tried modifying the Log On properties of
the Windows Service to utilise a Domain Admin account. The service will
start okay using this logon. However, when I try to run the Install from the
IDE (i.e. start the debugging process) I get an error message that says,
"The Windows Installer Service could not be accessed. This can occur if you
are running Windows in safe mode, or if the Windows Installer is not
correctly installed. Contact your support personnel for assistance."
I would be grateful for any thoughts as to how I can progress; really at the
proverbial Road Block with this one
Best regards
(1) Building the full solution;
(2) Not launching the debug session from the IDE, but instead, browsing to
the Build directory, right-clicking on Setup.exe, choosing "Run As...",
specifying my own User Account, and unchecking the box that reads: "Protect
my computer ...activity."
Why exactly launching the MSI from the IDE would cause it to run within a
different security context is a question that, for me, remains, but can wait
for another day.
thanks
"Robert Ellis" <robe_2k...@hotmail.co.uk> wrote in message
news:%23K8xSqB...@TK2MSFTNGP06.phx.gbl...
"Robert Ellis" <robe_2k...@hotmail.co.uk> wrote in message
news:uNs90aDd...@TK2MSFTNGP04.phx.gbl...
"Wilson, Phil" <ph...@wonderware.nospam.com> wrote in message
news:DC418139-B547-4D27...@microsoft.com...