Automate publish of ClickOnce using Visual Studio 2008 - msbuild

I have a Visual Studio solution file (.sln), with several projects (VB.NET and C#, .vbproj, and .csproj files, respectively), and I have a Windows application, and I use ClickOnce to publish it.
Now, I need automate the Publish option using MSBuild or another good solution (cmd, VBScript, or BAT scripts).
How can I do it?

Well, ClickOnce uses MSBuild to publish itself. Therefore I would recomment to use MSBuild for your build-automation. See the reference on MSDN.
The first step is easy. You just run MSBUild with 'Publish'-target from the console. The settings made in Visual Studio are applied.
However, there are some tricky bits. For example, when you run it from the command line, the version number isn't increased. In my project I've solved this by passing the version-number from the build script.
Another tricky-part is when you want to run the build script on your build-server without Visual Studio installed. There you might have to copy some to make it work.

Related

Visual studio create installer

I am creating an installation file using VS2019 which creates two files setup.exe and install.msi. Is it possible to bundle them together for easier distribution into one setup file. Previously I used iexpress to bundle them together and using custom.bat file to execute setup after extracting. Though this is an very old technique, Is their any more innovative way we can use directly from VS2019 ?
I found this guide which makes use of Advanced Installer through a Visual Studio extension. I was able to take two projects in a solution and package them into one .msi, which installs both of the project executables when ran.
You will need to download the "Advanced Installer" Visual Studio extension (see the "Extensions" menu item in Visual Studio), as well as install Advanced Installer itself, which can be found here (the extension will prompt you to download Advanced Installer if you attempt to use it without having it installed). All the extension does is make use of the Advanced Installer software, but through Visual Studio. Once you have it all configured, all you need to do is perform a build on the Advanced Installer project that you will need to add to your solution.

Making a Stand-Alone EXE File

I'm currently using Visual Studio 2010 to make a Visual Basic project. I'm trying to make a standard .EXE file for distribution but everytime I go to publish, I keep seeing it make a Click Once application.
Is there a way to complete and build a project in VStudio 2010 without making it as a Click-Once application?
Don't Publish it; that is what is making it a clickonce application. Just Build Solution; this will create the exe in the specified output directory (usually debug or release depending on your current Configuration.

How to use MSBUild 2010 to write scripts

I am working on MSBuild 2010 and TFS 2010. Heard that one can also use MSBuild apart from using Windows Workflow. My question is how? How do i create a MSBuild project and see the .proj file just like i used to in TFS 2008/ MSBuild 2008
If you have builds that you've created in TFS 2008 that you want to use now, create a build definition that uses the UpgradeTemplate.xaml. This template was created for porting over earlier TFS builds and lets you specify the TfsBuild.proj file that was used in TFS 2008.
Other than that, if you are just looking to use MSBuild scripts instead of the workflow in your build process, you can do that as well (though it is more difficult now.) In VS 2010, you can specify what you want to build when creating a build definition - it defaults to solutions in source control but it can be any msbuild script. Just select an msbuild script that you've created and go from there. For this route, I would recommend the DefaultTemplate.xaml, which you will definitely need to modify along the way.

Problems with WiX and Visual Studio web deployment project

We want to create an .MSI package from a web deployment project in Visual Studio 2008.
Now we want to use continuous integration and we would need the .MSI package build in the nightly builds.
Till now we used standard Visual Studio Web Setup project, but this is not compatible with the MSBuild. So we decided to use WiX.
The problem is that I have not found any good tutorial/documentation about this.
Is there a way to do a WiX installer package from a web deployment project? If yes, how?
Also, I tried to use heat.exe to create the XML for the WiX project .wxs file, but it seems that heat.exe doesn't recognize the web deployment project format.
Thank you for your responses.
Regards,
V.
I wrote a blog post about this recently - http://www.chrissurfleet.co.uk/post/2011/07/01/Using-Packaged-Project-Output-in-WiX-and-Visual-Studio.aspx
In short, its fairly easy to use msbuild to package up your web app and then pass it to heat to generate your installer from.
Hope this helps.
You've probably long since found a solution for this, but to elaborate on Tom Cabanski's answer, you can invoke Visual Studio to build the msi on the command line using "devenv.com" via an external process from within your build. It's not a pretty as using msbuild, but it gets the job done. Below is an example of how to invoke Visual Studio:
"C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.com" your.sln /build Release
Where your.sln is the solution file for the solution you wish to build, and Release is the configuration you wish to build, ensuring that the configuration you choose actually builds the vdproj project.
Following the successful execution, you can grab the msi from the appropriate configuration's bin, and do what you want with it.
I'd appreciate your response to this with your findings/approach, as I'm trying to decide whether to adopt WiX or InstallShield as the approach to building msi's for Web Applications within TFS Build, or to continue with the approach I just described. I haven't had to opportunity to try WiX out, and my very limited exposure to InstallShield suggests that this is far to involved for my need, which is to produce a simple deployment aid for some relatively straight-forward web applications to the company intranet via TFS Build.
We used WIX on the installers for our last couple of projects and ended up regretting it. I would stick with the VS built-in projects and just invoke the VS IDE from the command line in the CI build.

Building VS2008 solution using MSBuild 2010?

Is it possible to build a VS2008 solution (C# and VC++ projects) using the automated MSBuild built into TFS2010? When I niavely just run it, the build fails because the 2008 Solution file needs to be upgraded (and presumably so would the project files). Can I tell MSBuild 2010 to just build the 2008 files?
Does this blog post happen to work out for you? There are several ways you can get it working but just depends on your particular setup.
http://blogs.msdn.com/madhurig/archive/2009/11/25/building-vs2008-projects-with-tfs-build-2010.aspx