GithubHelp home page GithubHelp logo

microsoft / setup-msbuild Goto Github PK

View Code? Open in Web Editor NEW
330.0 47.0 84.0 766 KB

A GitHub Action to facilitate configuring MSBuild in the workflow PATH for building .NET Framework applications.

License: MIT License

JavaScript 5.28% TypeScript 94.72%
devops actions dotnet-framework msbuild-action msbuild visual-studio

setup-msbuild's Introduction

microsoft/setup-msbuild

This action will help discover where the MSBuild tool is and automatically add it to the PATH environment variables for you so future steps in your Actions workflow can just initiate msbuild commands without knowing the full path.

Important

Please note this tool does NOT add other Visual Studio tools (like VSTest, cl, cmake, or others) to PATH

Example Usage

- name: Add msbuild to PATH
  uses: microsoft/setup-msbuild@v2

- name: Build app for release
  run: msbuild src\YourProjectFile.csproj -t:rebuild -verbosity:diag -property:Configuration=Release

Runners and included software

This action is intended to be used within the GitHub Actions workflows using the model of 'runners' either hosted (provided by GitHub) or self-hosted (provided by you). The version and parameters you specify below are going to be scoped to what software actually exists on the runner image being used. For example, hosted runner images from GitHub typically do NOT have pre-release versions of Visual Studio on them so using vs-prerelease parameter noted below may not have intended effect when using hosted runners. The software included for GitHub-hosted runner iamges can always be found here: https://github.com/actions/runner-images which also includes information on when/how software on hosted images gets updated.

Optional Parameters

There are a few additional parameters that can be set if you need them. These are optional and should only be set if you know that you need them or what you are doing.

Specifying specific versions of Visual Studio (optional)

You may have a situation where your Actions runner has multiple versions of Visual Studio and you need to find a specific version of the tool. Simply add the vs-version input to specify the range of versions to find. If looking for a specific version, specify the minimum and maximum versions as shown in the example below, which will look for just 16.4.

- name: Add msbuild to PATH
  uses: microsoft/setup-msbuild@v2
  with:
    vs-version: '[16.4,16.5)'

The syntax is the same used for Visual Studio extensions, where square brackets like "[" mean inclusive, and parenthesis like "(" mean exclusive. A comma is always required, but eliding the minimum version looks for all older versions and eliding the maximum version looks for all newer versions. See the vswhere wiki for more details.

Use pre-release versions of Visual Studio (optional)

If you need your Actions runner to target a pre-release version of Visual Studio, simply add the vs-prerelease input. This is necessary if you want to run an action on a virtual environment that contains a pre-release version of Visual Studio or self-hosted images that you may have that also have pre-release versions of Visual Studio installed.

- name: Add msbuild to PATH
  uses: microsoft/setup-msbuild@v2
  with:
    vs-prerelease: true

Specifying MSBuild architecture (optional)

By default the action will use the x86 architecture for MSBuild, but it is possible to target the x64 versions instead. Simply add the msbuild-architecture input. Valid input values are x86 (default), x64, and arm64. Note that the success of these will rely on the runner OS.

- name: Add msbuild to PATH
  uses: microsoft/setup-msbuild@v2
  with:
    msbuild-architecture: x64

How does this work?

This makes use of the vswhere tool which is a tool delivered by Microsoft to help in identifying Visual Studio installs and various components. This tool is installed on the hosted Windows runners for GitHub Actions. If you are using a self-hosted runner, you either need to make sure vswhere.exe is in your agent's PATH or specify a full path to the location using:

- name: Add msbuild to PATH
  uses: microsoft/setup-msbuild@v2
  with:
    vswhere-path: 'C:\path\to\your\tools\'

Notes on arguments

While the Action enables you to specify a vswhere path as well as a vs-version, these are more advanced options and when using GitHub-hosted runners you should not need these and is recommended you don't specify them as they are optional. Using these require you to fully understand the runner environment, updates to the tools on the runner, and can cause failures if you are out of sync. For GitHub-hosted runners, omitting these arguments is the preferred usage.

Building this repo

As with most GitHub Actions, this requires NodeJS development tools. After installing NodeJS, you can build this by executing:

npm install
npm run build
npm run pack

which will modify/create the /dist folder with the final index.js output

Credits

Thank you to Warren Buckley for being a core contributor to this Action for the benefit of all developers!

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

setup-msbuild's People

Contributors

