[JIRA] (JENKINS-26948) Workflow compatibility for MsBuildBuilder

5 views
Skip to first unread message

joha1712@gmail.com (JIRA)

unread,
Nov 8, 2016, 4:26:02 AM11/8/16
to jenkinsc...@googlegroups.com
Jonas Thyregod commented on New Feature JENKINS-26948
 
Re: Workflow compatibility for MsBuildBuilder

Hi Jesse Glick what is the status of this issue now that JENKINS-26055 is closed (status - "Won´t Do").
Will this not be implemented then, so msbuild can get integrated with pipeline?

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

jglick@cloudbees.com (JIRA)

unread,
Nov 8, 2016, 4:14:02 PM11/8/16
to jenkinsc...@googlegroups.com

Plan of record is to use JENKINS-37011 for such things.

Kalle.Niemitalo@procomp.fi (JIRA)

unread,
Oct 26, 2018, 12:46:06 PM10/26/18
to jenkinsc...@googlegroups.com

For later versions of MSBuild that come with Visual Studio, I think the best way is to run vswhere (which could be a custom tool) and derive the path of MSBuild.exe from its output.

I put this in one stage:

            environment {
                VSWHERE_DIR = tool(type: 'com.cloudbees.jenkins.plugins.customtools.CustomTool', name: 'vswhere')
            }

Then this as the first step:

                script {
                    // The @ sign prevents CMD.EXE from echoing the command and
                    // thus messing up the JSON output.
                    def VisualStudioInstances = readJSON(
                        text: bat(
                            script: '@"%VSWHERE_DIR%\\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools Microsoft.VisualStudio.Product.Professional -requires Microsoft.Component.MSBuild -format json',
                            returnStdout: true))

                    def VisualStudioInstallationPath = VisualStudioInstances[0].installationPath
                    echo "Using Visual Studio from ${VisualStudioInstallationPath}"

                    env.MSBUILD_DIR = VisualStudioInstallationPath + '\\MSBuild\\15.0\\Bin'
                    echo "Using MSBuild from ${env.MSBUILD_DIR}"
                }

This seems to work but a few things could be improved:

  • Error handling, if no matching version of Visual Studio has been installed.
  • Also recognize Enterprise, Express, and Community editions. Perhaps it's best to say -products *.
  • Can we get the \MSBuild\15.0\Bin part from vswhere somehow?
  • Could use NuGet to install vswhere. Then, only NuGet itself would need to be configured as a custom tool.
  • Perhaps move to a sharable pipeline library.
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

michaeldkfowler@gmail.com (JIRA)

unread,
Oct 26, 2018, 5:37:03 PM10/26/18
to jenkinsc...@googlegroups.com
Michael Fowler started work on New Feature JENKINS-26948
 
Change By: Michael Fowler
Status: Open In Progress

michaeldkfowler@gmail.com (JIRA)

unread,
Oct 26, 2018, 5:37:11 PM10/26/18
to jenkinsc...@googlegroups.com
Michael Fowler assigned an issue to Michael Fowler
 
Jenkins / New Feature JENKINS-26948
Workflow compatibility for MsBuildBuilder
Change By: Michael Fowler
Assignee: kdsweeney Michael Fowler

michaeldkfowler@gmail.com (JIRA)

unread,
Oct 26, 2018, 5:38:02 PM10/26/18
to jenkinsc...@googlegroups.com

antony.gelberg@gmail.com (JIRA)

unread,
Oct 26, 2018, 5:40:03 PM10/26/18
to jenkinsc...@googlegroups.com

michaeldkfowler@gmail.com (JIRA)

unread,
Oct 26, 2018, 5:41:02 PM10/26/18
to jenkinsc...@googlegroups.com
Michael Fowler edited a comment on New Feature JENKINS-26948
I have a PR open here: [ https:// issues github . jenkins-ci.org com / login.jsp?os_destination=%2Fbrowse%2FJENKINS jenkinsci/msbuild - 26948] plugin/pull/36  to add pipeline support.

Kalle.Niemitalo@procomp.fi (JIRA)

unread,
Oct 27, 2018, 9:53:03 AM10/27/18
to jenkinsc...@googlegroups.com
Kalle Niemitalo edited a comment on New Feature JENKINS-26948
{quote}For later versions of MSBuild that come with Visual Studio, I think the best way is to run vswhere (which could be a custom tool) and derive the path of MSBuild.exe from its output.
{quote}

I put this in one stage:
{code}

            environment {
                VSWHERE_DIR = tool(type: 'com.cloudbees.jenkins.plugins.customtools.CustomTool', name: 'vswhere')
            }
{code}

Then this as the first step:
{code}

                script {
                    // The @ sign prevents CMD.EXE from echoing the command and
                    // thus messing up the JSON output.
                    def VisualStudioInstances = readJSON(
                     text: bat(
                     script: '@"%VSWHERE_DIR%\\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools Microsoft.VisualStudio.Product.Professional -requires Microsoft.Component.MSBuild -format json',
                     returnStdout: true))

                    def VisualStudioInstallationPath = VisualStudioInstances[0].installationPath
                    echo "Using Visual Studio from ${VisualStudioInstallationPath}"

                    env. MSBUILD_DIR VSDEVCMD_BAT = VisualStudioInstallationPath + '\\ MSBuild Common7 \\ 15.0 Tools \\ Bin vsdevcmd.bat '
                    echo "Using                 }
{code}
And the step to run
MSBuild from $ :
{ env.MSBUILD_DIR code:groovy }
                bat 'CALL
" %VSDEVCMD_BAT%" && MSBuild.exe /property:Platform="Any CPU",Configuration="Release" /target:Restore;Build "SOLUTION.sln"'
{code                 }
The projects in this solution use [PackageReference rather than packages.config|https://docs.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files], so Jenkinsfile can use { code {/target:Restore } } instead of locating and running {{nuget.exe}}.

This seems to work but a few things could be improved:
- Error handling, if no matching version of Visual Studio has been installed.
- Also recognize Enterprise, Express, and Community editions. Perhaps it's best to say {{-products *}}.
-
Can we get the {{\MSBuild\15.0\Bin}} part from vswhere somehow?
- Could use NuGet to install vswhere. Then, only NuGet itself would need to be configured as a custom tool.
-
Perhaps move to a sharable pipeline library.

dar.amit@gmail.com (JIRA)

unread,
Oct 29, 2019, 9:56:03 AM10/29/19
to jenkinsc...@googlegroups.com
Amit Dar commented on New Feature JENKINS-26948

I see the last entry in this log is from last year.

Is someone still working on this issue? this is a major feature we are looking in our company...

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

jglick@cloudbees.com (JIRA)

unread,
Oct 29, 2019, 10:06:05 AM10/29/19
to jenkinsc...@googlegroups.com

this is a major feature we are looking [for]

For what it is worth, see my discussion.

Reply all
Reply to author
Forward
0 new messages