Add installer to a c# application - c#

I made a search to find how am I adding an installer to my c# application. In every result I found that I need to add new file from Setup and Deployment templates, but I have no those templates. Even in online search I didn't find so.
what should I do?

The VS setup templates were removed post VS-2010.
Now, you have to use something else. "InstallShield" is still available, and Wix is a very popular install framework. You can, of course, just roll your own installer as well.
Alternatively, just use VS 2010 or earlier to create your setup/deployment projects.

I reckon you should do some research. There are many options out there depending on your type of application. Is it an executable that runs locally? Is it a Web application? Or a mobile application?
Microsoft provides lots of options/guides out of the box. Assuming you use Visual Studio 2013 check this MSDN article which is a good guide to start your research journey: https://msdn.microsoft.com/en-us/library/wtzawcsz.aspx

Related

I want to make installation of my Visual Studio 2017 project , how to achieve that?

I have database,images and text files in my project and i would like to make instalation..
Also I would like to put prerequirements so that people who install this must install version of .net framework i used in my project
What is the best way to achieve that?
UPDATE:
I wanted to use microsoft visual studio installer but it doesnt work .. it doenst create exe file and i cant open app
I've personally used NSIS for making installers. It has an extensible scripting bit to put whatever prerequisites you need(TOS, EULA, ect.) and it can easily create a professional looking installer.
Try using Inno Setup. It has a good scripting language along with a wizard if you don't want to script. It's also free (unless you are deploying commercial applications).

No WPF User Control Library Template found in VS 2013

I am using VS 2013 (Express Version) and I want to create a WPF user Control Library project. But I am not able to find the template in my installed templates list. If I use Winforms, I am able to build a DLL out of my Winforms Application Project just by changing the Output type as "Class Library". But it is not happening in WPF and it is throwing errors if I do so. Is this the correct method of doing it or am I going wrong?
And in the Create New Project dialogue window, I am not able to find the .NET Framework selector drop down. After creating the project only I am able to change the .NET framework version by going inside the properties of the project.
Kindly help me to get out of this. Thanks in advance.
I have been working on this exact same problem for hours this morning. Here is what I think I have learned:
With Visual Studio Express 2013, it is by design that the WPF User Control Library template is not available for making a New Project. This is because it is the free Express version.
With the Express version, you don't have a "devenv.exe" for trying the "devenv /installvstemplates" to "fix" things. It is, instead, called (just a moment while I look this up again...) "WDExpress.exe" and will be located (if you have default location) in the "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE" directory. BUT - this won't help you. It won't fix your problem, because, as I mentioned, your Express installation is designed to not have that template available for New Project, so your "fix" won't put it there. I know this because this is what I tried myself. (Also, note that the instructions for doing this tell you to uninstall any extensions you've installed before doing it. And then, of course, if you still want them you have to reinstall them. Like I still have to do, incidentally.) I'm letting you know all of this so you don't go through the headache I'm having.
Note that I have not done this yet, so this is somewhat hypothetical on my part, but is based on my research on the Internet so far - Your solution is to create a WPF User Control Library manually [but now see UPDATE below]. (No, I don't know how to do this yet. I got into this in the first place, because I'm a WPF novice - just started working with it a few days ago - and late last night I got this great idea to add a "spinner" progress indicator to my "WPF play/learning project" I'm working on, and found a couple of relatively easy-to-work-with samples on the Internet - both of them are a WPF User Control Library - and at first I wanted to use the copy-and-paste to put the code in. But then I discovered... well, our mutual problem, because I'm using Visual Studio Express 2013. No such template under New Project. And literally at the tail end of my about-to-throw-in-the-towel, I'm googling and your post, Dhivakar, is already showing up with the right Google search.) So I haven't finished my research yet, but my next step is to learn exactly how to create a WPF User Control Library manually (the code and various project property settings), and then I can just save a WPF User Control Library skeleton for future use and document the details.
UPDATE: This guy totally has the solution for Express versions. I have followed his steps and it works great. The only additional piece of information I would add is that in my version (VSE2013), after you've created your WPF User Control Library template, when you open Visual Studio again and use File -> New Project, my selection in the tree (for a Windows app) came up under Templates -> Visual C# -> Windows (which is what I've been using). I did not see my template showing up there, after I created it, and I thought, "Great! Another piece of advice that doesn't work." But then I clicked up one on the "Visual C#" parent - and there was the template!
Here you go:
How to add a WPF control library template to Visual C# Express 2008
https://dotupdate.wordpress.com/2007/12/05/how-to-add-a-wpf-control-library-template-to-visual-c-express-2008/
Yes, it works this way for VSE2013 too.
UPDATE 2: I'm not absolutely positive about this, but I think he missed one little piece. In his step #4 he says to delete Window1.xaml and App.xaml. Maybe this didn't apply with VSE 2008, but in VSE 2013 there is also the App.config file which I believe is extraneous for our purpose. So you can delete App.config as well. As I said, I'm not absolutely certain about this yet, but I noticed that file in the project when I added a WPF User Control Library project to my solution, and I deleted it, and the solution compiled okay.
Try running devenv with the /installvstemplates switch, from https://msdn.microsoft.com/en-us/library/vstudio/ms247116(v=vs.100).aspx
If this doesn't work, browse to C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ItemTemplatesCache\CSharp\WPF\1033\WPFUserControl (this could change dependent upon your installation directory), open the .vstemplate file in a text editor, and make sure the setting is set to true, then try running devenv with the switch again.
Hope it helps.

Create Solution/Project programmatically without Visual Studio

I would like to create a Visual Studio Solution and a C# Project programmatically, but without a instance of Visual Studio installed on the machine.
Scenario
I am trying to build a "engine" that will read some metadata in a SQL database and transform them into a UI. The database will be maintained by another people with a Web or WCF interface and I want the Server Application frequently (by schedule or pressing a button) use this informations to create autommaticaly a new version of the software (create solution -> project -> build -> create deployment).
So, I searched about programmatically create Solution and I found only the Automation Model in VS, it's about use an Add-In Project and this don't serves for my propose.
Perhaps I was a little confused in my explanation, so ask me more especific details, so I can be more accurate :)
Thanks for help
I think generating the solution is a little extreme.
The solution file structure hasn't changed much since 2005 http://msdn.microsoft.com/en-us/library/bb165951(v=VS.80).aspx, and there are a few projects trying to automate their generation, like Premake https://bitbucket.org/premake.
However, the kind of scenario you describe, might be I believe (better?) adressed with t4 templates http://msdn.microsoft.com/en-us/library/vstudio/bb126445.aspx, or only project file generation.
What you are describing is possible to do in C# Windows app but tedious and difficult. I remember seeing VB6.0 app like that but here i would suggest you look into WPF. Still it's C# programming but WPF can load dynamically a "window" from a string or a file if you want.

