Reputation: 15981
Is it possible to access project.json
metadata from a deployed application?
For example, in .NET 4.5 projects I would decorate my app like this
[assembly: AssemblyProduct("My App")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyVersion("4.5.1.*")]
[assembly: AssemblyInformationalVersion("Developer Build")]
and then at application startup, use reflection to read these values and write them to the log. The use case being that it is then easy to verify exactly what build is running in the wild.
Is it possible to reflect the project.json
metadata instead? eg:
"version": "1.0.0-*",
"description": "My app - acme widget factory",
"authors": [ "gbshaw" ],
"tags": [ "widget acme" ],
Upvotes: 1
Views: 93
Reputation: 15981
As far as I can tell (at least in Beta 6), the only project.json
attribute that can be reflected is version
.
Using the same project.json as specified in the question and then building the app with DNX_BUILD_VERSION
set to foobar
by my build server say, then ILSpy shows these attributes only
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0-foobar")]
You can however still use the traditional assembly attributes. The AssemblyVersion
and AssemblyInformationalVersion
attributes will actually override project.json version
.
Upvotes: 1