Okay, so I've been building a c# activeX control and have run into EVERY issue in the book during the process...That being said, I have everything squared up now except the installer
Before I can delve into the issue itself, I need to explain how my setup process is working and why I have chosen this route.
I have a signed CAB file that stores my setup exe, which is loaded through a web page using an object tag
The setup exe is an InstallShield LE project which has my project embedded inside of it (i.e. the files to be installed are a part of the final setup binary)
The CAB file has an INF file in it which tells the caller to run the setup exe to install the control
This process runs just fine and launches the setup application, which then does successfully install the control. However, near the end of the setup process users who are NOT administrators receive an error message stating the following:
An error occurred while copying file myINFFile.inf
Cannot copy file to destination directory.
Click Retry to retry the operation or click Cancel to
(yea, it just cuts off after the word 'to')
If you hit retry it does nothing but repeat the error over and over until you hit cancel. If you hit cancel it says something to the effect of 'Would you like setup to continue in spit of this error?', which then goes on to successfully install the control.
As this error only happens to users with limited permissions I believe the issue is that the cab extraction process cannot extract the inf file to the location it's trying to extract it to...it's just very annoying because this file serves no other purpose, especially during the installation process, but I cannot figure out why the issue is happening or how to work around it...
Use process explorer (by Microsoft/SysInternals) to see what files are written.
My guess is that you did not author setup properly to allow per-user install of you ActiveX control.
(by Robert Petz) If you add the following hook to the INF file it runs correctly and extracts the cab to a allowed location:
[Deployment]
InstallScope=user
Related
I have a C# winforms application which will not work once installed to the C:/ProgramFiles folder. I use an MSI created with Wix to install. When either double clicking the exe or right clicking and running as admin this window pops up and then nothing happens:
Application Error Message:
The application works in Visual Studio and when accessed via the bin/Debug folder of my VS project (the exe in the Debug folder is the one I am using for the Wix install).
After the MSI installs, if I copy the exe out of
C:/ProgramFiles to one of my user folders (ex: C:/Users/User/Desktop) the exe works.
I am guessing this is some sort of UAC/permissions issue but I cannot find any documentation to confirm that theory. Any direction would be much appreciated.
EDIT:
Looking at the error log it is denying me access to my config file. Here is the error text:
Access to the path 'C:\Users\*username*\AppData\Roaming\Leer Copy\leerConfig.xml' is denied.
EDIT II:
This problem is getting more confusing (and frustrating). It will allow me to write to the AppData folder but not read from it (shouldn't it technically behave the other way around?)... Would really appreciate some help. I am reading the contents of my XML file via XDocument.
Originally had hid the config file so people do not mess with it/accidentally delete it. Making the file not hidden fixed the access denial and everything works how it should now.
I have deployed my application to be ready for use by another user (another computer), but when I try to add the data to the database I get the error
Operation must use an updatable query
The error is like this (This is when I already deployed my program and run under application, not under Visual Studio):
But it works perfectly under visual studio, the image like this (note that, the error on the image above appear once I click the submit button, it supposed to stored in the database, and display it on the datagridview as like image below):
And also I got another problem, the delete function is not running, the error on the add and delete appear once I deployed my program, but I will post that on another thread.
How do I solve this?
When a Visual Studio application is under development it resides in a folder to which the developer has read/write access. This is obviously necessary since the developer needs to be able to edit the source code files. If you place a database file "in with the code" then the application can update the database file because it is in a "writable" location.
However, if on deployment the database file stays "with the code" and the installer puts the files (i.e., the executable file and the database file) into %ProgramFiles% on the target machine (for example, C:\Program Files\MyApplication) then the average user will not have write access to that location. Files in %ProgramFiles% are normally restricted to read-only to protect the system from malware.
Some people will try and configure the installer to grant write access to normal users for some file(s) or folder(s) under %ProgramFiles% but that is a Bad Idea™. The installer should really copy the database file to a location that is normally read/write for the intended user(s): either %USERPROFILE% (for a specific user), or %PUBLIC% (for all users).
I have an msi. In it I have several config files (a.config, etc) and exes (jux.exe, etc).
In my msi I created a custom actions - commit for one of the exe (jux.exe). I make the installerclass false.
The idea is for the msi to call jux.exe right after install.
jux can start ok until it tries to validate the existence of some of the files (jex.exe, jax.exe etc.) and reading files inside the msi (a.config, b.config etc). seems like jux.exe cant find the files.
Should I not use commit? ideas?
It's most likely failing because you are making assumptions about the locations of the files, and they are incorrect. Your exe is being run from an msiexec.exe with the system account and an unknown working directory. It is not being run from an interactive user shell with explorer setting the working directory and running it with your credentials. If your code just tries to open a.config without specifying the full exact path then it won't find it.
All VS custom actions run after everything is installed, so you got lucky there. You don't need a Commit custom action - an install custom action will work too. That will also be called after all the files are installed. It's not clear why you want to validate the existence of the files - there's no point. An MSI install either works and installs everything or fails, rolls back and restores the system to its previous state. So there's no point in checking that it installed files.
There's no good way around this problem using this project type. It simply fails to expose full control over when to schedule your custom action and boils it down to overly simplistic choices. If I was you I'd factor this custom action out into a WiX merge module and then merge that into your VDPROJ installer (or go full WiX).
I got a error:
Error 1 Cannot copy assembly 'ICSharpCode.SharpZipLib.dll' to file 'FileLocation\bin\ICSharpCode.SharpZipLib.dll'.
Unable to add 'FileLocation\bin\ICSharpCode.SharpZipLib.dll' to the Web site.
Unable to add file 'bin\ICSharpCode.SharpZipLib.dll'.
The process cannot access the file because it is being used by another process.
Any idea about this?
This is an error you can get when you have a file that's still locked by a process; it sounds like the file was still open by something when you went to build,so it couldn't copy it to the website.
As long as you aren't directly modifying the ICSharpCode.SharpZipLib source code, and since it's reporting it to already be in the location you need, it's possible that the development or IIS server just still had the file open, in which case it wouldn't be a big deal. (Did you close all browsers?) If that's the case, and your application is running fine, then it's probably not a huge deal, although I would probably close down the development server, and Visual Studio, then reopen and try again. (If running on IIS, try restarting the website.)
If you start having issues with whatever part of your code uses the Zip functionality, then you will need to investigate further.
Sounds like your app was recompiling and tried to copy the zip lib, which was already in use because of a bad ref in visual studio or a running program. When does this occur? Please provide more details. Close out visual studio (if its running). If its a web app, restart IIS and try doing whatever unknown action you were doing again.
Application tried to copied ICSharpCode.SharpZipLib.dll file from GAC or Visual Studio Assembly folder into your application's bin folder but it can't copied and application runs successfully on your system because your application put this dll file from GAC. But whenever you will run this application any another system on which Visual Studio not installed, on that machine it couldn't runs properly....
I have created a windows application setup program, it needs to have a text file in the application folder. The file is also included while creating the setup.
Once the setup successfully completes and my program tries to modify the file based on user input, its simple throwing an exception.
I am using Windows 7 Home Premium OS.
Any suggestion/help will be great to overcome this issue.
This is normal on a Vista or Win7 machine. Or a properly secured XP machine for that matter. The normal install location for programs, like c:\program files\your company\your app, is read only for most users. UAC is a counter-measure to malware messing with programs.
You'll need to store the text file into a writable location, the AppData folder. In the Setup project, right-click "File system on target machine" and select User's Application Data Folder. Find that file back at runtime through Environment.GetFolderPath, passing Environment.SpecialFolder.ApplicationData. Or use "User's Personal Data Folder" if the user should be able to find it back easily through the Documents folder.
What exception is being thrown? It could be a UAC issue.