Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Clickonce ManifestReader Access Denied
 

Clickonce ManifestReader Access Denied

Hi,

Whenever I try to use

ApplicationManifest appManifest = (ApplicationManifest)ManifestReader.ReadManifest("ApplicationManifest", clientSetupFilesFolder, false);

I get an "access denied" exception while debugging. I am running Visual Studio 2008/SP1 under Admin. However, if I use StreamReader/StreamWriter, I have no problems reading & writing the application manifest found in the path.

Any ideas?

Thanks.

Lenardd  Wednesday, August 19, 2009 5:59 AM
Could you please give the full type and text of the exception being issued?

And I don't want to sound all pedantic about variable names, but I'm a bit suspicious about the path you use to the manifest, as it looks it might be a folder path instead of a file path. Using a folder path does issue an UnauthorizedAccessException.

Under the covers, ManifestReader.ReadManifest first does:
File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read)

Looking at http://msdn.microsoft.com/en-us/library/y973b725.aspxmay help better determine what the problem may be.
-- Mike
Mike Wade - MSFT  Friday, August 21, 2009 11:16 PM
Hi Mike,

I found out what the problem was.....actually it was Saurabh Bhatia at Microsoft that clued me in. The problem was that I was not pointing to the actually application file but to my "ClientSetupFilesFolder". When I looked at the documentation, it stated "The path name of the input file" . I took that to mean "the location of the input file". I knew it had to be something stupid when I couldn't find others with the same problem! :)

Anyways, thanks for following up.

--Lenard

Lenardd  Monday, August 24, 2009 1:37 AM
Could you please give the full type and text of the exception being issued?

And I don't want to sound all pedantic about variable names, but I'm a bit suspicious about the path you use to the manifest, as it looks it might be a folder path instead of a file path. Using a folder path does issue an UnauthorizedAccessException.

Under the covers, ManifestReader.ReadManifest first does:
File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read)

Looking at http://msdn.microsoft.com/en-us/library/y973b725.aspxmay help better determine what the problem may be.
-- Mike
Mike Wade - MSFT  Friday, August 21, 2009 11:16 PM
Hi Mike,

I found out what the problem was.....actually it was Saurabh Bhatia at Microsoft that clued me in. The problem was that I was not pointing to the actually application file but to my "ClientSetupFilesFolder". When I looked at the documentation, it stated "The path name of the input file" . I took that to mean "the location of the input file". I knew it had to be something stupid when I couldn't find others with the same problem! :)

Anyways, thanks for following up.

--Lenard

Lenardd  Monday, August 24, 2009 1:37 AM

You can use google to search for other answers

Custom Search

More Threads

• How to access a datafile outside sendbox of clickonce?
• Building Installations in Visual Studio 2005
• Clickonce problem
• need to copy files to the system32 folder.
• Adjusting Bootstrapper Sample to install MDAC
• Removing start menu group?
• C# Setup Project - Bring Installation Window to Front
• Custom launch condition
• embedding files in an installer
• Disable repairing for specific files