I have a vb.net Windows Form that is launched from the .application file - no installing done. I have an issue on some users' machines where they can't launch the application unless they go into their C:\Users\%userprofile%\local settings\apps\ folder and delete folder "2.0".
How can I prevent the application from using/creating that cache? All user settings are stored server-side and pulled down on open.
I've found AN answer, maybe not the best, but it works.
Turns out, ClickOnce is the problem. I haven't been able to figure out how to deploy without it, however it can be bypassed. Within the deployment folder, you've got an Application Files folder, and a [Project Name]_[version] folder. Within that is the .exe for your application, within the ClickOnce wrapper.
If your application, like mine, doesn't use non built-in controls, you don't actually need ClickOnce, as far as I can tell. So having users run that .exe, rather than the .application file within the deployment folder will prevent the "2.0" cache folder, as well as preventing the ClickOnce install and loading form - resulting in a faster open.
Hope that helps someone.
Related
I inherited a Windows Forms Application (.NET Framework 4) that uses ClickOnce for installation. Everything is working perfectly except I cannot seem to set the default installation path. Currently it gets installed to:
%appdata%\Local\Apps\2.0\xxx
where xxx is some randomly created path. This is causing problems with out virus scanner which is deactivating the program randomly. We cannot exclude the 2.0 directory from scanning as other programs that are not under our control also install to this folder.
I found this online:
https://social.msdn.microsoft.com/Forums/en-US/c6e3d328-1deb-49c9-99cf-98fe3830702a/where-does-clickonce-put-files?forum=winformssetup
where it states that I can set:
System.Deployment.Application.ApplicationDeployment.CurrentDeployment.DataDirectory
to set the data directory -> which might set the program directory as well?
I just cannot seem to find where I can set this path - Any ideas? I have never used ClickOnce before (and am new to Visual Studio) so please give me clear instructions.
Thanking you in advance
see comment:
The data directory is where data files, e.g. MDF and MDB files, get stored. You can't set the install location of a ClickOnce app. They get installed to the ClickOnce cache, which is what makes them ClickOnce apps. – jmcilhinney
I am using Visual Studio 2013. I have all components installed on my machine needed to run this application I am questioning. I have not completed the application to deploy for testing but some questions arose before completion that I need addressed now; to prevent overhauling later.
Here's how it should work when deployed to clients.
Client installs application which runs on desktop not windows store in WPF.
The application is per user and runs for all users on the local machine.
Each user needs to read and write data to a database file but it needs to be the same MDF being used. Therefore each process of the application, no matter the user session, on the same machine, all interact with the same database / same data.
Question: When adding the database to the project where will it be installed by default? In the applications program folder along with program? If so what restrictions exist to read/write to the database and are there any? I have added no extra security on my side. The info isn't private or critical.
Question: Would end users need to install any sort of SQL in order for the application to do this? If so I can package it with the install but this seems like alot of overhead during install.
If the MDF is installed per user how do I change this to install it once for all users?
Before saying so, yes this needs to be a database and not a file. Reasons I need not describe. I have considered alternative but this is by far the best solution so please no alternatives.
When you add mdf file to your project and set properly the value of Copy to Output Directory, it will be copied to the bin directory of your project whenever you build the project. When you create setup project for your app project, it will be by default copied to the folder where your app is installed. You can either specify different location in your setup project or copy the file to the desired location during the first run of your app.
There are several suitable folders in Windows, one possible choice is %PROGRAMDATA% C:\ProgramData folder, but it is by default read only for non-admin users. If you do not worry about security, go for %PUBLIC% C:\Users\Public. It is completely accessible for all users within interactive group.
I recommend to package LocalDB with your project. It can be installed silently with one line of code, though only with admin privileges. For non-admin click-once install you would have to use SQL CE, which is quite different and uses sdf files.
I think you should do it this way: include a seed database MDF file in the application and copy it to a %PUBLIC%\YourApp folder when the application first launches. Optionally include LocalDB install in your setup project.
I have created an shareware application using vb.net visual studio 2008 for windows desktop, and packaged it using innosetup 5.3.8. The problem is when i have installed the application in C:\Program Files\Application and it runs successfully(use trial period of the application), Im also able to install the application once again freshly with the same setup by installing in different directory.eg C:\Program Files\Application new . The application in C:\Program Files\Application new does not have any settings of the already installed one.
Where do i went wrong . Do i need to take care of this in my application(vb.net) or innosetup. How to take care of the already installed path in innosetup or carry the settings of already installed application to newly installed path by upgrading the older one.
I dont want to write any thing in registry because the application does not want any administrative permission requirements.If i install the application in same path it gets updated with the older settings being taken over to this new one and it works fine.
Windows applications normally save their settings in the registry under HKEY_CURRENT_USER\Software\YourCompany\YourApp or as files under %APPDATA%\YourCompany\YourApp. Both locations can be written to without admin privileges, and both locations are user-specific. That is, if two users use the same computer, both can use your application with their own settings without affecting the other user.
You should never save any settings under c:\Program Files. Writing to the Program Files folder requires admin privileges. If your application does not have a manifest then writing to Program Files may appear to work. What is really happening is that the files you're writing to the Program Files folder are rerouted to the VirtualStore. Unless the system administrator has disabled the VirtualStore. Then your application will fail.
If you want your application to be robust, it should only save settings to HKEY_CURRENT_USER\Software\YourCompany\YourApp and/or %APPDATA%\YourCompany\YourApp. Your application should use its default setting if no previously saved settings can be found in these locations.
when i publish an app in vb.net it creates some files:
application files directory, app.application, and setup.exe
i am going to be distributing this application to people who can barely use a computer, so i need to bundle everything in one, self-extractable package.
how can i do this?
I think your best choice would be to use Click Once Deployment. All your user have to do is to click on a link and the application gets installed. Moreover its easy for you to send updates too.
HTH
I would like to make my windows form app self updating when it starts. Where can I find good information for that?
I am using Visual Studio 2008 VB.NET.
I like the click once approach. With this application I have an access db as the backend datastore. When the application self updates how can I be sure the mdb file is not overwritten?
What is the best way to self upgrade the mdb if their is a change to the mdb file but not loose the data?
If you deploy using ClickOnce, you get this functionality for free. I do not have any experience with this (yet), but I can point you to an article.
I have been using Click Once for years with very little problems.
I've written a custom automatic updater and basically, the way it works is this:
The whole application is essentially 3 parts:
A launcher .exe that's essentially like a bootstrapper
The launcher .exe has an embedded .exe resource that is used if the launcher .exe itself needs to be updated
The application dll's
When you start the application, the launcher app starts and checks via webservices if the dll's are up to date. If they are not, it downloads them to a temporary directory and then makes sure the checksums are all correct and overwrites the existing app libraries with the new ones. It's then loading the application's core assembly and calls a "Run" method via reflection.
Now, in our app we sometimes have the need to update the launcher itself and the way we achieved this is by embedding an .exe in the launcher .exe resources. If the launcher detects that there is a new launcher .exe available, it downloads it to a temp directory, then extracts the .exe and launches it. This extracted .exe simply shuts down the launcher process, copies the new launcher .exe over the old one and then starts the launcher process again.