Is there a good tutorial on MSBuild scripts? [closed] - msbuild

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I'm working on a web application project, and I need to create a build script; a build script that I can trigger from my cruisecontrol server. Since nant has not been maintained for ages, I figure that MSBuild is the way to go.
I need the build script to be able to
Compile all assemblies
Execute unit tests
Run NCover analysis on the unit tests
Deploy the database (depending on parameters). This is really executing a tool since I will end up writing my own tool to deploy the database. But the execution of the tool should be conditional based on some command line parameter.
Deliver unit tests and coverage results in a format that cruisecontrol can read and understand.
I assume that MSBuild will allow me to do all these things. But I don't know where to start. Does anybody know of a good tutorial to get me started with my build script?

This was my first tutorial. Very easy to understand and follow:
https://codingcockerel.wordpress.com/2008/04/15/automating-the-build-with-msbuild/

Start here : http://brennan.offwhite.net/blog/2006/11/29/msbuild-basics-1of7/

I wasted a lot of time before buying the Hashimi MSBuild book, fantastic -- I concur with this review by Steven St Jean.
In addition to an excellent all-round introduction to MSBuild scripting, it has a cookbook section on doing typical build automation thigns like build numbers etc. Obviously the last TeamBuild section will not be directly relevant for you, but a lot of the topics are generic across all CI tools.
UPDATE: The 2nd ed keeps up the trend, adding a must-have section re WebDeploy

There is a "Getting Started with MSBuild" blog post on the the Visual Studio Blog which gives a good overview on how MSBuild is hooked up with Visual studio. It's fairly recent (25.02.2010) and uses Visual Studio 2010 and the accompanying MSBuild v4.0.
There is not much code there though.
It wasn't until reading this blog that I understood that the *.csproj files themselves are MSBuild files. And also, that the Build, Clean, Rebuild and Publish command in the project context menu actually are MSBuild "targets".

I wrote this a couple of years ago and try to keep it up to date with new MSBuild features:
http://thomasardal.com/msbuild-tutorial/

