Visual Studio Installation Project - c#

When creating a set-up project in Visual Studio 2008, I am trying to create an MSI. I have a standalone installation project - that is, I don’t have a main project to install, I just want to ship some random files.
Configuration properties / build shows that it should create debug/myproj.msi. However, if I do a build of either the solution or the project, I only get an exe.
Do I need to compile this in a certain way to force it to create an MSI?

To build an installer package you must right click on the project and select "Build". Or modify the solution settings to include a build of the installer.
By default installers are NOT built on every build, this is for performance reasons.

Related

Create a standalone .exe file

I have a console application built in visual studio 2010.
When I actually build the project I am getting .exe file under \bin\Debug\MyProj.exe.
When I Paste and run this .exe from other location it is expecting other files too.
Any thoughts how can I make this as Stand alone exe file.
There should be other DLL's in the Debug library. You need those to run your exe.
If there are no DLL's there, make sure you set the 'Copy local' property of the required references to True, and build again.
If you want to make a standalone program, you should create a new Setup project in your solution. Include the Primary Output from your application project, and the setup should include the required DLL's automatically. Once you build the setup project, you can install your application as a standalone software.
You usually distribute application with bunch of DLLs, that's nothing bad.
But if you really want to make it a single exe, you can look here - same question is answered Embed .net dll in c# .exe . (Valid if your DLLs are also .Net assemblies)
Edit: If you need to easily distribute app to not-very-computer-friendly users, consider also trying ClickOnce. It's roughly something like Java Web start - only disadvantage is that you can't get "Windows Logo" certificate from Microsoft for projects distributed that way.
I don't have Visual Studio 2010 to experiment with, but in Visual Studio 2019 this worked:
Project Properties->Configuration Properties->Advanced->Use of MFC->Use MFC in a Static Library

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.

Automated Build script in VS 2008

I have built an installer using WiX that consists of multiple .exe files that are 'Release' builds of other .Net projects (VS 2008). Each time I update one of the projects, I build that project and copy the Release build into the installer and then build and release the installer.
I find it a very tedious job to constantly check if the exe's that the installer has are the latest version or not. Is there a way that I can automate this build process so that as soon as I build the installer, it will generate the latest release builds of the associated projects and place the .exe file in the installer project.
I am new to VS and WiX, please advise. Thanks in advance.
You should be able to create a Solution containing:
- all projects which build the EXEs
- the installer project which builds your installer
Once you are there, you should be able to right click on the Installer Project and set dependencies to all the projects which create your EXEs. You should be able to build your Solution with the right EXEs bundled in your Installer.
Arun's solution is great idea, and I recommend it.
We also have a lot of assemblies that we maintain, and rather than copying them around we use symbolic links to minimize the number of build-and-copy actions. You can research mklink (http://en.wikipedia.org/wiki/NTFS_symbolic_link) for details.
We use it like this, but we do this as part of our environment setup, and not part of our build script.
mklink /project1/bin/project1.dll /project2/bin/project1.dll
This ensures for us that project2's reference to project1 is always up-to-date, whenever project1 is build, without needing to copy the file. In our case, project2 and project1 are not part of the same solution, and they have no direct references to one another (we do a lot of plugin-type reflection/assembly loading).
Hope this helps.

Visual Studio Build Avoidance when building many C# projects

I have a solution with a lot of C# projects. The dependencies are not cyclic and when I build a high level DLL it appears to be rebuilding all the project referenced DLLs that it is linked to before running the program.
This seems to be unneccessary because I did not change the code in those DLLs and they are at a lower level so the changes I made in the top level DLL should in no way effect the low level DLLs.
How can I tell visual studio to only build DLLs that depend up the hierarchy chain not both ways.
Go to Tools->Customize
A dialog will open. Go to Commands tab. In menu barradio select Build | Project only. Assign a shortcut to it and use it.
When visual studio checks dependencies, it runs the build process. This is not necessarily building your project. In Visual Studio, if you navigate to Tools->Options...->Projects and Solutions->Build and Run you will see a drop downs labeled MSBuild project build output verbosity. If you change this to Detailed. When you build, you will see, in the output window, that it is verifying whether or not files have changed in order to determine if it should rebuild the project. This is why it appears to be building every time.
You should use the following setting:
"Only build startup projects and dependencies on Run" under Tools / Options / Projects and Solutions / Build and Run.

how to use VS Setup and Deployment project and build an .msi file to install the program?

i wanna deploy a C# Windows Application project using Setup and deployment project technique
but i don know what should i use
after i open File > New > Project > Setup and deployment > ....
then what ,, what should i do next
In the past I've used the Visual Studio Setup Project or Innosetup for my programs. I prefer to build .msi's over exe's so Visual Studio Setup Project has been my goto for a while now. It is however, very lacking in capabilities. The interface is not intuitive either in my opinion. Every time I build an installer there is a lot of trial and error install/uninstall to get it right. Other's have pointed out WIX and I've looked into it. It appears to be very flexible and since it is open source, we should be able to count on it for the long term.
Here is a recent article about WIX. What I found interesting is the article claims (see link in article) that Visual Studio Setup Project is being End Of Life'd in VS 2010 + NEXT_VERSION. This is a little disconcerting to me. Since I don't want to begin to rely on the new Install Shield "Lite" in VS, I'm going to put effort into learning WIX. I hope it'll pay off in more flexible builds for my applications as well.
All that said, when creating a VS Setup project, I usually use the wizard to put in the initial plumbing. You'll point it at the files you want in the .msi. Typically for me this means the "outputs" of one or more programs in my solution. Any managed assemblies referenced in the programs will automatically get picked up as dependencies and included. Unfortunately unmanaged assemblies don't and I usually have to add them manually using the "File System Editor" mode in the Setup Project UI. Adding shortcuts is a little hokey as well. You right click under the start menu and desktop section of the "File System Editor" mode and select create shortcut. This is all by memory so hopefully I'm getting this right. You will certainly have to test your installer multiple times before you get it just how you want. I like to test under a VM as well.
Finally, the VS Setup project produces a setup.exe and .msi file. Setup.exe is used for detecting and installing dependencies (such as .Net) before unpacking the actual DLL.
When u do this File > New > Project > Setup and deployment >
then right click Application folder> Add > File...and add your app's .exe file and also you can add shortcuts of your app in desktop and program's menu
I would recommend you to go for some tool for creating msi.
I am using WIX
What you need depends on... what you need.
For a large percentage of applications, all you need the installer to do is let the user choose an install location, copy files to a directory structure at that location, and create a few shortcuts. For that, a Visual Studio Installer -> Setup Project is fine. It can handle this basic functionality, as well as installing prerequisites like the .Net Framework redistributables, providing custom install options, and/or writing simple registry keys. The Setup Wizard creates a Setup Project as well, but runs you through a wizard to set up the basics. This is a good option if you've never created an installer before.
If you want this application to be controlled by a larger, more custom install, choose the CAB Project; it will simply pack the necessary files into an archive that is easily accessible from another setup project.
If you are publishing a class library, use a Merge Module. Merge Modules work within install programs themselves, providing files needed for the main application to work.
If you need serious customization, or you want to interface with existing InstallShield logic, I'd get a third-party installer. I've worked with InstallShield before, and it's pretty full-featured, but by the same token, the installers it creates are applications in their own right and can take days or weeks of logic programming to "tweak" to your satisfaction.

Categories

Resources