PDBR
PDBR

Reputation: 341

VSTS build is not generating .msi file using .vdproj

I have VSTS Build which will generate the .msi file using .vdproj but I am not getting the .msi file out of the build.

I am getting the Warning MSB4078: The project file "abcdSetup\abcdSetup.vdproj" is not supported by MSBuild and cannot be built.

I am using Visual studio build task and MS build task to generate the .msi.

I have tried some ways and I installed third part task called create .msi file from VS installer Project.

I have attached the Snapshot of all the tasks using to generate this .msifile.

Please have a look and help me on this and also do let us know is there any task available in VSTS to create .msi file.

enter image description here

Upvotes: 5

Views: 5691

Answers (4)

Dean Peterson
Dean Peterson

Reputation: 43

I was able to get a build including a .vdproj MSI installer going with a modification of VPZ's answer. Building just the installer project with the devenv command line was not working for me. Therefore, I built the whole solution containing the installer project with the devenv command line. I used DisableOutOfProcBuild.exe first.

Here are the relevant portions of the pipeline YAML configuration.

pool:
  vmImage: 'windows-latest'

variables:
  solution: 'Code\IntelligentContentFramework.sln'
  visualStudioPath: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise'
  buildConfiguration: 'Release'
  buildPlatform: 'x86'

steps:
# ... nuget restoration steps omitted ...

# Enable vdproj installer build from devenv command line.
- task: CmdLine@2
  displayName: 'Prepare for MSI installer build'
  inputs:
    script: 'DisableOutOfProcBuild.exe'
    workingDirectory: '$(visualStudioPath)\Common7\IDE\CommonExtensions\Microsoft\VSI\DisableOutOfProcBuild'

# Build using command line that seems to work to build installer as well.
# Note: /Build would probably be equivalent to /Rebuild on fresh build VMs.
- task: CmdLine@2
  displayName: "Command Line Build"
  inputs:
    script: '"$(visualStudioPath)\Common7\IDE\devenv.com" "$(solution)" /Rebuild "$(buildConfiguration)|$(buildPlatform)"'

Upvotes: 0

VPZ
VPZ

Reputation: 738

In 2022 today, looks like the Azure DevOps includes the Microsoft Visual Studio Installer Projects extension.

I was able to get a build using below pipeline configuration:

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  BuildConfiguration: 'Release'
  BuildPlatform: 'Any CPU'
  InstallerProject: 'YourInstallerProject/YourInstallerProject.vdproj'
  Solution: 'YourSolution.sln'
  VisualStudioPath: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise'

steps:
- task: NuGetToolInstaller@1
  displayName: 'Install Nuget CLI'

- task: NuGetCommand@2
  displayName: 'Restore packages'
  inputs:
    restoreSolution: '$(Solution)'

- task: CmdLine@2
  displayName: 'Prepare for MSI build'
  inputs:
    script: 'DisableOutOfProcBuild.exe'
    workingDirectory: '$(VisualStudioPath)\Common7\IDE\CommonExtensions\Microsoft\VSI\DisableOutOfProcBuild'

- task: VSBuild@1
  displayName: 'Build primary project'
  inputs:
    solution: '$(Solution)'
    platform: '$(BuildPlatform)'
    configuration: '$(BuildConfiguration)'

- task: CmdLine@2
  displayName: 'Build installer project'
  inputs:
    script: '"$(VisualStudioPath)\Common7\IDE\devenv.com" "$(Solution)" /Project "$(InstallerProject)" /Build "$(BuildConfiguration)|$(BuildPlatform)"'

- task: CopyFiles@2
  displayName: 'Copy MSI files'
  inputs:
    sourceFolder: '$(Build.SourcesDirectory)'
    contents: '**/$(BuildConfiguration)/**/?(*.msi)'
    targetFolder: '$(Build.ArtifactStagingDirectory)'

- task: PublishBuildArtifacts@1
  displayName: 'Publish artifacts'
  inputs:
    pathToPublish: '$(Build.ArtifactStagingDirectory)'
    artifactName: drop

Make sure to update the values of Solution and InstallerProject variables. If you would like to build with a Visual Studio version other than 2022, you must also edit VisualStudioPath variable.

Upvotes: 2

andrew.fox
andrew.fox

Reputation: 7951

It wasn't possible until agent image Windows2019 was published. The new image is equipped with an extension for vdproj that is called Microsoft Visual Studio Installer Projects.

Steps:

  1. Add a Command line task
  2. Add there following line: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\devenv.com" MyProjectDir\MySolution.sln /Rebuild Release

Remark: please note to use devenv.com (not devenv.exe). The "com" version outputs build log and errors to the console (standard output).

Upvotes: 3

Leo Liu
Leo Liu

Reputation: 76928

I am getting the Warning MSB4078: The project file "abcdSetup\abcdSetup.vdproj" is not supported by MSBuild and cannot be built

That because MSBuild/Visual Studio does not have support for setup projects. To integrate with Azure DevOps, you will have to use devenv.

Note: starting VS 2013, .vdproj support is provided by an add-in.

That the reason why you got the error Warning MSB4078: The project file "abcdSetup\abcdSetup.vdproj" is not supported by MSBuild and cannot be built

Is there any way that we can generate .msi without setting up the Private agent in VSTS ? Please let me know is there any task available.

I am afraid there is no such way you can generate .msi without setting up the Private agent in Azure DevOps, otherwise, we will always get the error:

Some errors occurred during migration. For more information, see the migration report: C:\VSTS-vs2017-agent\_work\9\s\Setup1\UpgradeLog.htm

I test it on the Private agent and local PC without installing the Visual Studio Installer Projects extension and got the same result. Then I installed that extension on the local PC and it works fine. So, we have to install the Visual Studio Installer Projects extension, if we want to build the setup projects.

Hope this helps.

Upvotes: 0

Related Questions