我在Visual 2015中有一个旧的“网页”项目,我正在尝试添加一个版本。我在我的AssemblyInfo.vb文件夹下创建了我的App_Code文件,其中包含以下内容.
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中获得我最喜欢的扩展之一,帮助我更新每个构建的版本。我已经安排好了所以我有以下几点..。

它看起来很好,就像我在我的其他项目中设置它一样,并且我已经确认到组装的路径是100%正确的等等。
由于某些原因,当我构建或发布网页时,它将永远不会更新版本。即使是自动版本日志也是空白的。知道我可能做错了什么吗?

发布于 2018-08-09 16:46:18
乍一看,这条路径似乎有点偏离了AssemblyInfo。因为您是在项目级别上设置值,所以路径是相对于项目的,所以我认为您可以简单地说是.\App_Code\AssemblyInfo.vb。或者,我相信如果AssemblyInfo.vb项目位于"Properties“文件夹中,那么您甚至不必指定路径。
https://stackoverflow.com/questions/51433000
复制相似问题