Best way to creating setup of C# application - c#

Hi i am recently working on a c# window form application. I have done the all stuff and noe it's time to deploy the application, But i am unable to activate the visual studio installshield feature. Can any one here able to tell me any alternet way to create me a setup file of my application. Like Innosetup compiler or other.

Visual Studio Setup Project is easy to work with and is available for both VS2013 and VS2015 in the form of Visual Studio Extension (separately from the default VS installer). Download figures suggest that a whole lot of people are using this extension.

I prefer to use InnoSetup, which is free for any use including commercial.
You can have a UI to make creation simple, but if you want really complex functionality you can write code to create those functions. There is a thriving community of developers that use and contribute to the product, so finding examples is usually easy, but you do have to write your code in Delphi / Pascal.
On the other hand, all the Microsoft options are overly complicated and difficult to get working sensibly so I am pleased to avoid them. Corporate installers are good but incredibly expensive... so really there is no comparison. Ease of use, and free - what more could you ask for?
I should point out that I have absolutely no connection with the product other than that I have used it for many years for many products and have absolutely no complaints.

That depends on your needs.
Mostly you can just create an msi installer with an installer project type on VS.
The problem is that a lot of software distributors require an exe file type. For that you can use the free (limited ) edition of install shield : http://learn.flexerasoftware.com/content/IS-EVAL-InstallShield-Limited-Edition-Visual-Studio
It has everything that a standard installer needs and I use it to distribute my software.
I tried other free msi to exe programs but none of them worked well (this was a while a go and maybe things changed since then)

Related

Easiest way to Implement Scripting to WPF C# Visual Studio 2015

