Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

How to setup an Automated Build Pipeline 11 Dec 2021 22:43 #20754

  • hilberg.it
  • hilberg.it's Avatar
  • Topic Author


  • Posts: 65
  • Hi,
    I am wondering what would be a good idea to setup an automated build pipeline for a X# project. I am trying to decide which approach would be most promising:
    a) setup a vm as development server in the cloud and install vs, x# here manually. Trigger build script with msbuild. Problems: Rather expensive. How should a build be triggered? Commit Hook?
    b) Since x# builds on .Net Core 5+ would it be a good idea to port the project to .Net5 and use something like Azure .NET Core CLI task ?

    Does anyone have experience with automated builds and likes to share some pros and cons? What are other setups?
    Thanks.

    Please Log in or Create an account to join the conversation.

    Last edit: by hilberg.it.

    How to setup an Automated Build Pipeline 12 Dec 2021 08:08 #20755

    • robert
    • robert's Avatar


  • Posts: 3588
  • You do not need to install VS to install X#.
    X# also detects and integrates in the VS Build tools

    And we're also working on a Nuget package for the X# compiler, so all you would have to do is add the X# compiler package to your projects to build them.

    Robert
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    How to setup an Automated Build Pipeline 12 Dec 2021 11:27 #20756

    • hilberg.it
    • hilberg.it's Avatar
    • Topic Author


  • Posts: 65
  • Sounds good. Thank you!

    Please Log in or Create an account to join the conversation.

    How to setup an Automated Build Pipeline 12 Dec 2021 17:48 #20757

    • VR
    • VR's Avatar


  • Posts: 87
  • We created automated builds for our x# solutions. We are currently using an OnPremise Jenkins Server to run the builds but since we use Azure Devops as Repository, we plan to switch to Azure Pipelines in the future.

    Early in the process, we decided to use Nuke.Build to create our "build-scripts". Nuke is a build automation solution based on .Net5. The scrips are written in c#. I like Nuke, because I can debug the scripts easily and run them using any build server or even on local machines.

    If your builds are more complex than "running msbuild with some parameters", than Nuke is worth a look. An alternative might be cake.build.

    Please Log in or Create an account to join the conversation.

    Last edit: by VR.

    How to setup an Automated Build Pipeline 14 Dec 2021 00:23 #20762

    • hilberg.it
    • hilberg.it's Avatar
    • Topic Author


  • Posts: 65
  • TWIMC: I also want to use Azure DevOps for CI tasks. Here is what I came up with so far. Seems to serve my needs :)
    1) copy XSharp compiler to my repo
    2) add Precompiler Include Path
    <IncludePaths>$(SolutionDir)\XSharp\Include</IncludePaths>
    and XSharp DLL HintPaths e.g.
    <HintPath>..\XSharp\Assemblies\XSharp.Core.dll</HintPath>
    to *.xsproj files
    3) set some vars in azure-pipelines.yml
    trigger:
    - main
    
    pool:
      vmImage: 'windows-2019'
    
    variables:
      solution: '**/*.sln'
      buildPlatform: 'Any CPU'
      buildConfiguration: 'Release'
      XSharpMsBuildDir: '$(Build.SourcesDirectory)/XSharp/MsBuild'
    
    steps:
    - task: NuGetToolInstaller@1
    
    - task: NuGetCommand@2
      inputs:
        restoreSolution: '$(solution)'
        
    - task: PowerShell@2
      inputs:
        targetType: 'inline'
        script: |
            Write-Host "##vso[task.setvariable variable=PATH;]${env:PATH};$(Build.SourcesDirectory)\XSharp\Bin"
            $RegistryPath = 'HKLM:\Software\WOW6432Node\XSharpBV\XSharp'
            $Name         = 'XSharpPath'
            $Value        = '$(Build.SourcesDirectory)\XSharp'
            If (-NOT (Test-Path $RegistryPath)) {
              New-Item -Path $RegistryPath -Force | Out-Null
            }  
            New-ItemProperty -Path $RegistryPath -Name $Name -Value $Value -PropertyType String -Force
        
    - task: VSBuild@1
      inputs:
        solution: '$(solution)'
        msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
        platform: '$(buildPlatform)'
        configuration: '$(buildConfiguration)'
    
    - task: VSTest@2
      inputs:
        platform: '$(buildPlatform)'
        configuration: '$(buildConfiguration)'

    Please Log in or Create an account to join the conversation.

    How to setup an Automated Build Pipeline 14 Dec 2021 07:58 #20764

    • robert
    • robert's Avatar


  • Posts: 3588
  • You do not have to change the project file to set an include path. You can also set the INCLUDE environment variable.
    And for the DLL path you can set the LIB environment variable.
    And indeed the path to the BUILD support files is read from the XSHARPMSBUILDDIR.

    And guys, if you have this working. Are you willing to share this with us, so we can setup automated builds of the X# runtime and VS Integration in Github ?

    Robert
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    How to setup an Automated Build Pipeline 14 Dec 2021 14:48 #20784

    • hilberg.it
    • hilberg.it's Avatar
    • Topic Author


  • Posts: 65
  • Hey, I created a Gist with the build pipeline and integrated your suggestions. No changes to project files needed anymore. HTH

    Please Log in or Create an account to join the conversation.

    Last edit: by hilberg.it.
    • Page:
    • 1