10

I have been pulling my hair for the past couple days trying to figure out how set up a CI/CD process just to build a simple WPF solution and create the MSI setup file ("artifact") using Azure DevOps Pipelines. I have tried using Build VS Installer to accomplish this. My main problem is that I don't know exactly what am I doing wrong or what steps I am missing and I can't find clear instructions on this anywhere.

Here's what I've tried:

  1. Using the Hosted 2017 agent pool and the basic .NET Desktop Template. Problems:

    • Create .msi file(s) from VS Installer project(s) as last task or before publishing artifact):

2018-11-28T22:57:56.3186071Z DEBUG: Aggregated: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.com 2018-11-28T22:57:56.3211382Z Now running (C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.com) with Arguments ("D:\a\1\s" /Build "release|any cpu" /Out "D:\a\1\b\BuildInstaller_Log_20181128225756.txt") 2018-11-28T22:58:54.0015320Z Done running DevEnv process. Success = True. 2018-11-28T22:58:54.1169279Z ##[warning]No .MSI files were found, please check your build-configuration. If this is expected, you might consider to use the default Visual Studio Build task instead of this custom Installer task. 2018-11-28T22:58:54.1434410Z ##[section]Finishing: Create .msi file(s) from VS Installer project(s).

enter image description here

  1. Creating my own build agent as outlined in the documentation. I have Visual Studio Community 2017 with the VS Installer Projects extension installed on that server. I followed the steps from this related answer. Results:

2018-11-29T17:46:03.9813075Z DEBUG: Aggregated: System.Object[]\devenv.com 2018-11-29T17:46:04.4346060Z ##[error]Cannot retrieve the dynamic parameters for the cmdlet. The specified wildcard character pattern is not valid: System.Object[] 2018-11-29T17:46:04.4716416Z ##[section]Finishing: Create .msi file(s) from VS Installer project(s).

enter image description here

I also tried DevEnv Build from the market place instead of the DutchWorkz one and still couldn't get an .msi file. Can someone please show me some clear steps on how to achieve this simple goal?

Cosmin
  • 565
  • 1
  • 8
  • 33
  • 1
    If I recall correctly the hosted agents don't have the VS extension installed for this. That's why a private agent has to be setup for this. Also, couldn't you trigger the generation of the MSI from the command line? Have you tried kicking that command off by hand from powershell? – Rob Bos Dec 02 '18 at 16:15
  • @RobBos Thank you for the suggestion. That's what I've read about the hosted agents as well which is why I tried setting up my own agent and made sure the VS extension is installed on that machine. Still couldn't get it to work. That sounds like a great soultion if I knew how to do it. If you could please show me how I would gladly accept is as the answer. My end goal is to output the .msi file regardless of the method (the easier, the better) :) – Cosmin Dec 03 '18 at 23:01
  • 1
    To execute command line tasks, add the "Batch Script" task, the "value" value should be "C:\Windows\System32\cmd.exe", and the arguments" value should be: "msi compile commands go here!" – Antebios Dec 05 '18 at 16:43
  • @Atebios This sounds like something that might work. I gave it a try but it didn't work. Erro MSB4025: The project file could not be loaded. Data at root level is invalid. Not sure if I have used the right arguments. Do you have any pointers on this? Thanks. – Cosmin Dec 06 '18 at 16:55
  • Is there any way to build MSI in release mode using **"DutchWorkz"** ? – Dharti Sutariya Jul 17 '20 at 15:29

2 Answers2

4

I was able to figure out why I was getting the specific error message below and wanted to share in case it helps anyone out in the future.

DEBUG:

Aggregated: System.Object[]\devenv.com [error]Cannot retrieve the dynamic parameters for the cmdlet. The specified wildcard character pattern is not valid: System.Object[]

The issue was that I had two versions (Professional and Enterprise) of Visual Studio 2017 installed on my private build server. Once I removed one of them, everything worked great. Not sure if there's a way to get it working with both installed, but I didn't need both.

Gourav
  • 2,746
  • 5
  • 28
  • 45
Migs
  • 91
  • 8
  • Thank you so much for your input. I only have VS2017 Community and SSDT installed as a separate instance on that server. Do you think that might be the source of the problem? I don't see any reason why it wouldn't work with the Community version. Please correct me if I am wrong. – Cosmin Feb 08 '19 at 17:12
  • 1
    I'm just speculating but I don't think having SSDT installed would be an issue. If you can get an installation of VS2017 Professional or Enterprise, I would install that and uninstall Community. Again, just guessing but maybe the Build VS Installer extension doesn't work with community. Unfortunately their documentation doesn't really give much info. Don't forget that in addition to the Build VS Installer extension, when you install a new version of Visual Studio 2017, you'll need to install the VS Installer projects extension that you mentioned in your OP. – Migs Feb 11 '19 at 15:01
1

Microsoft Visual Studio Installer Projects extension is present in windows-latest runner. Find more here

In short, use an agent with windows-latest vmimage and build via devenv.exe instead of MSBuild.

sree
  • 2,287
  • 28
  • 26