Visual Studio Setup Project to target Public Documents folder - c#

I'm using the extension Visual Visual Studio 2017 Installer Projects from Microsoft team to create an MSI Installer for a Visual Studio's desktop appliction. I've successfully created a SetUp Project and set all the necessary properties in the File System Editor of the SetUp project (Short Cut to dekstop, Program File's menu etc). The installer need to deploy an XML file to the Public Documents folder on the target computer. Question: how to target the Public Document Folder on the user's computer where the installer will install the app?
Background: This installer is built for an MS Office VSTO Add-In for WORD and it's deployment is done through Windows Installer (not through ClickOnce). And according to a licensing management system their XML Configuration file need to be deployed to the application directory that will not be our add-in's directory, but the directory of the application that loads the add-in. A recommended location for the XML file in this case would be a public folder such as the Public Documents folder on Vista and later versions of Windows.

I just clicked through the UI of VS2017 installer projects. I don't see a way to specify the public documents folder. You can add a user-defined folder (right click "file system" > add special folder > user defined folder) but it's limited to predefined properties of Windows Installer which doesn't include the public documents folder.
If you only need to install into a common folder but don't require it to be the public documents folder, you could use the CommonAppDataFolder as an alternative. Specify that for DefaultLocation of user-defined folder.
Otherwise you could possibly write a custom action that calls SHGetKnownFolderPath(FOLDERID_PublicDocuments,...) and assigns the result to a property. Then specify that property for DefaultLocation of user-defined folder. Here is a tutorial for writing a VB custom action for installer projects.
Though I strongly suggest to get rid of installer projects altogether and use the WiX toolset instead which provides much more flexibility. It comes with a nice Visual Studio extension too. WiX already defines the property WIX_DIR_COMMON_DOCUMENTS that is initialized to the path of public documents folder. Example.

Related

Using a Windows Forms Application out of Visual Studio

I am just wondering if there is a somewhat simple way to use a Windows Forms Application program outside of Visual Studios. If so could someone elaborate on it?
When you have compiled the files simply navigate to the
Debug/Release folder
and run the executable. Any dependencies can be configured to be output to that folder in
Project properties (Build Tab, Output path)
You can also set references to Copy local in the Property Window within Visual Studio, which ensures references are copied to Debug/Release folder depending on which configuration you have Visual studio in.
Or build an installer as Brian describes.
Yes. The steps to do this can be found here.
In a nutshell:
Add a new install project to your solution.
Add targets from all of the projects you want to be installed.
Configure pre-requisites and choose the location from where missing components must be installed (if applicable).
Configure your installer settings - company name, version...
Build the project and you are good-to-go.
Run the installer (setup.exe) or right-click the setup project in the solution explorer and select "Install", then run it from the install folder like any other app. (thank you, retailcoder)
It can be as simple or complex as you would like it to be.

How to create a single setup.exe using visual studio 2010?

When I am publishing my project, it creates a folder named "Application Files" and two files named "ProjectName.application" and "setup.exe". But I am not expecting this. When I publish my project/solution it will create a single setup.exe and no ohter folder and files will create there.
The app.application manifest file and setup.exe are the so-called smart client deployment model. AFAIK, you can provide a link to app.application on a webpage and .NET aware browsers are able to download necessary files from the manifest.
If you need a setup package that end users can click-and-install, you should use a setup creator like the one VS 2010 suggests - InstallShield Express.

Deployment issues regarding some resources

I am having a issue regarding my deployment of my software in Visual Studio 2012. First of all I am not able to install the "InstallShield Limited Edition" through VS12 so I am currently testing out Advanced Installer instead.
Mys issue comes due to the fact that in my program I am fetching a .pdf file and modifying it and later on showing them to the user. These PDF:s is in the programs resources folder but does not follow with the installer, so my application crashes since it cannot find this. The same is for my .chm file (help file)?
My customer is using XP and when I try to publish the software directly from VS12 it works on my computer, Windows 8, but not on his computer. The application won't even start for him.
So how can I deploy my pdfs to the installer file, or why is this not accomplished already?
It seems that the PDF and CHM files are not imported automatically in the project. What type of project have you created in VS?
To add those files in the setup use the "Edit in Advanced Installer" button from the Advanced Installer VS extension and go to Files and Folders page. There you should add the two files in the desired folder and save the project.

Creating an installation/setup file in Visual studio that requires a certain dll

I developed a program in Visual Studio 2010 Express edition. I want to create an installation/setup file for the program. The Express edition only allows me to create a “One Click Installer”. The program requires a dll file that must be in the same directory as the exe file of the program to work. However, I am unable to import the dll file as a reference as it generates an error. Therefore, the One Click installation file does not install the program correctly.
Is it possible to force the One click installer to copy that file to the installation directory during the installation process? If not, what other options do I have to create an installation/setup file for my project?
Thanks
It is called ClickOnce. Project + Add Existing Item and select that DLL. That adds it to your project. Select it and look in the Properties window. Build Action should be set to "Content", that makes ClickOnce publish it. Copy to Output Directory should be set to "Copy if newer", that ensures that the DLL is copied to your build output directory. What you did by hand previously.

My program has been "published", how can I change the installation path?

I "published" my C# solution in Visual Studio 2008 to C:\Deploy. When I run the setup.exe program, it installs my program to C:\Documents and Settings\Kevin\Start Menu\Programs\MyProgram
Is there any way, within Visual Studio, to set a custom install path? For instance, what if I wanted my program to install to C:\Program Files\MyProgram?
Publishing uses ClickOnce for deployment. ClickOnce has the advantage that it's easy to install and update, and doesn't require the user to have administrator privileges to install your application.
If you'd like a more traditional next-next-next-next-finish installer, which also allows the user to specify the target folder (and for you to set/force a default one), add a "Setup Project" to your solution by clicking File >> Add >> New Project..., in the tree select Other Project Types >> Setup and Deployment and double click Setup Project. When you build the setup project, it create an MSI file (Microsoft Installer setup file) and a bootstrapper EXE file (in case the user doesn't have Microsoft Installer or the required .NET Framework, which it then installs automatically).
ClickOnce ("published") applications are installed per user in the user application cache location. There is no way you can change this location ;-)
You have to use your own setup packaging tool in order to choose or let the user choose the location. Or you can just distribute your application as a zipped executable, if no installation routine has to be called, liked registering file types or adding keys to the registry.

Categories

Resources