Application slow after installation - c#

I've created this WPF application and it's working fine and fast when running the release build from any folder.
Since it's done I made an installer (WiX) to install it into the program files folder. When I run my application from program files it's very slow and hangs all the time. Running as administrator makes it run normally again.
Why is this and how can I make it run normally without having to run as admin?
thanks.

I fixed this issue by enabling ClickOnce security settings in project properties and selected option This is a full trust application.

Related

Winform application not running after installing into program files directory

I had created a windows form application and used setup project to create installer. But after installing my application the application is not opening from the location it is installed("c:\Programs Files(86x)\"). But the application runs fine if i copy the entire installed files to another drive. Actually my application is creating some folder inside the installed directory when running. so i thought it is some problem related to windows permissions. I had set app privileges as "requireAdministrator" and still not working. Can anyone help me with a solution?
Actually my application is creating some folder inside the installed directory when running.
Don't do that!
The Program Files folder is read only to standard users, and has been since Windows 2000. And since Windows Vista even Administrator users will require elevation to get write access into this folder.
Use the All Users Application Data folder instead (Environment.SpecialFolder.CommonApplicationData).
The alternative is an advanced installer product (meaning purchasing the full version of InstallShield or similar rather than the version included with Visual Studio) which supports adding an action to your install process that both creates the folder and sets new permissions, and does this at install time. But that's really a cheat, anyway. Just use Application Data.

Machine needing to restart after binary update of desktop application

We have one Desktop application build with .NET3.5 in VS 2008. It is deployed on Network location which is accessible across the firm. Shortcut is created on user's machine to start the application. Desktop is being build (compiled) in AnyCPU configuration as Some user using XP machine and some are using Windows 7. Whenever new build (dlls and exe) deployed on network location, user have to close the app and restart it to work properly
Problem
We are facing a issue whenever we deploy new build (dlls and EXE) of the application. On Windows 7 machine application is not starting if we close the current running instance. User has to restart the machine itself to get it work.
Any help or suggestion is appreciated.
There is limited info to go on but the first thing I would make sure of, is the application still running under the Processes tab in the task Manager?
Go to the task manager on the computer and check the running processes tab to see if this app is still running.
It could be that it doesn't shut itself down properly after the user quits the application.
If the program is still running in the background then Windows will require a restart before the new dll's are loaded.

Published application cannot start, but release/debug version starts well

I have a problem when I try to Run published Application. When I Run Release or Debug Version from VS (key F5) everything work well. So I try to publish my application (no problem). After this I Installed application by oneClick installer. Instalation was finished without problem, but when I try to run this installed application, I only see message: Program has Stop Working.
Please, does anybody know where should be a problem? It´s really wierd, I suppose, when the application run correctly from VS, then it Should run after installing to!? Or am I wrong?
Or is there some option to reset Publish settings in Visual Studio?
Thanks a lot!!!
It depends how you have ClickOnce setup, but the main reason this happens is the ClickOnce system encounters an error while checking for updates or running the .application from the remote location.
It should give you the option to see a log of the problem (or at least the nasty temp file it threw it in).
From here you can determine the problem ClickOnce is having.
Most Common Problems I would Suspect:
The User's having trouble communicating thier auth token / credentials to the web server the ClickOnce app is on.
There's another web-related issue downloading the app manifest or .application from the server
Group / Local Policy Problems
Broken install in on local machine's ClickOnce somewhere causing it to have problems overwriting on disk or finding an appropriate location to setup the clickonce package.
Broken install in on local machine's ClickOnce causing a GUID Conflict (I.e. your app and the broken install can't be upgraded, but share the same GUID)
Antivirus / Firewall blocking access to the web component from the executable clickonce deploy.
These are all the problems I've encountered with ClickOnce and the reasons we've primarily moved away from it to a Wix style installer.

Deploying windows application in Visual studio 2010 Express

I have developed a windows application on C# in Visual Studio Express 2010. Now I want to deploy it.
I used publish to deploy but when I run the project it get error on the form where I have used some external files which I am using for I/O operation, read and write files.
How do I resolve this error? I am also using one folder for files.
I'm a big fan of using WiX for installers - even if you've got Visual Studio Pro with the built in MSI creation tools
http://wix.sourceforge.net/
the benefit of WiX is that you can do most anything, from the super simple to very complicated. The tool is great b/c you can get started quickly and then move up (adding dialogs, etc) as your app gets more popular.
One trick for installers - consider using VMWare/HyperV, install a test OS then take a snapshot of the OS before you install your app. IF everything works, great - you're done. However if something isnt right, roll the OS back to the pre-install snapshot, fix the bug, and try it again.
Add those external files to the project
Right Click the external files in your VS Set the Build Action as Content
Copy to Output directory to CopyAlways
Then try deploying
That may be due Windows 7 UAC permissions. Despite the fact that current books, msdn and even the snippets in Visual Studio teach methods of file IO, most are not correct when taking UAC into consideration.
All of your file operations should take place in UAC safe zones such as
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
You cannot read or write to files in the C:\Program Files (x86) directories unless you have elevated your app to run with higher privileges.
If you install your application and right click the executable and select Run As Administrator and everything works the problem is UAC.
If you haven't coded around UAC limitations I highly recommend reading up on it. It will save many headaches down the road.
http://www.codeproject.com/Articles/17968/Making-Your-Application-UAC-Aware

Creating a updater

VS 2008 SP1
I have created a application that I have installed on the user computer. However, I want the application to be self-updating. But I am not sure if this would really update the application.
The application will download all the files from the web server, and replace the files in the directory where the program as been installed to. The user will restart the application.
I am just want to be sure, because I can't replace the installed files with the updated ones. As the application will be running. So really the application cannot delete/replace itself.
So, I was thinking that I could download into another directory, if the program is installed in this directory 'program files/application/1.0.0' then I could download the files to 'program files/application/1.0.1'.
However, when the program restarts, how can it know that it has to execute from the 1.0.1 directory?
I can't use clickonce or the updater block for this.
Many thanks for any advice,
A good option is to make an independant Updater application.
The updater will download the newest version and kill/replace the old.
I think this is the best option, because you can execute the updater within the main appication (so you can say that it´s self-updating), or directly by the user with a shortcut.
The updater can check if the application is running and ask the user to exit the application or kill it by itself.
Forgive my english...
Good luck
All of that is already done for you if you use ClickOnce deployment (Project properties, Publish).
You can wrap the application with a small loader program which will do a version check. If it's out of date, download the newer binaries and overwrite the old ones. If you want to maintain all version you might end up with:
c:\program files\mycompany\myapp\loader (the newer version will point to the latest directory)
c:\program files\mycompany\myapp\v1.0
c:\program files\mycompany\myapp\v1.1
If it's on a LAN, you might be able afford the bandwidth of just re-downloading the binaries on start up instead.
Use Windows Installer for the installation and updating. If you sign your installation packages the user can update your application without needing any administrator privileges.
I've made a website and an application that demonstrates the functionality of what you want on my website.
Wix Clickthrough might meet your needs: http://wix.sourceforge.net/clickthrough.html
I would look into ClickOnce. It can be configured multiple ways, to check for updates before the application runs, to download from the server each time it's run, or check for updates after the application has started.
I have done ClickOnce Deployment and an independent updating application, they both work well. You obviously will have more flexibility over an updating application that you create yourself, however tho, ClickOnce can also be configured to install prerequisites such as the .NET Framework, Windows Installer, etc... for your application to run.

Categories