baronfel avatar clancey avatar dependabot[bot] avatar heaths avatar kawon7317 avatar kishorejangid avatar lancemccarthy avatar markingramuk avatar microsoftopensource avatar mosfet80 avatar therealmattv avatar timheuer avatar vampire avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

setup-msbuild's Issues

The -find parameter is too new to use safely

I added the -find parameter in vswhere 2.7, which wasn't included in Visual Studio until recently. It's not safe to use for hosts with older Visual Studio versions. There is https://github.com/marketplace/actions/setup-vswhere-exe that devs could call first. You might recommend this in the README, but it's probably just safer to stick with the older parameters and look for MSBuild yourself, which shouldn't be too hard since there are nice globbing functions available to node - which were actually my inspiration for adding that functionality in vswhere for non-node callers, like batch scripts that are more common.

Takes too long (18 secs)

This action simply finds the path to msbuild using the vswhere tool - why on earth it's taking 18 seconds? Is it because of the slow file system on the Github-hosted runner?

Using multiple include directories

Hello.
Im trying to build a project with some additional libraries from VCPKG

    - name: Add MSBuild to PATH
          uses: microsoft/[email protected]      
      
    - name: run-vcpkg
      uses: lukka/[email protected]     
      with:       
        vcpkgGitCommitId: 5568f110b509a9fd90711978a7cb76bae75bb092
        vcpkgGitURL: https://github.com/microsoft/vcpkg.git
        vcpkgDirectory: '${{ github.workspace }}/vcpkg'
        vcpkgJsonGlob: '**/vcpkg.json'
        runVcpkgInstall: true
        
    - name: Build
      working-directory: ${{env.GITHUB_WORKSPACE}}
      # Add additional options to the MSBuild command line here (like platform or verbosity level).
      # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
      run: msbuild /m /p:Configuration="${{ matrix.build }}" /p:IncludePath="${{env.VCPKG_ROOT}}\packages\glfw3_x64-windows\include\;${{env.VCPKG_ROOT}}\packages\glad_x64-windows\include\;${{env.VCPKG_ROOT}}\packages\glm_x64-windows\include\" ${{env.SOLUTION_FILE_PATH}}

For some reason the IncludePath property doesnt allow me to add multiple directories
I get this error:
MSBUILD : error MSB1006: Property is not valid. Switch: D:\a\GLWrapper\GLWrapper\vcpkg\packages\glad_x64-windows\include\
The first include directory is fine but after the semicolon it breaks

Rename v1 release to v1.0.0

Describe the bug
Currently GitHub thinks the v1 release is the latest release. This causes some unexpected behaviour if you use microsoft/setup-msbuild@v1, thinking you get the actual latest release (which is v1.0.2). Therefore I would propose to rename the v1 release to v1.0.0, so that a plain @v1 references the latest stable v1.x.x release again.

See https://github.com/microsoft/setup-msbuild/releases

Screenshot_672

Add more logging in action

Add more logging in the action for verbosity to help folks debug some possible random things like expressed in #78

Ideas:

  • MSBuild version
  • Path found as info log (non-verbose)
  • architecture

Error: Unable to find MSBuild.

Here's my github action script:

name: pr-verification
on:
  pull_request:
    types: [opened, synchronize, reopened]
jobs:
  build-extension:
    runs-on: windows-latest
    env: 
        DOTNET_NOLOGO: true
        DOTNET_CLI_TELEMETRY_OPTOUT: true
        RepositoryUrl: 'https://github.com/${{ github.repository }}'
        RepositoryBranch: '${{ github.ref }}'
        SourceRevisionId: '${{ github.sha }}'
        VersionSuffix: 'pr-${{github.event.number}}.${{ github.run_number }}'
        Configuration: Release
        SolutionPath: Src\Tellurium.sln
    steps:
    - uses: actions/checkout@v2   
    - name: Setup .NET Core
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: '3.1.x'
    - name: Setup MSBuild.exe
      uses: microsoft/[email protected]
      with:
        vs-version: '[16.8,16.9)'

Here's the output

Run microsoft/[email protected]
  with:
    vs-version: [16.8,16.9)
  env:
    DOTNET_NOLOGO: true
    DOTNET_CLI_TELEMETRY_OPTOUT: true
    RepositoryUrl: https://github.com/cezarypiatek/Tellurium
    RepositoryBranch: refs/pull/76/merge
    SourceRevisionId: 7dd485291311cebe37c50611033a5befa3715129
    VersionSuffix: pr-76.3
    Configuration: Release
    SolutionPath: Src\Tellurium.sln
    DOTNET_ROOT: C:\Users\runneradmin\AppData\Local\Microsoft\dotnet