How to programmatically uninstall an application in Windows?

We are releasing a new version of our application and we would like it to be able to uninstall the previous installed version from the client's computer.
How would we be able to do that?
edit: I'm installing this application (and also the previous version) with a deployment project in Visual Studio, so I assume it is a Windows Installer.
Thanks a bunch!
Deployement Project in Visual Studio has a build-in feature to remove previous versions of your application.
Check the "RemovePreviousVersions" property in the Deployement Project Properties.
http://msdn.microsoft.com/library/y63fxdw6.aspx
Edit:
from MSDN:
The installer checks UpgradeCode and
ProductCode properties to determine
whether the earlier version should be
removed. The UpgradeCode must be the
same for both versions; the
ProductCode must be different.
If your using batch or another automated deployment tool for your releases, you can easily uninstall an MSI product using the following command line:
msiexec [/uninstall | /x] [Product.msi | ProductCode]
The Microsoft Installer (*.msi) format supports what you want do to, unfortunately Visual Studio only offers limited customisation and is designed to be used for basic projects.
There are a lot of resources out there on this topic and many other people asking similar questions. My best advice would be spent some time researching the MSDN documentation.
...
Update
OK. After spending 30 minutes reading a few articles, I think it may be possible using a custom action that you package with your new installer.
Follow this MSDN article on creating a Custom Action. It involves creating a new class library, adding an System.Configuration.Install.Installer class, adding it as an output to the setup project, and then selecting it as a custom action.
To view your custom actions tab, right-click on the setup project and select View > Custom Actions.
From here: you will need to write the code to remove the installation directory and AppData profile. This article on how to set Custom Action Data may be helpful.
Good luck.
HTH,
Dennis
If this you program then that's a simple reverse batch.
Or you could use some installer/uninstaller builder like NSIS

Simple installer for Visual C# Express 2008

I am looking for some general feedback here. I have a very simple application that I created in VC# Express 2008, with no special dependencies.
Now, I am going to release it as open source, and am curious as to how I should deploy it. Do I need to create an installer package with any dll's? Should I just zip up the *.exe file with a README?
Also, how should I go about handling the requirement for the .NET framework that a C# program needs?
You can use WiX. That will handle .Net framework dependency.
Updated: As an open source project you don't need to include setup application. It is extra (fancy staff).
The express versions only include the Publish option (Click Once). I would advice to read the EULA first, there are restrictions on distributing applications made with the Express versions.
Also see this SO question.

Categories