"Files were not removed" error

G

Guest

Other people have seen this problem but I have not heard of a solution

I wrote a costum Setup.dll that will remove all files from the application folder when the application is uninstalled
But when running the uninstall I get a
"Uninstall complete". These files were not removed because they are in use, read-only, or stored on a storage card that ....
And then it does not list any files, it only list the directory where the application is installed

The application ends up uninstalling fine, and the directory where the application is installed is removed properly

Why is this message displayed then
Any help would be greatly appreciated as this problem will probably not let us pass Certication
 
J

Jan Yeh [MVP]

Hello, fhunter

Where do you put Setup.dll?
You mean that your application folder would be successfully removed,
but there is such message appeared during uninstallation, is that right?

Does your Setup.dll remove the application folder at the end of
uninstallation, too?
You may try to wait for a few milliseconds, say 300, before Setup.dll
remove the application folder.
Just a guess, I'm not sure what is the problem...

--
Best Regards,
Jan Yeh

eMVP, MCAD, .NETcf Developer & Consultant
Mobile Mind Company @ Taiwan

fhunter said:
Other people have seen this problem but I have not heard of a solution.

I wrote a costum Setup.dll that will remove all files from the application
folder when the application is uninstalled.
But when running the uninstall I get a:
"Uninstall complete". These files were not removed because they are in
use, read-only, or stored on a storage card that ...."
And then it does not list any files, it only list the directory where the application is installed.

The application ends up uninstalling fine, and the directory where the
application is installed is removed properly.
 
G

Guest

Jan
Thank you for your reply it is very much appreciated
It's not a problem with the Remove Directory, as I have tried the same code with out the remove directory and I gets the same error.
In addition I do not undestand why the uninstaller does not remove the directory it self after everything is done
The Sleep has no effect no matter where I put it.

This is the code I am using

codeUNINSTALL_EXIT Uninstall_Exit(HWND hwndParent

HANDLE hr
WIN32_FIND_DATA fd

wcscpy(mString,directory);
wcscat(mString,L"\\*.*");
hr=FindFirstFile(mString,&fd)
if(hr != INVALID_HANDLE_VALUE

d

wcscpy(filaName,directory)
wcscat(filaName,L"\\" )
wcscat(filaName,fd.cFileName )
// MessageBox(hwndParent, filaName , szTITLE, MB_OK)
DeleteFile(filaName)
// MessageBox(hwndParent, L"Deleted" , szTITLE, MB_OK)

while( FindNextFile (hr, &fd) )

FindClose(hr);


Sleep(5000)
RemoveDirectory(directory)

return codeUNINSTALL_EXIT_DONE


----- Jan Yeh [MVP] wrote: ----

Hello, fhunte

Where do you put Setup.dll
You mean that your application folder would be successfully removed
but there is such message appeared during uninstallation, is that right

Does your Setup.dll remove the application folder at the end o
uninstallation, too
You may try to wait for a few milliseconds, say 300, before Setup.dl
remove the application folder
Just a guess, I'm not sure what is the problem..

--
Best Regards
Jan Ye

eMVP, MCAD, .NETcf Developer & Consultan
Mobile Mind Company @ Taiwa

fhunter said:
Other people have seen this problem but I have not heard of a solution
folder when the application is uninstalled
But when running the uninstall I get a
"Uninstall complete". These files were not removed because they are i
use, read-only, or stored on a storage card that ....
 
J

Jan Yeh [MVP]

Hi, fhunter

I thought that you are writting the code for .NET Compact Framework, instead
of eVC.

I see you've added MessageBox() in your code.
Did you find which file or which statement caused this warning message?
I guess that is from the DeleteFile() statement...

We need more clues to find out the answer...

--
Best Regards,
Jan Yeh

eMVP, MCAD, .NETcf Developer
Mobile Mind Company @ Taiwan

fhunter said:
Jan,
Thank you for your reply it is very much appreciated.
It's not a problem with the Remove Directory, as I have tried the same
code with out the remove directory and I gets the same error.
In addition I do not undestand why the uninstaller does not remove the
directory it self after everything is done.
The Sleep has no effect no matter where I put it.

This is the code I am using:

codeUNINSTALL_EXIT Uninstall_Exit(HWND hwndParent)
{
HANDLE hr;
WIN32_FIND_DATA fd;

wcscpy(mString,directory);
wcscat(mString,L"\\*.*");
hr=FindFirstFile(mString,&fd);
if(hr != INVALID_HANDLE_VALUE)
{
do
{
wcscpy(filaName,directory);
wcscat(filaName,L"\\" );
wcscat(filaName,fd.cFileName );
// MessageBox(hwndParent, filaName , szTITLE, MB_OK);
DeleteFile(filaName);
// MessageBox(hwndParent, L"Deleted" , szTITLE, MB_OK);
}
while( FindNextFile (hr, &fd) );

FindClose(hr);
}

Sleep(5000);
RemoveDirectory(directory);

return codeUNINSTALL_EXIT_DONE;
}

----- Jan Yeh [MVP] wrote: -----

Hello, fhunter

Where do you put Setup.dll?
You mean that your application folder would be successfully removed,
but there is such message appeared during uninstallation, is that right?

Does your Setup.dll remove the application folder at the end of
uninstallation, too?
You may try to wait for a few milliseconds, say 300, before Setup.dll
remove the application folder.
Just a guess, I'm not sure what is the problem...

--
Best Regards,
Jan Yeh

eMVP, MCAD, .NETcf Developer & Consultant
Mobile Mind Company @ Taiwan

"fhunter" <[email protected]> ¦b¶l¥ó
Other people have seen this problem but I have not heard of a solution.
application
folder when the application is uninstalled.
But when running the uninstall I get a:
"Uninstall complete". These files were not removed because they are
in
use, read-only, or stored on a storage card that ...."
And then it does not list any files, it only list the directory
where the
application is installed. the
application is installed is removed properly.
Any help would be greatly appreciated as this problem will probably
not
let us pass Certication !
 
G

Guest

Thanks Jan

Sorry for the confusion. That code is part of a Setup.dll
If I take the RemoveDirectory out, I still get the same error message. So I know that is not the problem. If I take out the DeleteFiles I do not get the error message
Please note that this code works fine all the way through. The error only appears after the method completes and, I assume, the whole uninstall process completes. In onther words is as if a handle is getting locked and the uninstaller is unable to complete things as it should. Even thought all the files and the Directory get removed

Thanks
 
J

Jan Yeh [MVP]

Hi, fhunter

Do you have any other process running during the uninstallation,
such as log or something else?

I am afraid that I can not help much on this...

You may try to give a list of filenames to DeleteFile(), instead of FOR
loop,
making sure which file or something you do NOT expect and it really
does the surprise for you.

--
Best Regards,
Jan Yeh

eMVP, MCAD, .NETcf Developer
Mobile Mind Company @ Taiwan

fhunter said:
Thanks Jan,

Sorry for the confusion. That code is part of a Setup.dll.
If I take the RemoveDirectory out, I still get the same error message. So
I know that is not the problem. If I take out the DeleteFiles I do not get
the error message.
Please note that this code works fine all the way through. The error only
appears after the method completes and, I assume, the whole uninstall
process completes. In onther words is as if a handle is getting locked and
the uninstaller is unable to complete things as it should. Even thought all
the files and the Directory get removed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top