Skip to content

How to build this project in github action #2290

Closed

Description

@lindexi

I create a github action and call the build.cmd but build failed.

This is my action file https://github.com/dotnet-campus/wpf/pull/1/files

And this is the build info: https://github.com/dotnet-campus/wpf/pull/1/checks?check_run_id=338492387

Could you help me to build WPF project

Activity

  1. vatsan-madhavan commented on Dec 10, 2019

    @vatsan-madhavan
    Member

    I'm not going to analyze your GitHub actions yml here - that's your project ;-) If you figure it out, we'll be happy to use your work some day in the future 😁. But I'll try to help you achieve your goal by explaining how to structure the build process and then you can implement it in a way that works within the GitHub Actions framework.

    1. Start by cloning the repo.
      • You always want to run something like git clean -xdf at the start of each build. This helps ensure that any crud from previous builds is removed. The build process generates files under the repository root (generally, under .tools, artifacts, .dotnet\ etc.)
    2. The build itself should be run 4 times.
      • Configuration={Release, Debug} x Platform={x86, x64}
      • The repo is designed to treat Platform=x86 as the default platform. This this is the only platform that generates reference assembly packages (or any packages that are architecture neutral).
      • Put differently, Platform=Any CPU is functionally equivalent to x86.
      • In Azure Pipelines, we use a matrix strategy to distribute the tasks 4 times over.
    3. The build command to use is something like this:
      • build.cmd -pack -ci -configuration $(Configuration) -prepareMachine /p:Platform=$(Platform)
      • If you can generate an official build ID, then add one more argument like this: /p:OfficialBuildId=$(BuildId)
      • The BuildId value $(BUILD.BUILDNUMBER) in Azure Pipelines usually looks something like this: 20191208.1
      • -ci is an important switch for CI/PR builds. It changes the behavior of builds in a significant way. You may want to peruse the implications of this switch in https://github.com/dotnet/arcade and also look for ContinuousIntegrationBuild in various Arcade build targets. You can also try building with -ci locally to see how it behaves.
    4. Once the build is done, you can gather the logs and upload them.
      • The logs are always in .binlog formate, under artifacts\logs\**\*
    5. You can also publish or upload nuget packages optionally if you want to produce a true build system.
      • The nuget packages would be produced under artifacts\packages.
      • A set of nuget packages would require (a) architecture neutral packages from x86 builds, win-x86 specific packages from the same x86 build, and win-x64 RID specific packages from a matching x64 build.

    As tooling, you'll need VS2019 16.4 on the build machines. Close to a full install would be ideal.

    Once you get going and if you need additional help or want to tweak something a bit differently, we can try to help further.

  2. added
    QuestionGeneral question, not a problem in source code or documentation (yet)
    on Dec 10, 2019
  3. lindexi commented on Dec 10, 2019

    @lindexi
    MemberAuthor

    @vatsan-madhavan Thank you very much

  4. lindexi commented on Apr 23, 2020

    @lindexi
    MemberAuthor

    Now it says LINK : fatal error LNK1104: cannot open file 'MSVCURTD_netcore.LIB' [D:\a\wpf\wpf\src\Microsoft.DotNet.Wpf\src\DirectWriteForwarder\DirectWriteForwarder.vcxproj]

  5. lindexi commented on Apr 23, 2020

    @lindexi
    MemberAuthor

    Now it says LINK : fatal error LNK1104: cannot open file 'MSVCURTD_netcore.LIB' [D:\a\wpf\wpf\src\Microsoft.DotNet.Wpf\src\DirectWriteForwarder\DirectWriteForwarder.vcxproj]

    Why Link error? Because the cpp project should use x86 or x64 to compile.

  6. lindexi commented on Apr 23, 2020

    @lindexi
    MemberAuthor

    The simplest configuration files are as follows

    name: .NET Core
    
    on: [push]
    
    jobs:
      build:
    
        runs-on: windows-latest
    
        steps:
        - uses: actions/checkout@v1
        - name: Install Nuget
          uses: nuget/setup-nuget@v1
          with:
            nuget-version: '5.x'
          
        - name: Setup MSBuild.exe
          uses: warrenbuckley/Setup-MSBuild@v1
          
        - name: Build
          run: .\build.cmd -pack -ci -configuration Release -prepareMachine /p:Platform=x86

    See: dotnet-campus#1

    Thank you @vatsan-madhavan

  7. ghost locked as resolved and limited conversation to collaborators on Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionGeneral question, not a problem in source code or documentation (yet)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions