Creating an installer for Visual Studio 2010 solutions (one or more projects) - windows

I ran into some troubles when creating an installer for my Visual Studio 2010 solution (which has multiple projects) so I thought I'd make a quick guide to how I got it working...

Here is how I did it:
Create a new Visual Studio Installer project which is located under
Installed Templates/Other Project Types/Setup and Deployment/Visual Studio Installer.
Make sure you add it to you current solution, you can do this by right clicking on the solution name in the solution explorer and clicking Add>New Project
From there select Setup Wizard, give it a name and click OK
A wizard will open, click Next
then select Create a setup for a Windows application
then click Next again. Select all of the groups you want to include, namely: Content Files, Source Files, Primary Output
Then click Finish
In the solution explorer you will see a bunch of buttons find the one that's tool tip says File System Editor and click it. You will see three folders in the file system editor, the only one we really care about is the Application Folder. That folder is where your projects build output should be.
To add files to it if they are not already there right click > Add > File...
Note: You cannot add entire folders (which sucks) and the folder structure in the Application Folder should be identical to that in your projects build.
You should create each folder and then add the files to it.
If you have multiple projects you should set the build directory to the same folder under the release build settings. To do this, open your solution, and for each project, right click/Properties go to the Compile tab, set it's configuration to Releaseand its Build output path to some folder (same for each project) (If you have an XNA project make sure its Content Build/Configuration is also set to Release).
Now select Release from the drop down menu on the tool bar (it most likely says Debug now)
Right click on your solution on the solution explorer and click Build Solution
Now all of your solutions built files will appear in the folder you chose in the compile tab. All of these files are what needs to be added to the Setup Projects Application Folder (in the same structure)
Customise the installer: click on the project name in the solution explorer and look through it's properties, change what you want (i.e Author, Manufacturer, Title - these make a difference to the installers output directory and text)
Build the installer project (same way as mentioned above) and you are done.
Feel free to comment with questions

Related

Visual Studio, Copy files to project directory problem

