I was a bit frustrated last week with a task that seemed so simple but took me the whole week to get it done.. and in a rather dirty way I must say. We have a legacy VSTO project that we want to get into Jenkins. This project has a legacy installer that's built as a .vdproj (Visual Studio Installer project). This has always been built locally on a developer machine and released from there. I know, I know, that's nasty but it is what it is. So I was trying to do two things: getting the solution AND the installer to build on Jenkins.
Problems Encountered
Vdproj has been deprecated
Microsoft only supports vdproj that shipped with VS2010. We don't have license for VS2010 anymore. We're using VS2015. Fortunately there's an extension we can install for higher VS version. Download link here.MSBuild does not know anything about .vdproj file
This is very problematic because MSBuild does not know how to build .vdproj, only Visual Studio does, so we have to install Visual Studio in Jenkins. The command to automate this is:
Make sure that you call this from Visual Studio Developer Command Prompt.devenv /SolutionName.sln /project InstallerName.vdproj /build Release
There is however a pre-build validation that the whole projects in the solution should load. The VSTO project cannot load without having Office installed. So we have to install Office.
You will see the following error if you don't:
ERROR: Cannot find outputs of project output group '(unable to determine name)'. Either the group, its configuration, or its project may have been removed from the solution.
Cryptic .vdproj pre-build validation error
Googling leads me to this page. Yes unfortunately it is a registry hack. Create a DWORD key with the name "EnableOutOfProcBuild" and set it's value to zero inERROR: An error occurred while validating. HRESULT = '8000000A'
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0_Config\MSBuild\
Why not use ClickOnce as installer?
I did try to create an installer using ClickOnce, but came across another problem with a different computed hash in the manifest. This is most likely caused by an xml transformation specific to this application that happens after the hash has been computed.Conclusion
Avoid VSTO at all cost. I have to pollute the machine where Jenkins is run on to make this legacy application works. Here's a list:- Install Visual Studio 2015
- Install Microsoft Visual Studio 2015 Installer Projects extension
- Install Microsoft Office
- Install Visual Studio 2010 Tools for Office Runtime (provides the COM 'glue' between Excel and C#)
- Hack the registry
No comments:
Post a Comment