question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support inheritance in version.json config (or limit Update Build Number tasks)

See original GitHub issue

We are using GitVersioning in a number of solutions (~66 projects total). All assemblies should be versioned the same across the codebase, so the GitVersioning package was installed in each project and we created a version.json in the repo root. We use TFS as our build server so the cloudBuild.buildNumber feature was enabled. As a result, when solutions are built, the log shows that the build number is being updated dozens of times. It seems like this is causing some of our builds to fail intermittently (“Error while copying content to a stream” or “An error occurred while sending the request”).

While I’m sure the builds failing is a Microsoft issue, I’d also like to limit the number of “update build number” tasks to keep the logged output clean. One of the projects in this codebase contains core shared business logic that is referenced in every solution. I’d like to enable cloudBuild.buildNumber task in this shared project only but have it inherit the version and other settings from the root project.json file. Unfortunately, when I tried to configure this:

The "Nerdbank.GitVersioning.Tasks.GetBuildVersion" task failed unexpectedly.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Nerdbank.GitVersioning.VersionOracle.get_PrereleaseVersion()
   at Nerdbank.GitVersioning.VersionOracle.get_AssemblyInformationalVersion()
   at Nerdbank.GitVersioning.Tasks.GetBuildVersion.ExecuteInner()
   at MSBuildExtensionTask.ContextAwareTask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

Is there a way to inherit config or otherwise limit the number of “Update Build Number” tasks when cloudBuild output is enabled in the root across multiple projects?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
desmondgccommented, Dec 6, 2017

Thanks very much, @AArnott - it’s working perfectly! I moved the cloudBuild section to a separate version.json file in a shared base project and now I only see a single “Update Build Number” command in the TFS build logs.

For reference, my root $/version.json now looks like this:

{
  "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
  "version": "5.0",
  "assemblyVersion": {
    "precision": "revision"
  },
  "publicReleaseRefSpec": [
    "^refs/heads/main/development$",
    "^refs/heads/main/integration$",
    "^refs/heads/main/release$"
  ]
}

… and I added a new version.json at $/Domain/Common/version.json, where the Domain.Common project is referenced in every solution:

{
  "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
  "inherit": true,
  "cloudBuild": {
    "setVersionVariables": true,
    "buildNumber": {
      "enabled": true
    }
  }
}
1reaction
AArnottcommented, Aug 14, 2017

Your scenario is very compelling. While I don’t see the failures you see in my VSTS cloud builds, I do have other trouble with all projects trying to set the cloud build number and would rather just pick one to be the one. Inheritance is an interesting idea. I’ll play with that and see if I can make that work and that it makes overall.

Read more comments on GitHub >

github_iconTop Results From Across the Web

User and Workspace Settings
To modify user settings, you'll use the Settings editor to review and change VS Code settings. To open the Settings editor, navigate to...
Read more >
Project Configuration
The following configuration creates build and test targets for Nx. package.json project.json.
Read more >
Sharing dependency versions between projects
A version catalog is a list of dependencies, represented as dependency coordinates, that a user can pick from when declaring dependencies in a...
Read more >
Sharing Inheritance Limits and Considerations
Here are some things to consider when working with sharing inheritance. Sharing Inheritance Limits Sharing inheritance can be applied from a supported obj....
Read more >
Azure App Configuration best practices
App Configuration doesn't attempt to infer any relationship between keys or to inherit key values based on their hierarchy.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found