Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dave Jonker 22 posts 72 karma points
    Nov 28, 2022 @ 08:32
    Dave Jonker
    0

    Umbraco version in config

    Maybe i'm simply not seeing it, but in v8 and below we had this:

    <add key="Umbraco.Core.ConfigurationStatus" value="8.1.5" />
    

    In v9 & v10 i can't seem to find the exact version code in any config file. Except for the generated models, they contain something like this:

    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "10.2.1+25a20cf")]
    

    (in this case the version is 10.2.1)

    Is there any way to get the version from any of the config files?

    Thanks for your reply! Dave Jonker

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Nov 28, 2022 @ 11:07
    Jeavon Leopold
    100

    Hi Dave,

    Not from config but there is a service called UmbracoVersion which you can inject.

    e.g.

    @using Umbraco.Cms.Core.Configuration
    @inject IUmbracoVersion version
    
    <h1>@version.SemanticVersion.ToSemanticStringWithoutBuild()</h1>
    

    Jeavon

  • Dave Jonker 22 posts 72 karma points
    Nov 28, 2022 @ 11:15
    Dave Jonker
    0

    Hi Jeavon,

    Thanks... I knew i could get it from code (should have mentioned that), but i really would like to read it from a config file.

    Ik have a piece of code running that creates an Excel file of all running (Umbraco) websites with database name, path, check on SSL etc. but also the Umbraco version.

    Apparently I have to create a custom config setting now with the version number... that's too bad. Since it won't change automaticly with an update of Umbraco.

    Thanks anyway!

    Dave

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Nov 28, 2022 @ 11:21
    Jeavon Leopold
    0

    Sounds interesting, not sure how your Excel is currently able to access the config files but perhaps create an API endpoint (secure it with a token or something?) that returns the data you need in json that Excel can request or something like that ;)

  • Dave Jonker 22 posts 72 karma points
    Nov 28, 2022 @ 11:24
    Dave Jonker
    0

    It's just a simple console app that loops through all the websites in the root of our server and reads the web.config and/or appsettings.json file.

    The version information is extracted from that and placed in a custom class with all the info.

    If everything is collected an Excel sheet is generated with all the information, that's all :-)

  • Paul Seal 524 posts 2889 karma points MVP 7x c-trib
    Dec 04, 2022 @ 23:57
    Paul Seal
    0

    Hi Dave, have you tried reading it from the .csproj file?

Please Sign in or register to post replies

Write your reply to:

Draft