C:\ProgramData\Chocolatey\bin\vswhere.exe -products * -requires Microsoft.Component.MSBuild -property installationPath -latest -version [16.8,16.9)
Error: Unable to find MSBuild.

Link to failed build https://github.com/cezarypiatek/Tellurium/pull/76/checks?check_run_id=2422153905

However, when I remove the version requirements ( vs-version parameter) then it works fine.

Unable to find msbuild.

I am trying to run this action on a self-hosted runner.

- name: Add msbuild to PATH
  uses: microsoft/[email protected]
    with:
      vs-version: 15.0

Here's the output:

"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -version 15 -requires Microsoft.Component.MSBuild -find MSBuild**\Bin\MSBuild.exe
##[error]Unable to find msbuild.

I tried doing the following, but it says it expects string, number, or boolean, not an array.

vs-version:
  [15.0,15.9]

I have Visual Studio Build tools installed on this server.

Planning to upgrade logo on GitHub Marketplace to Microsoft logo by end of May 2021

An unhelpful comment could be made helpful

this tools is not to replicate the full 'Developer Command Prompt'

Since this is the primary action that pops up when anyone wants to use msbuild for Visual Studio project builds, it's not exactly helpful to say "well, but don't use it". What should we use? Does Microsoft provide anything that sets up a normal VS developer prompt?

At the moment, the "publisher:microsoft" doesn't yield anything else Visual Studio related. I'm a bit confused, given that GitHub is now a Microsoft product, Visual Studio is a Microsoft product, Actions runners are offered by Microsoft, and so on. You'd hope it'd be a solved problem by now?

How to use with visual studio old version (vs2013)

Hi, I am using the action for windows build.
My sln only can be built by vs 2013.
I tried

      - name: Setup msbuild
        uses: microsoft/[email protected]
        with:
            vs-version: '12.0'
      - name: Build
        run: |
          @echo | msbuild -m myApplication.sln -p:PlatformToolset=v120 -p:Configuration=Release -p:Platform=Win32

But I got the following error:

C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(436,5): error MSB8020: The build tools for Visual Studio 2013 (Platform Toolset = 'v120') cannot be found. To build using the v120 build tools, please install Visual Studio 2013 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution"

Looking for your reply.

Unable to find MSBuild on hosted runners

The MSBuild dependency step keeps failing.

This is from my GitHub-actions YML file:
The host is a Windows_Server-2019 VM on AWS
VS flavour installed is Visual Studio 2019 Community Edition with License: Visual Studio Community

- name: Dependency - MSBuild
  uses: microsoft/[email protected]
  with:
    vswhere-path: 'C:\Program Files (x86)\Microsoft Visual Studio\Installer'  

resulting in the error in the step:

Run microsoft/[email protected]
"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -products * -requires Microsoft.Component.MSBuild -property installationPath -latest
##[error]Unable to find MSBuild.

I did add MSBuild location in the system path variable as well.

What am I missing?
Thanks for the consideration

I had asked this originally as a comment on #7

Support using 64-bit MSBuild

MSBuild in Visual Studio ships with two MSBuild.exe entry points: the MSBuild\Current\bin folder has an x86 (32-bit) executable, and MSBuild\Current\bin\amd64 has a 64-bit (x64/amd64) executable.

In general, both can build any type of project, but some codebases benefit from the increased memory capacity of the 64-bit version.

The 32-bit MSBuild has been on PATH in the Developer Command Prompt in Visual Studio 2019 and prior, but Visual Studio 2022 puts 64-bit MSBuild on PATH to match Visual Studio which is now 64-bit.

This Action should expose an option to put 64-bit MSBuild on PATH instead of 32-bit. Azure DevOps has an option to do so in its MSBuild task:

msbuildArchitecture
MSBuild Architecture
(Optional) Optionally supply the architecture (x86, x64) of MSBuild to run
Default value: x86

For compatibility I would recommend keeping x86 the default; ideally that might change at some point in the future.

Add Path Error

Getting an error that the Add-Path option is deprecated, and that environment variables should be used. I'm new to using GitHub actions so some of the examples I'm looking at are breaking.

MSbuild VCPKG

Do MSbuild invokes vcpkg?. I enabled vcpkg manifest to be used, so in local machine libraries are installed before the build process.
image

So, i must find a way to get vcpkg, probably run-vcpkg with only setup. Then the question is, do MSbuild invokes vcpkg?

