Can't figure out how to allow user to set install path - vb.net

I am using Visual Studio 2010 and coding in VB.NET.
I have gone through the publish section in the program properties.
There is a Publish Location section and I have that set where I want,
but when you install the program, it never asks where you want to install it
and it installs in the the User AppData folder.
In the publish properties there is a section for Installation Folder URL.
But it only will allow a web url and not a file path.
Any help would be greatly appreciated.

You are confusing ClickOnce setups (that's the Publish) and MSI setups (which require you to create a setup project to buold an MSI file). ClickOnce doesn't sound like what you need if you want files in the UserAppDataFolder location.

Related

ClickOnce default installation path

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

WiX MSI: Bundle a Demo Project with Installer

I'm trying to bundle a demo project with the WiX MSI installer for an application. My goal is to create a "Projects" folder that contains the "Demo Project" folder in the user's Documents directory.
Since my installation scope is "perMachine" adding files to a user directory results in the following error for each file:
It must use a registry key under HKCU as its KeyPath, not a file
I could fix this error by adding the RegistryValue element to each Component but, the demo project has at least 1000 files.
I was thinking about creating another installer for the demo project that would have a "perUser" install scope and then bundle that into a WiX bootstrapper. The only downside is that it feels like a hack.
What is a recommended method when installing complementary material for a application? Should I build another installer or is there a WiX extension that would allow me to copy files to the user's documents directory?
Because it's a demo project and not critical to your app, one approach is to zip it up and have that single zip file as the component. The potential issue with demo projects in your component-per-file case is that users will start fiddling around with the demo in some way and eventually Windows Installer will be prompted to repair it. This is especially true if the project is something that clients open with a dev tool and start changing. You don't want the demo interaction with a repair to impact your running app.
There isn't a WiX or MSI way to copy files to user's folders because that's actually what the Registry keypath is for. It also has the advantage of working for user accounts that haven't been created yet. When another user logs on and uses the app Windows notices that the keypath is missing for that user and that prompts installation of the key path component (the file) from the original install source.

Visual Studio 2012 - Custom prerequisites are not appearing in the Properties > Prerequisites dialog box

I've created my first Office Add-in using Visual Studio. It targets the 4.0 .Net framework and was created using the new VS 2012. I need to distribute/install this project on various 32-bit XP and 64-bit Windows 7 computers around the office. So I configured the project to be installed on XP (which was my first speed bump because I didn't realize VS 2012 needed an update in order to make a solution that was XP compatible). Now that I have a valid win32 application, I am getting another error:
The following error occurred attempting to install 'C:\filepath...\Import Contacts.vsto':
"No application is associated with the specified file for this operation."
After doing some digging, I think I need to install the Microsoft Visual Studio Tools for Office Runtime on the client computer. To do this, I would like to use the prerequisites properties for the project. So I read up on creating custom prerequisites using some noteworthy sites (e.g, Creating Bootstrapper Packages, Application Deployment Prerequisites, Adding Custom Prerequisites, and Creating a Bootstrapper package for Office 2013 in Visual Studio 2012). I created the files according to that last URL (even though I'm not sure it pertains to the package I need just yet), but it is not appearing in the dialog box under Project > Properties > Publish > Prerequisites
If you read the article, it says the VS prerequisites dialog box should automatically update once I restart VS 2012, which I did but to no avail. I know I'll need to use this feature again in the future, so I would really like to know what I'm doing wrong and fix this. Please help! And I promise to quickly give the ACCEPT to whoever helps me fix this problem! Thank you in advance.
I didn't have any problems following the directions given in the web page and got the bootstrapper added to the Prerequisites dialog. However, there are plenty of possible ways to get it wrong. Some possibilities:
Triple-check the folder you added these files to. Be sure that you picked Program Files (x86) on a 64-bit version of Windows and not Program Files. And be sure that you now see the added VSTOR40 folder along with the other existing bootstrapper folders, like ReportViewer and VBPowerPacks.
You do not have write permission to this folder, UAC prevents copying files there. Be sure that you managed to copy them from, say, an elevated command prompt. Right-click the Command Prompt shortcut and click "Run as Administrator".
If you created the .xml files with Notepad then make sure you didn't accidentally saved them with the .txt extension. If necessary, put Explorer in "programmer mode" so you can see the filename extensions. Control Panel + Folder Options, View tab, untick the "Hide extensions for known file types" checkbox. If you now see product.xml.txt then rename the file to product.xml, same for package.xml.txt
If you created the .xml files with Notepad then be sure to save the file in UTF-8 encoding. File + Save As, Encoding combobox.
For all those who still may face similar issue I think that I found the cause of this issue. It seems that copying folder with custom bootstrapper package (and all necessary files in it) does not "refreshes" the list of available packages. Only when i went through this walkthrough and manually created folder in %Programfiles%\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\ for sample package from this walkthrough my package has shown

Shareware vb.net application packed using innosetup, installed in different directories creates 2 different set of application

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.

publishing app in vb.net and creating setup.exe

i am publishing an app in vb.net. it's creating setup.exe and a folder called application files. i am told that setup.exe is stand alone and does not need any other files. is this right? because when i put setup.exe in a different directory it says that some files are missing.
If you're using the "Setup and Installation Package" project from within visual studio, then that's not the case. The actual setup files are the .MSI file and setup.exe is just a placeholder for the Windows Installer application.
If you're using ClickOnce, then you need the entire published directory (especially the manifest, as that tells the ClickOnce protocol where everything is at.
That said, other installer creation systems work differently.