I'd like some help in how to add scripting support to a WPF C# project I'm doing on Visual Studio 2015. One of the things I'd like to do is to be able to change User Control properties within that script. I've being trying Roslyn C#, and I read some stuff about IronPython and PowerShell Tools. But, all that information is not really helping.
So, do you have a simple answer? Like, the easiest way to execute scripts in Visual Studio 2015 C# WPF Application, that are able to change properties of User Controls within the project?
Any help would be appreciated.
Thanks,
Lucas.
T4 templates can help but they are less extensible than lets say Roslyn.
I found a great post on how to easily implement IronPython and how to access User Controls within the scripts in Python, so you can there change different Control properties, and even create them! Here's the link:http://www.codeproject.com/Articles/602112/Scripting-NET-Applications-with-IronPython
I think it should be quite simple to embed powershell or F# interactive in an application and there are lots of examples when we search the web for this. The question is only are we comfortable writing scripts in Powershell and F#?
In my application I provide a C# editor and compile scripts as static methods (which I uses as functions) using the standard .Net compiler API's which are installed with the framework (Microsoft.Csharp, System.CodeDom). This generates a temporary dll and perhaps can not be properly termed a script. The implementation is straight forward and more or less what you expect - I have to provide a way for the users to specify references and namespaces, then generate a source file, compile it to an assembly and then call members of the static class. This above technique works well because the application has extension points that are well adapted to user defined code with a certain well defined structure (you might have similar well defined needs and perhaps full scripting is not necessary).
On the other hand, I am considering providing a "super user" console where the application can be driven by script, and in this case, I will use either Powershell or F-sharp interactive (I'm leaning towards F#). I don't think the implementation is particularly complex, but these are things that can easily bring the application down or corrupt application data if it is not well controlled - and it is unlikely that my users will profit from scripting as it is a programmer environment.

Build scripts for C# project - written in C#?

We've got a quite complex deployment scenario and want to make use of continuous deployment. Currently we've got a huge MSBuild script for everything, however, MSBuild is ok for building but not really suitable for deploying.
We'd love it if there would be some kind of C# project where we could write the deploy code directly with C#. Is there some C# scripting language which is suitable especially for deploying applications?
While it's not a C# project, you can use my company's product BuildMaster to handle deployments. It's designed to solve some of the problems you're already having, and some you probably don't realize you have (configuration file deployments, database schema updates, process automation, approvals, etc.)
However, if all you want is to write C# scripts for deployment, there's a tool called con-dep which looks like what you're describing.
Well, with Roslyn now I suppose that you can technically now use C# as a scripting language. I don't know if it would be terrible appropriate to do so...
Depending on your deployment solutions you might want to look into the NAntBuilder IDE. We used this for continuous ddeployment together with SVN server. If you have TFS why don't you just look into the details and many possibilities of Build Process templates?
You can use the .NET integrated C# compiler.
The advantage is that you can use the same DLLs/APIs in a C# 'script' as you do in your own software.
I use it in our production software. Our production engineers are able to write some small programs for special stuff.
See this answer for details.
You may want to look into using a tool that's specifically designed for handling deployments. If you're using Team Foundation Server, Team Build + InRelease provides a well-supported, well-documented way to handle your builds and deployments. Now that Microsoft owns InRelease, it'll be part of Team Foundation Server pretty soon.
If not, you can always write PowerShell scripts to handle your deployments. PowerShell isn't C#, but it's built on top of the .NET framework (so all the framework methods you're familiar with are still available), and the learning curve isn't very steep.

Make changes to c# program without loosing older code

I'm a hobbyist programmer and I've created an application for my office. Every so often I need to improve the code, add features or fix issues that come up under certain circumstances - I've found bugs or ineffective coding even after 3-4 months of heavy usage of the application. The thing is that whenever I modify the code, visual studio saves the changes. This means that if I want to use the program I'll have to be really fast in coding and debugging or it won't build - and I won't be able to use it...
Is there any way to keep the old version of the program without having to save the complete project folder elsewhere? Like creating a new version but keeping the option to go back to the old - working - one...
What you are looking for is called source control.
There are many systems out there, two popular ones are subversion and Git.
Used properly, you will have a full history of each file you have in your project.
There are two other answers here regarding source control at the time I write this, but there is another angle on this as well.
You're executing your production copy from the development directory. Don't do this.
When you have developed the program to a stable version, make a copy of it somewhere else and use that copy. In this way you're free to keep developing on the software without destroying your ability to keep using the existing stable version.
As for source control, you should definitely use that as well if you're not already doing it. It would, among other things, allow you to go back and hotfix the stable version with minor bugfixes while still doing major rewrites of the software, as well as the features others here have mentioned, full history of your project, "unlimited" undo, etc.
I'm not sure what you mean that Visual Studio saves the code when you modify it. It does by default save when you build, but I don't think it saves while you're typing.
Anyway, what you're looking for is called a source control system.
You can try Team Foundation Service from Microsoft.
It works fine and you can share youre project whit colleagues.
http://tfs.visualstudio.com/
EDIT:
This is a free of charge option you can use, until you want to share youre project with more than 4 persons!! than you have to pay for TFS
You need source control.
If your project is open source you can use codeplex, it's an open-source Website where engineers and computer scientists share projects and ideas. Its features include wiki pages, source control based on Mercurial, Team Foundation Server or Subversion (also powered by TFS), Git,discussion forums, issue tracking, project tagging, RSS support, statistics, and releases
If you don't want to share your code you can use Team Foundation Server

Coded installer

Is it ok to code your own c# application in order to create your installer (I mean code the installer, an not use InstallShield or Visual Studio setup project or anything else?
Yes, it's "okay" to do that, but I question the desire -
The problem with doing this is two fold:
You're doing a lot of work that an installation program can do for you, and probably do better, as they've been tested heavily. Why avoid a perfectly good tool that does a reasonable job in order to develop your own (likely poor) substitute?
If you code this in C#, you'll have a requirement that the .NET framework be installed prior to your installer being able to execute. Normally, a native bootstrapper makes sure the framework is installed before calling your installer.
If by ok you mean recommended then no, you should use ClickOnce instead, it is a lot easier/faster than coding you own solution.
In a sense, you're going to be reinventing the wheel, and the odds are good that, depending on the complexity of your install, you're going to get it wrong. Installers know how to call into the setup api correctly to register the application for uninstall. They know how to correctly install a windows service, create start menu items, set up shortcuts, etc, ....
I heartily recommend WiX, personally. It gives you all of the flexibility of an MSI-based install, with the flexibility and easy of an xml-based script.
It's very easy to write a batch script to xcopy an app into place and create some registry entries. It's not trivial to make sure that the installer rolls back the transaction if any part of the install fails. This is inherent to an MSI install, and is the preferred way to deliver an application.
If you don't want to learn WiX, and don't care about using an MSI (database-based, transactional) install, at least take a look at NSIS. It's incredibly easy to do a basic installer in only a couple lines of script, and it'll at least call the setup APIs correctly. Plus, you get a nice GUI. See http://nsis.sourceforge.net

Is there any definitive documentation on writing software installers?

I've read a bunch of documentation on installers and haven't come across anything good that explains the underlying concepts. Most of the installer software I've come across is based on the same "database" like structure that I just don't understand at all.
All of the documentation that comes with the various products - i.e. WiX, InstallAware, Wise, InstallShield etc expect that you understand these underlying concepts [which I just don't get] in order to follow what they're talking about.
Can anyone point me in the direction of documentation that explains the concepts of software installers so that the software documentation actually makes sense?
Update - since my original post, WiX: A Developers Guide to Windows Installer XML has been released and is also a good resource for beginners. (I didn't find it that great myself though.) I still suggest reading The Definitive Guide to Windows Installer as a starting point. Windows Installer and WiX isn't something you just pick up in a few days, it'll take a few months.
Go pick up a copy of The Definitive Guide to Windows Installer. I've lost count of how many times I've recommended it to people who are getting stuck on the concepts and are struggling to understand how Windows Installer works. Make sure you grab the Windows Installer SDK as well.
Getting to grasp with Windows Installer is the first stage of your learning, once that's sunk in you'll understand how InstallShield works (or doesn't work as the case may be..). Wise, InstallShield, etc try to shield you from the underlying concepts and have their own trickery/hacks to get around the limitations of Windows Installer.
Stage two (if you're serious about understanding Windows Installer) is learning WiX (The WiX Tutorial isn't too bad, although it's a bit out of date and targeted at WiX 2.0 rather than 3.0) and joining the wix-users mailing list. Don't join the users list until you've finished the book mentioned above, you'll be well in over your head. Questions from those who don't understand the Windows Installer concepts largely go ignored, however questions from people who have done their homework will find it a great resource.
What's not covered in the book is Vista, Robert Flamings blog entries on Understanding UAC and Vista (written when Vista was in it's beta stage) are the best information you'll find on the topic.
One thing that both the Windows Installer and WiX teams is really good at is keeping the documentation (Help files) up to date. Whenever I'm working on setups I'll generally have Wix.chm and Msi45.chm open on one monitor ;)
Along with the documentation, blogs from people on the WiX and Windows Installer teams are great for learning new tricks, etc. Far too many to list here, but once you know the terminology you'll find most of them popping up in google results.
If this all seems too much, then check out NSIS. Great for simple "I just need to copy files" type installations, not so great for enterprise deployments. If you're torn between the two then maybe go take a look at Rob Mensching's old blog when setup isn't just xcopy. Articles there are probably what convinced me that diving in and learning the underlying Windows Installer concepts would pay off in the long run. And it has :)
This (MSDN, About Windows Installer) is the best starting place for good 'General' information about installing on windows. All of the installers that are "msi-based" will relate to these concepts.
The only 'other' installer types (in the windows world) is NSIS which is really not for enterprise installations (I don't want to start a debate on procedural vs. non-procedural installers here).
Install stuff is REALLY complex with advanced concepts like advertising, restore points, patches and transforms and the like, but when you 'get it' you can do some pretty cool things, like the work-around to get TFS 2008 using SQL 2008.
TFS 2008 does not support SQL 2008, but TFS 2008 SP1 does, so what you have to do is "patch" the TFS 2008 RTM install with the TFS 2008 SP1 install with a command like this:
msiexec /a C:\TFS\RTM\AT\vs_setup.msi /p C:\TFS\SP1Extract\TFS90sp1-KB949786.msp TARGETDIR=C:\TFS\ATIntegrated
but the result is something that you can no hand out as "TFS 2008 with SP1".
You could try
Windows Installer resources (Starting page for the links below)
Windows Installer (Look at "Overview of Windows Installer")
Windows installer on MSDN (For SDK information)
Hope that helps ...
The best introduction to Windows Installers I've seen is Phil Wilson’s book Definitive Guide to Windows Installer. This was written in 2004 and does not have Vista or Win7-specific features.
The best site I have seen for Windows Installers is www.installsite.org. It has some introductory articles, but is targeted to experts.
I recommend the following feeds:
http://blog.deploymentengineering.com/feeds/posts/default
http://forum.installsite.net/newsfeed.php
http://msmvps.com/blogs/installsite/rss.aspx
http://robmensching.com/blog/Rss.aspx
http://support.acresso.com/rss/acresso_is.xml
If your install needs are not terribly complex, I would suggest trying out InnoSetup. I used it on a suite of windows applications installers a few years ago and had no complaints. Much simpler than InstallShield and MSI, but your mileage may vary.
I am not in any way affiliated with InnoSetup.
A good place to learn how installers work is by looking at the code.
Download or browse the source code for Inno Setup by Jordan Russell.
Download or browse the source code for the Nullsoft Scriptable Install System.

Categories

Resources