{"action":"created","issue":{"url":"https://api.github.com/repos/markfinal/BuildAMation/issues/186","repository_url":"https://api.github.com/repos/markfinal/BuildAMation","labels_url":"https://api.github.com/repos/markfinal/BuildAMation/issues/186/labels{/name}","comments_url":"https://api.github.com/repos/markfinal/BuildAMation/issues/186/comments","events_url":"https://api.github.com/repos/markfinal/BuildAMation/issues/186/events","html_url":"https://github.com/markfinal/BuildAMation/issues/186","id":144241174,"number":186,"title":"Embed git hash and date of build into Bam.Core.dll","user":{"login":"markfinal","id":984489,"avatar_url":"https://avatars.githubusercontent.com/u/984489?v=3","gravatar_id":"","url":"https://api.github.com/users/markfinal","html_url":"https://github.com/markfinal","followers_url":"https://api.github.com/users/markfinal/followers","following_url":"https://api.github.com/users/markfinal/following{/other_user}","gists_url":"https://api.github.com/users/markfinal/gists{/gist_id}","starred_url":"https://api.github.com/users/markfinal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markfinal/subscriptions","organizations_url":"https://api.github.com/users/markfinal/orgs","repos_url":"https://api.github.com/users/markfinal/repos","events_url":"https://api.github.com/users/markfinal/events{/privacy}","received_events_url":"https://api.github.com/users/markfinal/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/markfinal/BuildAMation/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/markfinal/BuildAMation/milestones/4","html_url":"https://github.com/markfinal/BuildAMation/milestones/v1.0.2","labels_url":"https://api.github.com/repos/markfinal/BuildAMation/milestones/4/labels","id":1641954,"number":4,"title":"v1.0.2","description":"","creator":{"login":"markfinal","id":984489,"avatar_url":"https://avatars.githubusercontent.com/u/984489?v=3","gravatar_id":"","url":"https://api.github.com/users/markfinal","html_url":"https://github.com/markfinal","followers_url":"https://api.github.com/users/markfinal/followers","following_url":"https://api.github.com/users/markfinal/following{/other_user}","gists_url":"https://api.github.com/users/markfinal/gists{/gist_id}","starred_url":"https://api.github.com/users/markfinal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markfinal/subscriptions","organizations_url":"https://api.github.com/users/markfinal/orgs","repos_url":"https://api.github.com/users/markfinal/repos","events_url":"https://api.github.com/users/markfinal/events{/privacy}","received_events_url":"https://api.github.com/users/markfinal/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":0,"state":"open","created_at":"2016-03-14T07:02:35Z","updated_at":"2016-03-29T11:58:59Z","due_on":"2016-06-29T23:00:00Z","closed_at":null},"comments":2,"created_at":"2016-03-29T11:58:59Z","updated_at":"2016-03-29T16:33:10Z","closed_at":null,"body":"Would be useful to be able to identify exactly when and how a build was made.\r\n\r\ngit identifier could be from\r\n\r\ngit describe --long\r\n\r\nDate I'm sure could be from a command line util.\r\n\r\n\r\nHowever, I cannot easily see a way of achieving this as part of a pre-build event in the .csproj for Bam.Core as it is platform dependent.\r\n\r\nIt could be achieved in the make_release.py script, but it would be really useful to have this on all builds, not just release builds."},"comment":{"url":"https://api.github.com/repos/markfinal/BuildAMation/issues/comments/202987058","html_url":"https://github.com/markfinal/BuildAMation/issues/186#issuecomment-202987058","issue_url":"https://api.github.com/repos/markfinal/BuildAMation/issues/186","id":202987058,"user":{"login":"markfinal","id":984489,"avatar_url":"https://avatars.githubusercontent.com/u/984489?v=3","gravatar_id":"","url":"https://api.github.com/users/markfinal","html_url":"https://github.com/markfinal","followers_url":"https://api.github.com/users/markfinal/followers","following_url":"https://api.github.com/users/markfinal/following{/other_user}","gists_url":"https://api.github.com/users/markfinal/gists{/gist_id}","starred_url":"https://api.github.com/users/markfinal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markfinal/subscriptions","organizations_url":"https://api.github.com/users/markfinal/orgs","repos_url":"https://api.github.com/users/markfinal/repos","events_url":"https://api.github.com/users/markfinal/events{/privacy}","received_events_url":"https://api.github.com/users/markfinal/received_events","type":"User","site_admin":false},"created_at":"2016-03-29T16:33:10Z","updated_at":"2016-03-29T16:33:10Z","body":"Currently have this in a prebuild event in VisualStudio\r\n\r\n\"C:\\Program Files\\Git\\bin\\git.exe\" -C \"$(SolutionDir)$(ProjectName)\" describe --long > \"$(ProjectDir)\\obj\\buildinfo.txt\"\r\nDATE /T >> \"$(ProjectDir)\\obj\\buildinfo.txt\"\r\nTIME /T >> \"$(ProjectDir)\\obj\\buildinfo.txt\"\r\n\r\nThis can be added to the project (note that it doesn't actually like it in obj folder, it takes a copy and puts it in the ProjectDir, and is then never updated, which is frustrating.\r\n\r\nThen this can  be read in the application:\r\n\r\n        public static void\r\n        PrintVersion(\r\n            EVerboseLevel level)\r\n        {\r\n            var gitHash = string.Empty;\r\n            var buildDate = string.Empty;\r\n            var buildTime = string.Empty;\r\n            using (var stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(\"Bam.Core.buildinfo.txt\"))\r\n            {\r\n                using (var reader = new System.IO.StreamReader(stream))\r\n                {\r\n                    gitHash = reader.ReadLine().Trim();\r\n                    buildDate = reader.ReadLine().Trim();\r\n                    buildTime = reader.ReadLine().Trim();\r\n                }\r\n            }\r\n\r\n            var message = new System.Text.StringBuilder();\r\n            message.AppendLine(\"BuildAMation (Bam) (c) Mark Final, 2010-2016. Licensed under BSD 3-clause. See License.md.\");\r\n            message.AppendFormat(\"\\tv{0}, built on {1} {2}, from git {3}\",\r\n                Core.Graph.Instance.ProcessState.VersionString, buildDate, buildTime, gitHash);\r\n            message.AppendLine();\r\n            message.Append(\"Parts of this software are licensed under the Microsoft Limited Public License (MS-PL). See MS-PL.md.\");\r\n            Core.Log.Message(level, message.ToString());\r\n        }"}}