Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.
Für eine ASP.Net Anwendung möchte ich gerne die Versionen meiner Anwendung und aller referenzierten Assemblies ausgeben. Bei Winforms kann ich für die Anwendung mit Application.ProductVersion die Version meiner Anwendung abfragen, die ich in der AssemblyInfo.cs eingestellt habe. Das geht bei ASP.Net nicht. Hier die Lösung, wie man das im Web macht, gleich mit Sortierung:
Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); if (assembly != null) { lblProductVersion.Text = assembly.GetName().Name + " - " + assembly.GetName().Version.ToString(); var referenceAssemblies = from a in assembly.GetReferencedAssemblies() orderby a.Name select a; foreach (AssemblyName referenceAssemblyName in referenceAssemblies) { lblProductVersion.Text += "<br>" + referenceAssemblyName.Name + " - " + referenceAssemblyName.Version; } }
Die Ausgabe sieht dann ungefähr so aus:
MyApplication - 1.0.3058.30144AjaxControlToolkit - 1.0.10618.0ArtisoAssertLib - 1.0.0.0CommonComponents - 1.0.3056.28557CommonContracts - 1.0.3056.28555CrystalDecisions.CrystalReports.Engine - 11.5.3700.0CrystalDecisions.ReportSource - 11.5.3700.0CrystalDecisions.Shared - 11.5.3700.0cTextBox - 1.0.3058.27781DataContracts - 1.0.0.0Infragistics35.WebUI.Misc.v8.1 - 8.1.20081.1000Infragistics35.WebUI.Shared.v8.1 - 8.1.20081.1000Infragistics35.WebUI.UltraWebChart.v8.1 - 8.1.20081.1000Infragistics35.WebUI.UltraWebGrid.v8.1 - 8.1.20081.1000Infragistics35.WebUI.UltraWebNavigator.v8.1 - 8.1.20081.1000Infragistics35.WebUI.UltraWebTab.v8.1 - 8.1.20081.1000Infragistics35.WebUI.UltraWebToolbar.v8.1 - 8.1.20081.1000Infragistics35.WebUI.WebDataInput.v8.1 - 8.1.20081.1000Infragistics35.WebUI.WebDateChooser.v8.1 - 8.1.20081.1000ListValuesComponents - 1.0.3057.30147ListValuesContracts - 1.0.3057.30146LoginManagerComponents - 1.0.3033.29632LoginManagerContracts - 1.0.0.0mscorlib - 2.0.0.0NavigationComponents - 1.0.3058.27781NavigationContracts - 1.0.3058.27780PCMAreaComponents - 1.0.3058.27781PCMAreaContracts - 1.0.3058.27779ProductsAreaComponents - 1.0.3058.27779ProjectsAreaComponents - 1.0.3058.27780ProjectsAreaContracts - 1.0.3058.27778ReportingComponents - 1.0.3058.27781ReportingContracts - 1.0.3058.27780SearchComponents - 1.0.3058.27779SearchContracts - 1.0.3058.27779System - 2.0.0.0System.Configuration - 2.0.0.0System.Core - 3.5.0.0System.Data - 2.0.0.0System.Data.DataSetExtensions - 3.5.0.0System.Data.Linq - 3.5.0.0System.Drawing - 2.0.0.0System.Web - 2.0.0.0System.Web.Extensions - 3.5.0.0System.Web.Services - 2.0.0.0System.Xml - 2.0.0.0TaskListComponent - 1.0.3056.28564TaskListContract - 1.0.3056.28560TypesComponents - 1.0.3057.30147TypesContracts - 1.0.3057.30147UserManagementContracts - 1.0.0.0Validators - 1.0.0.0wwDataBinder - 1.0.2908.21817
Remember Me