Trouble with ClickOnce - c#

When I publish a program for ftp server (for example ftp://site.com/www/myprog/) and indicates that the user will download from the address http://site.com/myprog/). At first all goes well: in the folder "myprog" lies files of my program and setup.exe. But when the user launch setup.exe there is a error, because it tries to load myprog.application from site.com NOT from site.com/myprog.

The problem is that you actually have to specify in the ClickOnce manifest where the file is located. ClickOnce doesn't assume that the deploy location is where the app should be pulled from. Try verifying the locations in the "Publish" tab of the project's properties screen. Is everything kosher?

Related

Unable to delete files in "Program Files\my app" folder : System.UnauthorizedAccessException :Access to the path '' is denied

I am trying to create an updater which will replace the files in the folder without needing an installer. As part of this process, I need to be able to delete old files and replace them by new files. I tried it and got an UnAuthorizedException. I am runing the updater as administrator. I tried the following
a. Setting the file and folder attribute to Normal
[Access to the path is denied when trying to delete a certain directory
b. Taking ownership of the folder and files contained in it
[Taking ownership of a file or folder
c. Changing the permissions and giving all users full control over the folder and files [Using a custom action in the installer]
[How to give Read/Write permissions to a Folder during installation using .NET
d. Running the updater from a windows service
There is no difference in the results. I keep getting the access denied error. What do I do so that the updater can delete the files?
It's not clear exactly what you mean by "running as administrator", but being logged in as administrator and running a program does not mean that the program is running with elevated privilege, which is what it really needs. But clearly the updater program is not running elevated.
So the issue might be that this updater program of yours needs an elevation manifest so that when you run it, it will ask for elevation with a UAC prompt.
Having said that, simply replacing files that were installed with a Windows installer MSI is not supported. The files must be replaced with a Windows Installer update such as a patch .msp file or an upgraded MSI file. Windows Installer keeps track of every file installed, and it's version and whether it's been updated or not, as well as a filehash. Replacing a file without using Windows Installer can result in unexpected demands for the original MSI file in order that Windows can restore the files to their original installed state. You might find that going to Programs&Features (or right-clicking the MSI file) and choosing repair will also restore them.

Executable automatically deleted upon exit

I'm using visual studio community 2013 on Windows 10 home for development of a c# AI application. The application works fine if it runs from the development folder, however, because I want to be able to keep the application running while modifying and compiling existing code, I copied the exe and DLLs (1 exe, 2 DLLs, debug build) to a different folder to be run from there.
When run from the copied folder, the exe (only the exe) is deleted when I close the application. Moreover, I cannot copy the exe back from the development folder because I get "Destination folder access denied". This happens only when I try to copy the exe (other files, including exes with different names, can be copied OK) and I have to reboot to be able to copy the exe back.
I'm not sure even where to start to debug this. Things I tried:
- Check the recycle bin to see if the deleted file is there: no
- Run process monitor to see if the exe name is running anywhere: no
- Exclude the copied folder from antivirus (AVG) scan/check: didn't help
- Make sure I'm running as administrator: yes
Have you checked the folder permissions on the destination directory? This sounds pretty much closer to a folder permission issue.
Since you haven't mentioned the Windows version in question, I am going to be generic on the approach. Try this:
Go to folder properties -> Security -> Advanced -> Owner -> Edit
Add ownership to your user account
Apply changes and retry copying files as see if it still prevails
** Also, in folder permissions, try giving full control to your user account

Deployed VS 2010 WPF Application Cannot Update Log Files Unless in Administrator Mode

I have a WPF Application that uses nLog to write out log files. On my machine it writes out the log file successfully.
I have created a deployment project, and generate an install, which installs it into program files . The install works successfully, but when the application is run, the log file generated by nLog is not created. No exception is thrown.
I am running Windows 7.
The log file is being created in the same directory as the executable.
If I run the deployed application in Administrator mode, the log file is created successfully.
How can I get past this? Would signing the executable help? Do I really need this to run in admin mode?
The problem is that you need to log to a different location. You should not write to C:\Program Files from your application. Instead, move your log files to something like %APPDATA%\Your Company\Your Application\Logs.
By using %APPDATA%, your application can run on different versions of Windows, and if they change the structure of the standard directories (like between XP and Vista), your application will log to the correct location still.
The Program Files directory is properly locked down. Change the application to write the log file to an unrestricted location. (I prefer the all users' application data directory.)
What others have said: the program files directory is locked down. You need to use another folder location to log towards.
I have had great success logging to the UserProfile special folder so that my logs wind up in this folder structure:
C:\Users\CurrentUser\My Docuements\Company Name\ApplicationName\
See this link for some useful information on special folderes: http://en.wikipedia.org/wiki/Special_Folders
%USERPROFILE%\Documents

Creating folders inside LocalLow through Installer

I am developing deployment project for Vista. In Vista inside AppData folder there are Local, LocalLow and Roaming folders. What I want from installer is to create folder 'Data' inside LocalLow folder and put there file data.xml (AppData\LocalLow\Data\data.xml). Installer should make this operation for all existing user accounts.
How can I achieve this?
This is a screenshot of setup project('Data' folder configuration) which is not working:
Attached example creates the following path: \AppData\Roaming\LocalLow\Data\data.xml
I think a much better approach is to store the xml file in the application's install directory, then, when the application starts up, copy the file to the appropriate directory.
The primary issue is this: what if a user that wasn't on the machine when it was installed launches the application?
Since your installer didn't copy the file to their directory (because it didn't exist), your application would either have to do something or fail anyway.

Setup Project msi builds+ claims successful install, but no output

As per the title, I create a msi installer and then run it and it claims to have successfully installed and if I look in the control panel to add/remove program it appears there. However, when I look in the directory I specified, there is no change made to it. Nothing is copied into it.
When I run the installer and click the button to create a new directory and choose that new directory to install into, I get no errors. It all runs fine, but after exiting the installer, this new directory is not created.
I follow these steps to create my msi installer:
Open Visual Studio and open the project I wish to create installer for
File-> Add -> New Project -> Setup Wizard
Select "Create a setup for Windows Application"
Select "Primary output from (project)"
Add additional file -> path to txt file
Finish setup wizard
Look at Application Folder for setup
Right click primary output from (project)
Click outputs and verify it is correct
Build the setup project
This outputs the .msi file along with the .exe file. There is no problems/errors running either of these. It just doesn't install/copy the files.
Ok, so it was a privileges issue when double clicking the .msi file.
It would run fine and claim to install successfully but it didn't create folders/copy stuff in etc. It needed admin privileges to install.
So, to give it the privileges I edited the .vdproj file that created the .msi file (edited in notepad). I went to the MsiBootstrapper section and changed "RequiresElevation" = "11:FALSE" to "RequiresElevation" = "11:TRUE".
More information can be found here: http://msdn.microsoft.com/en-us/library/2kt85ked.aspx
I'm still not completely happy with this, it requires double clicking the .exe file which gives the UAC prompt to get the .msi file to run with the required privileges. It seems very easy for a user to just double click the .msi file and believe things to have installed...

Categories

Resources