If so, standar msbuild CLI call do it, or i need to specify some parameter?

Example of a use case: repo

16.7 shows 16.8

Hi,

Am I doing it wrong, or is there any other way to get it to use 16.7? It seems to resolve 16.8 even though I specify 16.7.

        uses: microsoft/[email protected]
        with:
          vs-version: 16.7
      - name: show msbuild version
        run: msbuild -version

Output:

Run msbuild -version
  msbuild -version
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
Microsoft (R) Build Engine version 16.8.1+bd2ea1e3c for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

16.8.1.52902

Transferring projects with MFC Library from VS2019 to VS2022

When Iā€˜m recently building my MFC based project on an github hosted agent with label "windows-latest", I got the following error ever since the VS version has switched to VS2022ļ¼š

C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(479,5): error MSB8041: MFC libraries are required for this project. Install them from the Visual Studio installer (Individual Components tab) for any toolsets and architectures being used.

So is the MFC Library simply not installed on this version of VS? What shall I do now?

Error: Unable to find MSBuild.

I'm trying to build VS2019 extension and previously (about a month ago) specifying vs-version [16.0, 17.0) worked. But since about just over a week ago, this has stopped working.

I updated my yml to the following....

with:
    vs-version: [16.5, 16.11)
    msbuild-architecture: x86

But I still get the following error....

C:\ProgramData\Chocolatey\bin\vswhere.exe -products * -requires Microsoft.Component.MSBuild -property installationPath -latest -version "[16.[5](https://github.com/WildernessLabs/VS_Win_Meadow_Extension/runs/5423178303?check_suite_focus=true#step:6:5), 1[6](https://github.com/WildernessLabs/VS_Win_Meadow_Extension/runs/5423178303?check_suite_focus=true#step:6:6).11)"
Error: Unable to find MSBuild.

Any suggestions what vs-version will work for VS2019?

My VS2020 extension builds just fine when specifying [17.0, 18.0).

nmake cannot be found by default

Thanks for this Action! I'm trying to use it to build a project with an nmake-compatible Makefile and I'm seeing the following in my CI logs:

nmake -f Makefile.msvc.x64.in
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
nmake: D:\a\_temp\c836ed5d-0142-46e1-8fee-328d02c3c2e1.ps1:3
Line |
   3 |  nmake -f Makefile.msvc.x64.in
     |  ~~~~~
     | The term 'nmake' is not recognized as a name of a cmdlet, function, script file, or executable
     | program. Check the spelling of the name, or if a path was included, verify that the path is correct
     | and try again.

Is there something special I need to do here?

New failures when using version flag

Recently the runner has been failing to execute this engine when specifying a version argument.

Workaround: remove any use of vs-version argument for the action and let it default to latest.

Setting up to use cl.exe with CMake

Hi! I'm attempting to use this to set up my environment for a github action using CMake, Ninja and cl.exe, but when I do the following:

 - name: Add msbuild to PATH
   uses: microsoft/[email protected]
  
 - name: Configure
   run: |
      cmake -S . -B build -G Ninja -D CMAKE_C_COMPILER="cl.exe" -D CMAKE_CXX_COMPILER="cl.exe" -D CMAKE_BUILD_TYPE=Release

CMake reports that cl.exe is not in the path:

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:1 (project):
  The CMAKE_C_COMPILER:

    cl.exe

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.

Do I need to take some additional steps to get cl.exe's location in the path?

Thanks for any assistance.

Support for MSVS 2022

