繁体   English   中英

Web页面项目上Visual Studio的自动版本

[英]Automatic Versions for Visual Studio on Web Page project

我在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 Build(3)

现在,我已经完成了所有设置,希望能够在Visual Studio中获得我最喜欢的扩展之一,以帮助我更新每个版本的版本。 我已经设置好了,所以我有以下内容... 在此处输入图片说明

看起来就像我在其他项目中设置的一样,并且我确认装配的路径是100%正确等。

由于某些原因,当我构建或发布网页时,它将永远不会更新版本。 甚至“自动版本”日志也为空。 有什么想法我可能做错了吗? 在此处输入图片说明

乍一看,似乎到AssemblyInfo的路径略有偏离。 由于您是在项目级别设置值,因此路径是相对于项目的,因此我认为您可以只说。\\ App_Code \\ AssemblyInfo.vb。 另外,我相信,如果AssemblyInfo.vb项目位于“属性”文件夹中,那么您甚至不必指定路径。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM