Build Sandcastle Documentation When Building Visual Studio Project - c#

I am using the Sandcastle Help File Builder to output my C# XML-DOC file to the Website format. How can I accomplish the samething from the command line so that I can add this as a build event in Visual Studio when building the actual project?
The end goal is to have the website Help File content built when I build the Visual Studio project.

As Scott Wylie indicated, you need to specify this in the post build event command line in Visual Studio's project properties. However, I would suggest using Sandcastle Help File Builder (SHFB) rather than Sandcastle directly. It makes the command line call short and simple as shown below, but note that first you have to configure the SHFB project with the SHFB GUI, which creates an msbuild-compatible build file with the ".shfbproj" suffix:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
/p:Configuration=Release myProject.shfbproj
However, note that I take the opposite approach from what you are doing: instead of using Visual Studio to interactively launch a build and ancillary actions, I use ant (nant) to launch a build of everything, which includes my Visual Studio solutions and subsequent SHFB action. So this is really the command-line call I make to build the documentation with Sandcastle:
<exec executable="${msbuild}" dir="${csharpdoc}" output="${csharpdoc.log}">
<arg value="/p:Configuration=Release"/>
<arg value="myProject.shfbproj"/>
</exec>
My preference is that the entire build should be launchable from the command line so there are no interactions required (e.g. launching Visual Studio, etc.). That provides the flexibility to run either as a scheduled recurring task or on-demand from the shell.

You could call SandCastle from the post build event command line, in the Build Events section of your project properties. This should work nicely if you are not using any automated build tool.

If you're using MSBuild for your build tool this is the tutorial I used awhile back.
There is also a script on codeplex that you can look into using that might help you out.
Hope this helps!

I found it easiest to just add the *.shfbproj project to the solution. It builds fine (although a bit slowly) inside of VS 2010.

Related

Really struggling to get how WiX works

I am working on a WPF project. I have created a Wix project which runs along with the main project and has a program.cs component as well as the XML file.
Although I can see it creates the installer upon re-building the project, what is not clear to me is that why don't I have the actual WPF project inside it or as part of it. So really I don't install anything when I run it. Simply a shell program.cs file which is part of the Wix project.
I don't get the actual project at all. So how do I effectively "add" the WPF project to the WiX project so it generates the .exe or .msi file.
When I used the Windows native build project, I was able to get this however it is really tedious.
Thanks,
Ibrahim
Most of understanding how WiX works is understanding how Windows Installer works. WiX is mainly a language and compiler to author and build Windows Installer (.MSI) database files. It does have some additional extensions and the ability to create a bootstrappper / chainer (.EXE) and that is additional tech to understand.
MSI and therefore WiX should be thought of in terms of declarative programming rather then imperative. You describe the product, the UI experience, the feature/component/resources relationships or the "what" needs to be installed and MSI handles the "how" to install it.
WiX newbie here too. I found that this tutorial to be helpful to get started: Create a simple setup. It walks you through creating a new WiX project in the Visual Studio. It creates a really simple installer (e.g. doesn't even add a shortcut to the Start Menu), but I think it will help with your understanding of how WiX works.
After you get the above example working, I'd suggest reading through this tutorial: How To: Create a Shortcut on the Start Menu. Note: I found that it was easier to copy/paste the entire code sample at the bottom of the page, replace everything in the default Product.wxs file in the WiX Visual Studio Project, and then replace references to your own files as needed.

Missing DLL's and Custom Actions when using MSBuild to build Visual Studio Solution with InstallShield Pro Project

I am currently trying to automate our .NET builds and have currently run into a snag. When building the project in Visual Studio on a machine with a InstallShield 2016 Professional License, everything builds fine. However, when trying to use MSBuild to build the VS Solution on a machine with InstallShield 2016 Standalone, the resulting MSI does not have a required DLL or a Custom Action. Meanwhile, trying to build the .ism using Iscmdbld results in the inability to find the Primary Output of the csproj's, Even after building in Devenv
If you are using project output groups (like Primary Output), your choices are limited. You have to use either the VS integrated build (via devenv), or MSBuild; iscmdbld is unable to resolve project output groups.
Your other alternative is to change from project output groups to using static (or dynamic) file links that don't require Visual Studio's knowledge. I tend to prefer static links, as it's easy to tell exactly what's in the project. More importantly, with static links you can't silently lose files that you'd previously added, thus it's easier to avoid potentially breaking component or upgrade rules.
Hopefully, this isn't too old to be of use. InstallShield is the absolute worst, I know.
If you edit your .isproj in a plain-text editor, you'll see that it's just a regular MSBuild script. You'll see that there is a lot of commented out stuff that explains (poorly) things you can add to it. Find the ItemGroup that contains the explanation about "ProjectReference items" and add a node of the following form:
<!-- The ProjectReference items refer to any Visual Studio solutions you want to automatically probe for Project Output Groups. -->
<ProjectReference Include="..\Path\To\Your\Proj.csproj">
<Project>{2d3f37cc-0e93-4673-a3df-59c556185f71}</Project>
<Name>Name Of Project As It Appears in VS</Name>
</ProjectReference>
After adding the above to all of my .isproj files, my automated build worked fine. Why the idiots at InstallShield never saw fit to add this capability to the UI, I'll never understand.
Unfortunately, I don't have any answer to the Custom Action problem, if it's not related to the above.

Getting the project status from Msbuild & Using it in vs2010

I have a really big project and what i am trying to do is this:
Occasionally, i have to make few (minor) changes in a single class.
Since this is a minor change, i really hate to open visual studio (ver 2010) and wait for all projects to load.
Instead i open notepad, change that particular file use msbuild.exe to build the entire solution.
Now the question is,
How to get the build status from msbuild.exe ? (i plan to write a nice gui or a web application from which after i invoke
this msbuild.exe, i can get the build status, show to the user)
Is this really a good idea to use msbuild.exe in vs2010 or vs2012? (I saw http://msdn.microsoft.com/en-us/library/ms171452(v=vs.90).aspx specify the supported
version as Visual studio 2008. Though this is working in vs2010, is this the correct way of doing it?)
thanks in advance.
Don't reinvent the wheel, use a build system that does everything you want (and more) for you. Look at Jenkins for example or TeamCity (see the image on the homepage of the latter: showing progress all over the place..)
Definitely yes. Since VS2010 Visual studio itself uses msbuild to build your projects (since they are msbuild scripts as well). And in some upcoming version even the solution file will be an msbuild file.

To Create a web solution Setup in Visual Studio 2010

I have created a web solution in visual studio 2010 ,i have also created a setup project in the same solution,I have linked the two solutions by adding project output as content files.
imagine my solution name is example.sln and i have setup name as setup10
I need to build it thru command prompt.
I found in the net that i need to check the build option in configuration manager of the solution i did that.
I then used this command
msbuild example.sln
it started to create setp10.vdproj
then it failed telling that setup10.vdproj doesn't exist.
I am not able to solve this problem from a day.
kindly help me with this.
vdproj files are not supported directly by msbuild You'll have to build then by calling devenv.exe
You can add a build step to msbuild to build the vdproj with devenv. See http://thepursuitofalife.com/how-to-build-vdproj-files-in-msbuild/ for more details.

Programmatically build WXS into MSI

I will try to make this as clear as I can, but if you have questions or don't completely understand let me know.
I have a program that creates a WXS (WiX source code file) from scratch, and tests it to make sure it is valid. I would like the next automatic step to be the actual building of the WXS using Visual Studio (I am working with VS 2008 Developers Edition/Team Suite Edition). I know that a WiX project (with WXS included in it) can be build from within VS, and the WiX comes with command line utilities for building as well. What I am looking for is the best option to go with. The program is a command line utility with no GUI. I know it is possible to use the command line from within my program, but I don't know how to use it with variable destinations and file names for the created file. A push in the right direction would be greatly appreciated.
build your WIX project in the visual studio and look at the Output window to see what is WiX actually running. then just copy paste those lines into your build proces.

Categories

Resources