如何获取系统自身的版本号?

jackyhzzjcn 2003-07-15 10:54:33
就是这些信息
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany(")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.*")]
...全文
172 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
tjq_tang 2003-07-15
  • 打赏
  • 举报
回复
http://www.microsoft.com/china/community/article.asp?oBODY=TechZone/FAQ/Q304283&oXSLT=TechZone/FAQ/nav
LA003 2003-07-15
  • 打赏
  • 举报
回复
哦, 原来是动物园开大会~~
Kain 2003-07-15
  • 打赏
  • 举报
回复
Public Class AssemblyInfo
' Used by Helper Functions to access information from Assembly Attributes
Private myType As Type

Public Sub New()
myType = GetType(FrmStudent)
End Sub

Public ReadOnly Property AsmName() As String
Get
Return myType.Assembly.GetName.Name.ToString()
End Get
End Property
Public ReadOnly Property AsmFQName() As String
Get
Return myType.Assembly.GetName.FullName.ToString()
End Get
End Property
Public ReadOnly Property CodeBase() As String
Get
Return myType.Assembly.CodeBase
End Get
End Property
Public ReadOnly Property Copyright() As String
Get
Dim at As Type = GetType(AssemblyCopyrightAttribute)
Dim r() As Object = myType.Assembly.GetCustomAttributes(at, False)
Dim ct As AssemblyCopyrightAttribute = CType(r(0), AssemblyCopyrightAttribute)
Return ct.Copyright
End Get
End Property
Public ReadOnly Property Company() As String
Get
Dim at As Type = GetType(AssemblyCompanyAttribute)
Dim r() As Object = myType.Assembly.GetCustomAttributes(at, False)
Dim ct As AssemblyCompanyAttribute = CType(r(0), AssemblyCompanyAttribute)
Return ct.Company
End Get
End Property
Public ReadOnly Property Description() As String
Get
Dim at As Type = GetType(AssemblyDescriptionAttribute)
Dim r() As Object = myType.Assembly.GetCustomAttributes(at, False)
Dim da As AssemblyDescriptionAttribute = CType(r(0), AssemblyDescriptionAttribute)
Return da.Description
End Get
End Property
Public ReadOnly Property Product() As String
Get
Dim at As Type = GetType(AssemblyProductAttribute)
Dim r() As Object = myType.Assembly.GetCustomAttributes(at, False)
Dim pt As AssemblyProductAttribute = CType(r(0), AssemblyProductAttribute)
Return pt.Product
End Get
End Property
Public ReadOnly Property Title() As String
Get
Dim at As Type = GetType(AssemblyTitleAttribute)
Dim r() As Object = myType.Assembly.GetCustomAttributes(at, False)
Dim ta As AssemblyTitleAttribute = CType(r(0), AssemblyTitleAttribute)
Return ta.Title
End Get
End Property
Public ReadOnly Property Version() As String
Get
Return myType.Assembly.GetName.Version.ToString()
End Get
End Property
CMIC 2003-07-15
  • 打赏
  • 举报
回复
using System.Reflection.Assembly
using System.Diagnostics.FileVersionInfo
GetExecutingAssembly.GetName.Name
GetExecutingAssembly.Location
GetVersionInfo(GetExecutingAssembly.Location).ProductMajorPart
GetVersionInfo(GetExecutingAssembly.Location).ProductMinorPart
GetVersionInfo(GetExecutingAssembly.Location).ProductBuildPart
GetVersionInfo(GetExecutingAssembly.Location).LegalCopyright
GetVersionInfo(GetExecutingAssembly.Location).LegalTrademarks
GetVersionInfo(GetExecutingAssembly.Location).CompanyName












jackyhzzjcn 2003-07-15
  • 打赏
  • 举报
回复
string filepath = Server.MapPath("bin/ProjectName.dll");
System.Diagnostics.FileVersionInfo myFileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(filepath);
Response.Write(myFileVersionInfo.FileVersion);
jackyhzzjcn 2003-07-15
  • 打赏
  • 举报
回复
非常感谢各位,一会我试试,回来结贴 :)

110,571

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