losdude

When attempting to run a .net 2.0 application on VISTA Ultimate Edition, the program contains the following logic:

if (Directory.Exists(currentDrive + Utility.FOLDER_APPLICATION_OLD))

{

di = new DirectoryInfo(currentDrive + Utility.FOLDER_APPLICATION_OLD);

foreach(FileInfo fileDelete in di.GetFiles())

{

try

{

fileDelete.Delete();

}

catch (Exception exCantDelete)

{

}

}

}

It is always indicated in VISTA that the application can't seem to delete files of type *.exe, *.dll, etc. Is there a restriction that VISTA won't allow this to occur I am logged in as administrator when I run this program. The exception is

+ [System.UnauthorizedAccessException] {"Access to the path 'BackgroundCopyManager.dll' is denied."} System.UnauthorizedAccessException

This also happens when trying to delete LINKS in the startup menu, .exe's in this program files folder, and anything else in this old app's program files folder. Is this a security feature In case you were wondering, I'm only trying to delete (un-install) an older version of this software that was written in .net 1.1. This new 2.0 app is attempting to delete the old 1.1 app version I wrote if it finds it. But it can't delete the program files.



Re: Application Compatibility for Windows Vista .net 2.0 can't delete files on VISTA

Julien Roger

Read documentation about UAC

http://msdn2.microsoft.com/en-us/library/aa480150.aspx

Actually, you should not write or delete in program files at runtime. Only at installtime.





Re: Application Compatibility for Windows Vista .net 2.0 can't delete files on VISTA

LosDude

But on a ClickOnce installation that's impossible, isn't it Since that whole process is automated Unless there's a way to intercept some stages of that process



Re: Application Compatibility for Windows Vista .net 2.0 can't delete files on VISTA

Mo Nail - MFST

It appears that you are not using an msi or ClickOnce for installation. You will need to use an installer to properly add and remove files, registry keys, etc., from Vista.




Re: Application Compatibility for Windows Vista .net 2.0 can't delete files on VISTA

LosDude

Actually this is using ClickOnce for installation.  How might I include something to properly add and remove files with this technology   Is there a namespace I should be looking at to accomplish this

The sample code above is run when the program is run.  I am very happy to do this properly and put it in the installation process if that is possible.

Any help is appreciated.





Re: Application Compatibility for Windows Vista .net 2.0 can't delete files on VISTA

Mo Nail - MFST

"ClickOnce Deployment Overview" will give you a starting point including what you can do with ClickOnce vs. msi

http://msdn2.microsoft.com/en-us/library/142dbbz4.aspx

For additional help with ClickOnce try the "ClickOnce and Setup & Deployment Projects"

http://forums.microsoft.com/MSDN/ShowForum.aspx ForumID=6&SiteID=1

For example,

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=625348&SiteID=1






Re: Application Compatibility for Windows Vista .net 2.0 can't delete files on VISTA

LosDude

I thank you for the reply, but is there an interface I can inherit in order to add additional functionality during the installation I think that's the key in getting done what I wanted. I went through the links above and couldn't locate anything that would indicate this



Re: Application Compatibility for Windows Vista .net 2.0 can't delete files on VISTA

LosDude

Ok, I found more on UNinstalling the previous version.  In my .bat file during installation I run the msiexec /x with the product code as shown below.  This does everything that I want except it doesn't run on VISTA.  It just doesn't do anything... WinXP does it fine.. So for me, this is OK.  But I'm wondering if anyone out there will have this problem on VISTA  

@ECHO OFF

ECHO Uninstalling previous version...

start Msiexec /qn /x {XXXXXXX-22FA-41CE-9741-A68982DAFA47}

ECHO Installing DotNet 2...

start /wait dotnetfx.exe /q:a /c:"install.exe /q"


start /wait setup.exe

exit