I found this MSBuild tutorial by Patrick Smacchia to be very informative (though I read it as a non-beginner)
Also Best Practices for Creating Reusable Builds, Part 1 from MSDN Magazine by Sayed Ibrahim Hashimi and part 2
(And I +1'd the Brennan tutorial)

Check this on MSDN How to: Write a Simple MSBuild Project .
Its good article and had helped me to start.
Here is the pdf of print version of the same .

I find this book pretty handy:
http://www.amazon.com/Deploying-NET-Applications-Learning-ClickOnce/dp/1590596528/

I'm looking for info on this subject myself too.
This is a nice article, Versioning Builds with TFS and MSBuild.
I posted a Stackoverflow answer here to a related question, where I also mention this great episode on DnrTV, Sayed Hashimi on MS Build.

Related

How to manage end user documentation for a project under continuous integration? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I have a project under continuous integration and would like to add end user documentation to the project. The end user documentation is a user manual, not API documentation. In our environment we use windows, c#, msbuild, cruisecontrol.net and subversion. We are currently using DocToHelp to create our help file, which is based on an msword document.
I'm looking for some guidance on how to manage the end user documentation. What documentation tools should I use? Should any of the documentation tools be part of the build script? Should the output files from the documentation tool be stored in subversion? What type of help files would be best to use?
We has been using XMLMind XML Editor to produce user documentation in the unified docbook format that can be stored in a version control system for the past 6 years. We use standard XSL transformations to generate user documentation from docbook in HTML and PDF format. Of course, this all is a part of the Continuous Integration and release build cycle.
Hope this helps.
I don't know DocToHelp but here is my take:
Even if it's the only thing you do: Start with adding your generated help file and all the files you used to create it in your version control system.
If generating the help file is not much more then processing a Word doc file then perhaps I wouldn't bother integrating it on the CI server. Your CI server's build artifact folder will just contain the help file as fetched from version control.
If there is a whole bunch of files (perhaps externally linked images in the doc?) and there is a chance of failure you could add it (if the help file building tool allows).
Basically what your CI server would prove then is if it can reproduce your help file from version control (did you commit and add everything?).
Taking it even further you could build automated tests which would examine the build help file and compare it with the referenced helpcontext IDs in the software itself. But here I am speculating (I haven't done helpfiles in ages :-)).
You might want to take a look at Doxygen:
http://www.doxygen.nl/
Doxygen is a documentation system for C++, C, Java, Objective-C, Python, IDL (Corba and Microsoft flavors), Fortran, VHDL, PHP, C#

What are the advantages of using MSBuild?

My manager is forcing me to use MSBuild for building my application.
I developed my application in ASP.NET MVC.
Here are some questions I have:
what are the advantages of MSBuild?
Is there any other build tool better than MSBuild?
What are the drawbacks on simple build of projects?
MSBuild is great. It is similar in concept to NAnt, but slightly different with some of its tasks or implementations.
Once you get used to it, you will be cranking out the build files. Take a look at a csproj file - it is a MSBuild file (note that the .sln solution file is very similar to an MSBuild file but it technically isn't a MSBuild file (yet))*. Building custom tasks for it is very simple, there are plenty of guides on teh interweb which walk you through how to do it.
If you are looking for alternatives, then i would go to NAnt. It is free, and has a huge amount of community support and extra tasks available. I haven't used it for a few years though, so i can't comment on its exact state at the moment.
There are no real drawbacks to using MSBuild, unless you count the amount of time it will take to get up to speed with it, and the amount of time you have to spend researching it.
From your questions it sounds like you don't really have much of a build process in place - take the time to do it, once you have you will wonder why you didn't do it sooner.
* Edited in response to comment from Sayed Ibrahim Hashimi
Advantages with MSBuild:
Available as it is installed as part of .NET
It shares the build system with Visual Studio
Drawback: Well, the XML syntax may not be intuitive.

Flex/Bison IDE? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I'm looking for a good development environment in which to work on flex or bison or both.
Are there any IDE's that have these capabilities and/or are suitable for this?
(If not the next most general question is are there lexer/parser generators with IDE's?)
Thanks
~Alex
Vim has excellent syntax highlighting support for flex / lex and bison / yacc files. Vim seems to guess from file extensions, so as long as my flex files end in .l or .lex and my bison files end in .y, it seems to work fine. I know, it's barely an IDE, but I find the syntax highlighting to be the most helpful feature for me.
ANTLR has several IDEs available, including one I wrote. By user count, ANTLRWorks is probably the most used. Mine has fewer overall features, but I use it extensively because it integrates so cleanly with my Visual Studio work. ANTLR's grammar syntax is clean and very powerful, generates code for many languages, and its generated lexers/parsers are clean, debuggable code.
Edit to address concerns in the comments:
Commercial documentation for ANTLR exists and is recommended by many, but is certainly not required. The nFringe IDE product (commercial/closed source) I worked on uses ANTLR extensively and was developed completely without the aid of the ANTLR reference book.
ANTLRWorks 1.x development is slow, but not stopped. There are currently no open issues, and two significant issues have been fixed since the latest 1.5 release.
ANTLRWorks 2 is a completely different product and was written from scratch. A separate issue tracker is available for this product.
Personally I use Gedit it has a native lex/flex yacc/bison highlighting
If you are comfortable in emacs, I would suggest these modes:
http://ftp.lip6.fr/pub/emacs/elisp-archive/incoming/bison-mode.el.gz
http://ftp.lip6.fr/pub/emacs/elisp-archive/incoming/flex-mode.el
Keep in mind that both are very buggy, but after a while I figured out most of the quirks to get the indentation working.
An example .emacs that loads these modes: http://www.elliotglaysher.org/emacs/
Just found GOLD Parsing System. It's not Flex/Bison, but if something similar is acceptable this seems to be a great IDE, and there's great getting-started documentation on the web site.
Visual studio has good support for flex/bison,
https://sourceforge.net/p/winflexbison/wiki/Visual%20Studio%20custom%20build%20rules/
To summarize, you'll need install win_flex_bison, the GNUWin port of flex and bison, and set visual studio's custom build rule using 'targets' file present along with the port, set exe path in VC++ directories settings; then it be built and debugged as usual cpp files.

Good resources for learning how to create MSI installers from WiX [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I've given up trying to apply lipstick to the pigs of installers that come out of Visual Studio and have decided to look at WiX.
What resources would you recommend to learn and reference?
(Note - this is not a which-installer-technology-do-you-use question - it's specific to WiX.)
The WiX tutorial is the #1 resource
The people on the mailing list are very helpful
There's a The Code Project article, Creating an installer using Wix v3.0, Votive, and Visual Studio 2005/2008 - Part 2, the GUI that might help
Ther's a bunch of blogs, I keep bumping into Rob Mensching's (old).
Rob Mensching's new blog.
I haven't read WiX - Windows Installer XML (broken link), but I found it in my bookmarks
This code project tutorial outlines the bare minimum and builds up from there
One of the best ways I found to learn WiX was to take an existing MSI that did something I wanted to do, and used the Dark decompiler to generate a WiX script from it, and then I read that.
Apart from the links provided by people above, also have a look at the approach I use to explain this to people :
From first glance From MSI to WiX seems fairly comprehensive.
Even though it's not only related towards WiX, the book from Apress:
The Definitive guide to
Windows Installer
By Phil Wilson
link
It helped me to understand the installation processes. It's a good book to have when writing installers.
I have to add wix-users#lists.wixtoolset.org. That's where everyone hangs out and asks/answers questions as they come up. Just lurking on that mailing list will provide lots of real-time education on the WiX toolset.
Here's a shameless plug to the book I've recently published through Packt:
WiX: A Developer's Guide to Windows Installer XML
It covers a lot of what you'd need to know to get going using WiX 3.0.
If you understand German, then read the articles in the Entwickler Magazin, edition: 2008-05, 2008-06 and 2009-01.
A follow-up will be published in 2009-02, with more developing stuff (MSI API).
You may use link as a reference https://www.firegiant.com/wix/tutorial/
It won't help a beginner as it didn't provide any practical examples.
For a beginner, if you have a pluralsight subscription, there is a course which will teach you the basics.
'WIX-Cookbook' https://www.packtpub.com/web-development/wix-cookbook by Nick-Ramirez (Covers Wix-3.8). This is the book if anyone looking to get the job done quickly.
If you want to gain in-depth knowledge on how and why everything works, you probably better of going through Wix-3.6 A Developers Guide by the same author.
https://www.packtpub.com/application-development/wix-developers-guide-windows-installer-xml
To create an installer for websites, refer following series by Bart De Meyer
http://blog.bartdemeyer.be/2013/10/create-an-installer-for-website-with-wix-part-1/
This article will show you how to use Wix tools like Candle and Light.
I've written a tutorial that shows you how to create a WIX installer for a console application here, if you wanted a practical example.
Chiming in with another shameless plug; I recently wrote an article where I somewhat desperately try to explain some of the concepts of WiX in a more easily-understood way than the others. No offence.
http://www.optimalbpm.se/wiki/index.php/WiX
It is meant to be read before reading any tutorials, because it specifically tries to address some of the things people always seem to misunderstand as a result of well, reading those tutorials. And especially the documentation. At least I did.
Also, there is another article, a little bit more advanced, that has an angle to those distributing script(like Python etc)-based systems, and why one in not only those, but all cases should use Paraffin rather than Heat.
http://www.optimalbpm.se/wiki/index.php/Wix_and_scripting_languages

What tools do you use for static code analysis? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
This question on Cyclomatic Complexity made me think more about static code analysis. Analyzing code complexity and consistency is occasionally useful, and I'd like to start doing it more. What tools do you recommend (per language) for such analysis? Wikipedia has a large list of tools, but which ones have people tried before?
Edit: As David points out, this is not a completely unasked question when it comes to C/UNIX based tools.
I have been setting up a Hudson continuous integration (CI) build system for my Objective-C iPhone projects (iOS apps), and have compiled a varied list of tools that can be used to analyze my projects during a build:
Clang static analyzer: free, up-to-date stand-alone tool that catches more issues than the version of Clang included with Xcode 4. Active project. -- visit http://clang-analyzer.llvm.org
Doxygen: free documentation generation tool that also generates class dependency diagrams. Active project -- visit http://www.doxygen.nl
HFCCA (header-free cyclomatic complexity analyzer): free Python script to calculate code complexity, but without header files and pre-processors. Supports output in XML format for Hudson/Jenkins builds. Active project. -- visit http://code.google.com/p/headerfile-free-cyclomatic-complexity-analyzer
CLOC (count lines of code): free tool to count files, lines of code, comments, and blank lines. Supports diffing, so you can see the differences between builds. Active project. -- visit http://cloc.sourceforge.net
SLOCcount (source lines of code count): a free tool to count lines of code and estimate the costs and time associated with a project. Does not appear to be active. -- visit http://sourceforge.net/projects/sloccount and http://www.dwheeler.com/sloccount
AnalysisTool: free code analysis tool that measures code complexity and also generates dependency diagrams. Not active. Does not seem to work with Xcode 4, but I would love to get it working. -- visit http://www.karppinen.fi/analysistool
For C and Objective-C, you can also use the LLVM/Clang Static Analyzer.
It's Open Source and under active development.
For .Net we use NDepend. It is a great tool and can be integrated to the build (we use CCNet).
http://www.ndepend.com/
HTH.
For C++, I use CppCheck. It seems to work fine.
I use the PMD plugin for Eclipse a lot. It's pretty nice, and very configurable. CheckStyle is also good, if you're looking for more of a style enforcer.
Checkstyle, Findbugs, and PMD all work pretty well in Java. I'm currently pretty happy with PMD running in NetBeans. It has a fairly simple GUI for managing what rules you want to run. It's also very easy to run the checker on one file, an entire package, or an entire project.
Obviously, the answer depends on the programming languages. UNO is good for C programs.
#Thomas Owens: I think you meant Splint.
Lint is the only one I have used at a previous position. It wasn't bad, most of the things it suggested were good catches, some didn't make much sense. As long you don't have a process in place to ensure that there are no lint errors or warnings, then it is useful to perhaps catch some otherwise hidden bugs
We use Coverity Prevent at Palm for C and C++ code analysis, and it's done a great job of uncovering some hidden bugs in our code. It also finds a lot of not likely to be hit problems, but it's easy to mark those as "will not fix" or "not a problem" in the code database that the tool generates. It is expensive, but the company occasionally does runs on open source projects and provides reports to the maintainers. They have a whitepaper about our use of the product on their site if you want to read more about our experience.
My admins are really cheap, so can I only use really cheap tools:
1) CCCC (C / C++ Code Counter): Various results related to number of lines (vs. lines of comments, cyclomatic complexity, Information flow, ...)
2) Semian: Fastest code duplication finder I ever tried.
3) LOC Metrix: Not very usefull but can help to make a point.
We use Programming Research's QAC for our C code. Works OK.
Recently we have been talking about checking out some of the more advanced and static/dynamic code analyzers like Coverity's Prevent or the analysis tool by GrammaTech.
They claim to not only do static analysis but also find runtime errors etc. One major selling point is supposed to be fewer false positives.
The only time I've ever used one of those tools is Split (C programming language). I thought it was helpful, but I was by no means a power user and I think I barely scratched the surface of what it could do.
I've used quite a few open-source and commercial static analysis tools across many languages and I find that the overall discussion fits under the umbrella of a concept known as technical debt (which this article goes into detail about).
However for a quick answer, here are my favorites per language:
Java: Google CodePro Analytix & Checkstyle
.NET: FxCop & StyleCop
C/C++: McCabe IQ