【发布时间】:2018-07-19 23:20:32
【问题描述】:
我在 Visual Studio 2015 中有一个旧的“网页”项目,我正在尝试添加一个版本。我在 App_Code 文件夹下创建了 AssemblyInfo.vb 文件,其中包含以下内容...
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("MyWebSite")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("MyWebSite")>
<Assembly: AssemblyCopyright("Copyright © MyCompany 2018")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.2.3.4")>
<Assembly: AssemblyFileVersion("1.2.3.4")>
在我的网站上,我有一个 Template.master 引用...
<asp:Literal runat="server" ID="Version"></asp:Literal>
在我的网站上,我还有一个 Template.master.vb 包含...
Dim assembly As Assembly = Assembly.Load("App_Code")
Dim ver As Version = assembly.GetName().Version
Version.Text = "Version: " + ver.Major.ToString() + "." + ver.Minor.ToString() + "." + ver.Revision.ToString() + " build (" + ver.Build.ToString() + ")"
现在,当我构建我的网站时,它看起来与我预期的完全一样,如下所示...
版本:1.2.4 构建 (3)
现在我已经完成了所有设置,我希望在 Visual Studio 中获得我最喜欢的扩展之一,以帮助我更新每个构建的版本。我已经设置好了,所以我有以下...
看起来不错,就像我在其他项目中设置的一样,并且我已经确认程序集的路径是 100% 正确的等等。
【问题讨论】:
标签: asp.net vb.net visual-studio-2015 .net-assembly versioning