I want to include in the layout view of my ASP.NET MVC application the version.
I use this in index action to get the version:
var version = Assembly.GetAssembly(typeof(HomeController)).GetName().Version;
ViewBag.Version = version + " / " + YlaGeneralUtilities.GetBuildDateTime(version);
Afterwards in the view i simply output Viewbag.Version.
I want the version to exist anywhere and not only to the homeController/Index action.
One workaround is to include the actual code above in the layout view:
@{
var version = Assembly.GetAssembly(typeof(HomeController)).GetName().Version;
ViewBag.Version = version + " / " + YlaGeneralUtilities.GetBuildDateTime(version);
}
But i dont like the idea of having "logic" in the view..Is this the only way?