I have Visual Studio community 2017. coming from eclipse it was just enough to copy file to project directory and hit refresh then files were appearing in project explorer.
In VS, however when I copy some i.e. *.cpp or *.h in windows explorer to project directory, in VS solution explorer I can not see them. switching to folder view I see but can not include them into project.
via drag&drop to solution explorer (project view) I see them but are not part of project and in folder view and actual directory there is nothing.
what is going on with VS? How can I manually copy paste some files into project while they become part of project?
I will note that there's nothing "going on" with Visual Studio in the sense that something is actually wrong with it, it's just that adding files to your project just requires you to actually add them to your solution. Essentially, it allows you to add miscellaneous files to your folders without automatically including them in your build project (for example, if you're working with some test images/files).
To add files/folders to your project you simply right click on your project in the Solution Explorer and then go to Add > Existing Item.... Then, it's just a matter of selecting one (or Ctrl + A/Shift Clicking to select all/multiple files) and then it will add them to your solution.
In the solution explorer pane, click on the show all files button,
it will reveal all files including your pasted file,
Right click on your file and select "include in project".

Create Visual Studio Solution from Batch File

Visual Studio seems to consist of a single solution file (*.sln) along with one or more project files (a C# project would have the *.csproj extension).
I have been playing around with a console application that parses existing directory entries to create solution files with the associated project files.
It works, but every time I run into a new project here at work I find myself spending a week or more debugging my console project so that it can churn out a solution for that particular work project.
Is there something out there already that can create a VS solution out of an existing file structure?
As you can tell from my screen capture below, these projects are nested very deep, so it would take a very long time to do this with the apps folder below with the "by mouse" technique in the Visual Studio IDE.
I created the custom console application that is posted in this post:
https://stackoverflow.com/a/22153536/153923
I invite others to contribute how they approached this solution, though.
So, I found out today that this feature already exists in Visual Studio.
Link 1: How to: Create a Project from Existing Code Files
Link 2: How to: Create a Project from Existing Code Files
Basically, though, it says this (just in case the MSDN links get changed or deleted):
You can create a Visual Studio project from an existing app—for example, an app that you obtained from an online source. Project and solution files are created on your computer and the other relevant files are added. A project can be created from Visual C++, Visual Basic, or Visual C# code files.
Security note Security Note
We recommend that you determine the trustworthiness of existing code files before you import them into Visual Studio, because Visual Studio will execute some of the code in a fully trusted process when you open the newly created project.
To create a project from existing code files
On the menu bar, choose File, New, Project From Existing Code.
The Create New Project from Existing Code Files wizard opens.
Use the wizard to specify the details of the existing code files that will be added to the project and the application that will be created when you build the project.
Another good answer was given by cbp in Visual Studio: Create a web application from existing code:
--
OK I figured it out. It's weird, but the following steps will work:
Open fresh copy of Visual Studio
File->New Project, select Web Application
Use the following settings:
Name: Website (this is the name of the existing folder with the website files in it)
Location: C:\Temp\ (anywhere will do for now)
Solution Name: TheProject (name of the existing project's root folder)
Check "Create directory for solution"
Delete the auto-created Default, Global and Web.config files
Save All and close Visual Studio
In Windows Explorer, copy the new folder on top of the existing folder so that the files are merged.
Double click on the sln file to open Visual Studio again.
Select "Show all files" (at the top of Solution Explorer)
Right click on any files or folders you want to add and select Include in Project.
Great idea!

How do I add a folder, not a "filter", in Visual Studio 2013?

I have a Visual Studio 2013 project within a folder called 'Source', let's say. I'd like to have some additional folders within that folder and I'm trying to find a way to do that. If I, in visual studio, create a new 'filter' (which looks like a folder) and create a file within it. It might appear to be within a new folder (as displayed by Visual Studio), but it actually is in the default Source folder.
I try a second approach and create the folder with the help of the operating system. I even create a file within it manually. Then I go to visual studio and add an existing item, selecting the file WITHIN the folder. Visual studio then adds the file, which is good, but its displayed as being in the default directory.
I suppose there is a very manual way. And thats mirroring everything. Creating a folder using the operating system. Creating a filter within visual studio, etc. And mirroring everything manually.
Is there a different way or do I create a better IDE in 2 days?
Simple Drag and Drop should work.
Keep your directory with source inside your project directory.
Drag and Drop directory structure from windows explorer to visual studio existing project.
Click "Show All Files" option in the top of Solution Explorer toolbox
After doing this you need to add this directories in your project.
Select that directory, right click and select "Include in project"
You are good to go!
Details here

adding multiple existing folders and multiple existing files to Visual Studio project in single step

Does anyone have a way to add multiple folders and (existing) files within those folders to a Visual Studio project in a single step (or via macro)? Let's assume all of the folders and files were copied/pasted into the project folder where they need to reside relative to the project folder, but are not actually stored in the .csproj or .vbproj file, which I believe is a requirement to compile those files into the solution/project.
This works great if you have a web application project in your solution, but not so well if you have a .csproj or .vbproj. In that case, you must manually add folders (and nested folders), and add existing files and browse to each one individually, which can take a long time.
In the solution explorer, select the project, click the "Show All Files" button - .
This will show all the files, even those not part of the project. You can now select all of these in the solution explorer (using Ctrl + Click) then right click and go to "Include In Project".
In Visual Studio 2013 (and possibly earlier) you drag the folder from windows explorer and drop it on the project in the solution explorer.
Other answer given in this thread wouldn't work for me as the files I want to add (DTSX files) are in a different folder, and copying/moving them causes other problems. Here is what worked for me:
Using Visual Studio 2015, use Windows Explorer to locate the files you want to add to your project. Copy those files to the clipboard. If DTSX files are what you are dealing with, in the Solution Explorer right-click on SSIS Packages, and then click on Paste.

Creating msi in vs08 - few questions

I am creating an MSI from inside visual studio 2008.
This is what I am doing:
(With the project I am creating this for open in Visual Studio) right click Add new project
Setup and Deployment > Setup Project
Give it a name
Right click Application Folder > Add > Project Output: Primary Output
Question: does this contain all I need to run the project?
I want to create the .msi to put a shortcut to it on the Users desktop, so
Create shortcut to Primary output from Project
Move this to the users desktop folder
Question: how do I get this to keep the icon from the project!! conveniently doing this seems to have lost the app icon and picked some random generic one instead.
Thanks,
edit 0: Oh and also, can I set so when running the .msi the user cannot change where it is installed to?
Nobody knows how to do this?
It should unless you are referencing mixed mode assemblies in which case you may have to manually add files to the installer as the dependency resolution is very poor in this case.
You need to set the icon manually in the properties of the setup project.
To Remove the option to select the installation folder try opening the user interface view of the project and deleting the 'Installation Folder' screen.

Resources