Trying to use this action with the just added "windows-2022" environment (see actions/runner-images#3949) doesn't work, msbuild is not found. It would be nice if it could be updated to support the latest version. TIA!

Support for Visual Studio 2022

Please add support for Visual Studio 2022 on windows-2022.

I can not detect the new version with vswhere.exe and the base folder is moved to "Program Files".
As a workaround I currently use:

runs-on: windows-2022
...
- name: Add msbuild to PATH
   run: echo "C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
   shell: pwsh

Uses the deprecated add-path and set-env command

Hello,

According to GitHub, they have removed the add-path and set-env commands because there was a security issue. More information can be found here: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

add-path should be replaced with addPath and set-env should be replaced with exportVariable. Apparently, it uses @actions/core version 1.2.6. More information: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files

Because it uses the deprecated add-path and set-env commands, our GitHub Actions workflows which use @microsoft/setup-msbuild fail with an error referencing it.

The affected lines in affected files are found here:

command_1.issueCommand('add-path', {}, inputPath);

command_1.issueCommand('set-env', { name }, val);

And these are the failed workflows in our project:

https://github.com/EoflaOE/Kernel-Simulator/actions/runs/376949373
https://github.com/EoflaOE/Kernel-Simulator/actions/runs/376949371

This is a serious issue for us as it makes workflows that don't have ACTIONS_ALLOW_UNSECURE_COMMANDS environment variable set to true unusable, especially for the project owners who seek for security like us.

The term 'cl' is not recognized as the name of a cmdlet

I am trying to build my C++ application using GitHub actions and added a step to use this action as follow:

      - name: Setup MSBuild
        if: runner.os == 'Windows'
        uses: microsoft/[email protected]

msbuild is working, but not cl:
My Step:

      - name: Test MSBuild
        if: runner.os == 'Windows'
        shell: pwsh
        run: |
          msbuild -version
          cl

Output is:

Run msbuild -version
  msbuild -version
  cl
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
  env:
    OS: win32
Microsoft (R) Build Engine version 16.7.0+b89cb5fde for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

cl: D:\a\_temp\3109041e-6212-4b44-a224-795ce1d6037f.ps1:3
Line |
   3 |  cl
     |  ~~
     | The term 'cl' is not recognized as the name of a cmdlet, function, script file, or operable program.
     | Check the spelling of the name, or if a path was included, verify that the path is correct and try
     | again.

Is this expected?

How to compile cpp program and add additional includeDir?

Hi, I tried to using MSBuild to compile my program with msbuild /p:IncludePath="path/to/include" where the path contains several external header files from a 3rd-party lib that my program need.

But the build process always said Cannot open include file, and it seems the folder is not included.

My local build works all fine, and Using msbuild locally also works fine. (The AdditionalIncludeDir is set in the VS file).

What is the correct way to include a 3rd-party lib source with msbuild ?

Task should support prerelease versions of VS

My dev workstation doubles as my self-hosted GitHub Actions runner. Installed upon it is VS2019 16.10 Preview 1.0. This is the only version of Visual Studio present on the machine. Unless this action specifies the -prerelease flag when it calls vswhere, no installations will be returned. However, there is no action parameter that lets me do this, and as such my workflow fails. Could support for this be added? Thanks!

What extensions are installed when Visual Studio version is specified?

I'm trying to use this Gitub Action to build a VS extension.
This VS extension uses some of the Xamarin tooling for debugging. My yml currently says...

with:
        vs-version: '[16.0, 17.0)'

but seems these don't include the Xamarin tooling to build iOS, Android apps, even though Xamarin is an MS product.

Is there something like the below that I've missed??

with:
        vs-version: '[16.0, 17.0)'
        ms-extensions: 'xamarin-sdk'

MSBuild.exe is not in the Path

Hi, I just run a simple test for this action as follows:

    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v2
    
    - name: Add MSBuild to PATH
      uses: microsoft/[email protected]

Then I try to run msbuild, but the command was not found.
I suspect whether msbuild can be found via environment or not?

Here output the stepup-msbuild:

"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -products * -requires Microsoft.Component.MSBuild -property installationPath -latest
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise

Actually the msbuild.exe should in C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild/Current/bin/
I use luchihoratiu/debug-via-ssh@main to connect to github runner and debug, run msbuild after setup-msbuild action, but msbuild was not recognized, which means the path was not added into the path.

What am I missing or misusage?
Thanks for the consideration

Release a new version (with the recent updates, most notably @actions/core)

As per https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/, there is currently a nasty warning for every user of this Action:

##[warning]The add-path command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

See for example https://github.com/git-for-windows/git/actions/runs/291669581.

The solution proposed in that blog post is to upgrade @actions/core to at least v1.2.6, which has been done in the main branch already, but there is no official version with that fix yet.

New "Cannot run compiler 'cl'" error in our automated builds

Hello,

thanks for developing and maintaining this action which is super-useful to us.

we use microsoft/setup-msbuild@v1 in conjuction with jurplel/install-qt-action@v2 to build TRSE for windows:
https://github.com/leuat/TRSE/actions/workflows/win32-msvc.yml

Recently, our builds started to fail with:

The system cannot find the path specified.
Project ERROR: Cannot run compiler 'cl'. Output:
===================
===================
Maybe you forgot to setup the environment?

Although we didn't change anything significant on our side between the last successful build and the first failing one.

The build at 2022-02-20 22:45:50 GMT succeeded
The build at 2022-02-21 13:51:55 GMT failed

Do you have any idea where this could come from?

Setting vs-version: [17.0, 18.0) results in Error: Unable to find MSBuild.

As per subject, when I run....

Run microsoft/[email protected]
  with:
    vs-version: [17.0, 18.0)
    msbuild-architecture: x64
  env:
    DOTNET_ROOT: C:\Users\runneradmin\AppData\Local\Microsoft\dotnet
    NUGET: C:\hostedtoolcache\windows\nuget.exe\5.11.0\x64/nuget.exe

and following error

C:\ProgramData\Chocolatey\bin\vswhere.exe -products * -requires Microsoft.Component.MSBuild -property installationPath -latest -version "[17.0, 18.0)"
Error: Unable to find MSBuild.

When is VS2022 likely to be supported?

CVE-2020-15228 - Contains usage of now deprecated `add-path`

Related CVE - GHSA-mfwh-5m23-j46w

Output from Github Actions:

Run microsoft/[email protected]
  with:
    vs-version: 16.7
C:\ProgramData\Chocolatey\bin\vswhere.exe -products * -requires Microsoft.Component.MSBuild -property installationPath -latest -version 16.7
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise
Warning: The `add-path` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands

Usage appears to be here

command_1.issueCommand('add-path', {}, inputPath);

failed with exit code 87 on windows-2016

I'm currently using this action on a self hosted machine (with vs community 2019 installed, no 2017) and it's working fine.

I added it to an action running on windows-2016 (as a project I have requires vs2017 not vs2019) to replace the hard-coded path I had before, and I get this output

Run microsoft/[email protected]
with:
env:
BuildSolution: PopCameraDevice.visualstudio\PopCameraDevice.sln
BuildPlatform: x64
BuildConfiguration: Debug_NoKinect
BuildDirectory: PopCameraDevice.visualstudio\x64\Debug_NoKinect
"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.Component.MSBuild -find MSBuild**\Bin\MSBuild.exe
Visual Studio Locator version 2.5.2+gebb9f26a3d [query version 1.18.21.37008]
Copyright (C) Microsoft Corporation. All rights reserved.

Error 0x57: Unknown parameter: find
##[error]The process 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' failed with exit code 87

Here is the relevent part of my action;

jobs:
  buildwindows:
    runs-on: windows-2016
    
    steps:
    - uses: actions/checkout@v1
      with:
        submodules: true
        
    - name: Add msbuild to PATH
      uses: microsoft/[email protected]

Something wrong with the 2016 machine? (I'm aware it's deprecated but... is this going to fail on a self hosted vs2017 machine too?)

Using setup-msbuild with latest version of vs2019 but with vs2010 build tools

So I got a project that now uses this action, however it depends on 3rd party dependencies that I cannot change which targets vs2010 build tools so in order to compile I would need for the actions to also include the vs2010 build tools like I have on my machine.

Hopefully it's just an yml setting change and not just an github action image issue on their windows-latest image.

the failed build is here: https://github.com/AraHaan/pthmgr/runs/1279113845?check_suite_focus=true

Clang support

I'm not sure if this is right place to ask. I'm seeking to use clang, now shipped with VS2019, on my GitHub action. Can this Action be used to this? How?

[Documentation] Add usage example of msbuild-architecture input

Add description and examples of using the msbuild-architecture input.

For example:

    - name: Setup 64 bit msbuild.exe
      uses: microsoft/[email protected]
      with:
        msbuild-architecture: 'x64'

and

    - name: Setup 32 bit msbuild.exe
      uses: microsoft/[email protected]
      with:
        msbuild-architecture: 'x86'

It would also be nice to see the other parameter descriptions/examples. If you're updating it for this one, might as well add any missing ones while you're in there :)

-latest and -version are not mutually exclusive

VSWHERE_EXEC += '-latest '

I'm the creator/maintainer for vswhere. The -latest and -version parameters are not mutually exclusive and, on custom hosts with multiple Visits Studio versions, this will cause a problem. -latest just means it gets the most recruit updated version of the highest version within the range specified by -version, it all versions installed if no -version parameter is specified.

Without -latest, you can get back multiple paths with no default sorting. The new sort parameter helps, but 1) is unnecessary with -latest, and 2) is only in newer VS installs, which is why I recommended people pull down vswhere from nuget.

Nuget package restore fails

Restoring nuget packages via MSBuild (msbuild $env:SOLUTION_NAME /t:Restore) fails with error NU1101 while package restore succeeds with nuget.exe (nuget restore $env:SOLUTION_NAME). This issue is happening recently.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.