Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9216909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:31:12+00:00 2026-06-18T02:31:12+00:00

I am using Git + MSBuild . I need to get the Git Long

  • 0

I am using Git + MSBuild. I need to get the Git Long Hash number from MSBuild so that I can tie a build to the hash number (and find out what files made up that “revision”)

Is there a built in task in MSBuild I can use to get the hash number?

Any help is appreciated. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T02:31:13+00:00Added an answer on June 18, 2026 at 2:31 am

    I’d recommend passing it as property from CI sever itself whose job it is to deal with VCS, that way devs can use the same script against ordinary folder that isn’t a git repo, e.g. a dumb copy/paste for hacking around by providing it from CLI. That said, there might be proper api-based community task but I did it with:

    <Target Name="Foo">
        <Exec Command="git rev-parse HEAD > head" />
        <ReadLinesFromFile File="head">
            <Output TaskParameter="Lines" PropertyName="Head" /> 
        </ReadLinesFromFile>
        <Delete Files="head" />
        <Message Text="Head: $(Head)" />
    </Target>
    
    <Target Name="Bar">
        <PropertyGroup>
            <Head>$([System.IO.File]::ReadAllText(".git\refs\heads\master").Trim())</Head>
        </PropertyGroup>
        <Message Text="Head: $(Head)" />
    </Target>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Git, how can you find the difference between the current and the last
When using git log , how can I filter by user so that I
Using git , if I make git branch --all I can see all remotes
I'm using git in a project with multiple branches used concurrently, that is: A
I am using git in my projects, whenever I try to pull from Xcode
I am using git-svn (from cygwin) and I've done several git commits on my
Using git, I can create branches conceptually , without having to branch my directory
I'm using git to develop a project and each machine may need a slightly
Using git-subtree , the number of diffs to calculate when running a git subtree
We are currently using single git repository of ~600MB (that's the size of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.