Here is a code example of my issue.
http://nickpateman.m6.net/Files/localsettingsfolder.zip
--------------
Pressing the first button will create the folder (in my case)...
C:\Documents and Settings\Nick\Application
Data\myCompany\localsettingsfolder\1.0.0.0
pressing the second button will create the folder (in my case)...
C:\Documents and Settings\All Users\Application
Data\myCompany\localsettingsfolder\1.0.0.0
And finally, pressing the last button will create the folder (again in my
case)...
C:\Documents and Settings\Nick\Local Settings\Application
Data\myCompany\localsettingsfolder.exe_StrongName_ o3k0oc2nrm2v415aeg1y2fjvft5be5td\1.0.0.0
--------------
Now what I am actually trying to do is delete *all* of these 3 folders when
the application is uninstalled via a switch "/U" to the application. I hate
it when applications leave junk all over the computer this wasn't there
before it was installed and is certainly not needed after.
The last folder contains the current users local settings, I want to get rid
of these completely on uninstallation.
After going through all of this all I need to know now is how to get the
Strong Name hash from an assembly and I should be able to delete the folder.
I have stopped the other 2 recovering now as it turns out all you need to do
is call the special directories ToString method to restore the folder.
Anyway, I have asked this in a different thread as it's a bit OT.
But just so you know, none of these folders are protected, all can be
deleted by the app (proved with hard coding), and they certainly wouldn't
ruin any other applications on the system.
Thanks for your time.
Nick.
"NickP" <a@a.comwrote in message
news:uR**************@TK2MSFTNGP05.phx.gbl...
Coder,
No, I believe you are wrong, have you actually tried popping the result
into a message box?
Try this, make a new application and write the following code into a
button event
MsgBox(My.Computer.FileSystem.SpecialDirectories.C urrentUserApplicationData.ToString)
To save you the time the result should be something along the lines
of...
C:\Documents and Settings\Nick\Application
Data\myCompany\WindowsApplication1\1.0.0.0
So *no* you will not kill any other apps, I would have appreciated that
you had actually looked before telling me that I am wrong.
Nick.
"Coder" <1@2.3wrote in message
news:O7****************@TK2MSFTNGP06.phx.gbl...
>Actually I think Chris is correct...... these:
My.Computer.FileSystem.SpecialDirectories.Current UserApplicationData
My.Computer.FileSystem.SpecialDirectories.AllUser sApplicationData
clearly refer to the Windows special folders and as such will fall under
the "protection" of WFP.
What makes you think these folders are created by your app? And that the
.Net Framework just happens to have functions specifically for your app?
Magic...
Anyway, if you go deleting those folders on people's machines you will
kill many other apps... for instance Outlook Express stores its settings
somewhere under SpecialDirectories.CurrentUserApplicationData.
I'd do a little research on the .Net methods you are using before you
continue as you are on the wrong track.
What cached settings are you trying to delete anyway? They are not likely
to be in those folders - more likely to be in a temp directory somewhere.
Perhaps you should exert more control over where your app is dumping it's
data?
A better lace to store app config data (other than the app.config file of
course) is in the folder your app runs from ie: Application.StartupPath.
Cheers
"NickP" <a@a.comwrote in message
news:uc**************@TK2MSFTNGP02.phx.gbl...
>>Hi there,
These aren't special windows folders, they are folders that are
created for that particular version of the applicaiton in order to store
the settings file. Unfortunately I found that the settings files were
being cached rather than just the xml document in the application folder
being used, this makes sense for current user priviledges I guess but...
I have just found a problem, if the application is signed it will be
stored in a folder something along the lines of...
C:\Documents and Settings\Bob Hoskins\Local Settings\Application
Data\myCompany\MyApplication.exe_StrongName_blad eblabvdfjnsdrwepfoobar\1.0.0.0\app.config
Unfortunately the property doesn't return the StrongName part on the
end. Surely that is a bug as it returning the wrong value to what the
application is actually using, instead it returns something like...
C:\Documents and Settings\Bob Hoskins\Local Settings\Application
Data\myCompany\MyApplication\1.0.0.0\app.confi g
Hmmm! All I want to do is delete these cached settings but I need to
be careful that I am deleting the correct directory, which is that my
code *should* technically be doing, as far as I can see anyway. So I
guess I need to work this directory out in a different way...
Or I guess I could delete the entire "MyApplication" folder...
Nick.
"Chris Dunaway" <du******@gmail.comwrote in message
news:11**********************@j44g2000cwa.google groups.com...
NickP wrote:
I am implementing a simple "/U" command line argument for a .NET
application that instructs the application to delete the following
folders...
>
>
My.Computer.FileSystem.SpecialDirectories.Curr entUserApplicationData
My.Computer.FileSystem.SpecialDirectories.AllUsers ApplicationData
>
The application deletes these folders successfully then exits.
Even
though the application does *not* use the Application Framework built
into
.NET (due to incompatability with McAfee) the folders are promptly
restored
and recovered once the application exits!
>
----------
>
Dim pDIoDirectory As New
DirectoryInfo(My.Computer.FileSystem.SpecialDi rectories.CurrentUserApplicationData.ToString())
If (pDIoDirectory.Exists) Then
Try
Call pDIoDirectory.Delete(True)
Catch ex As Exception
End Try
End If
pDIoDirectory = New
DirectoryInfo(My.Computer.FileSystem.SpecialDi rectories.AllUsersApplicationData.ToString())
If (pDIoDirectory.Exists) Then
Try
Call pDIoDirectory.Delete(True)
Catch ex As Exception
End Try
End If
Return (0)
>
----------
>
How would I stop the application from restoring this file? Many
thanks
in advance.
Are you sure it is your application that is restoring those folders?
Those appear to be Windows special folders you are trying to delete.
Perhaps Windows File Protection is what is restoring them.
Chris