当我引用添加到我的项目,我通常要使用特定版本= FALSE。这是因为我们的自动构建将设置版本号。我看到的默认行为是为TRUE。

有没有办法来改变这种?计数上手动改变该值是容易出错(与我最终破坏构建)。

有帮助吗?

解决方案

有不更改默认的方式。如果你使用TFS你很可能在申请办理入住手续的规则,但我不确定是否签入规则可以被应用到的.csproj或.sln文件。

其他提示

创建外接程序项目,并尝试:

Imports Extensibility
Imports EnvDTE
Imports EnvDTE80
Imports VSLangProj
Imports VSLangProj80

Public Class Connect

    Implements IDTExtensibility2

    Private _app As DTE2
    Private WithEvents _RefEvents As ReferencesEvents

    '''<summary>Implements the constructor for the Add-in object. Place your initialization code within this method.</summary>
    Public Sub New()
    End Sub

    '''<summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
    '''<param name='application'>Root object of the host application.</param>
    '''<param name='connectMode'>Describes how the Add-in is being loaded.</param>
    '''<param name='addInInst'>Object representing this Add-in.</param>
    '''<remarks></remarks>
    Public Sub OnConnection(ByVal application As Object, ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, ByRef custom As Array) Implements IDTExtensibility2.OnConnection
        _app = CType(application, DTE2)
        _RefEvents = CType(_app.Events.GetObject("VBReferencesEvents"), ReferencesEvents)
    End Sub

    '''<summary>Implements the OnDisconnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being unloaded.</summary>
    '''<param name='disconnectMode'>Describes how the Add-in is being unloaded.</param>
    '''<param name='custom'>Array of parameters that are host application specific.</param>
    '''<remarks></remarks>
    Public Sub OnDisconnection(ByVal disconnectMode As ext_DisconnectMode, ByRef custom As Array) Implements IDTExtensibility2.OnDisconnection
    End Sub

    '''<summary>Implements the OnAddInsUpdate method of the IDTExtensibility2 interface. Receives notification that the collection of Add-ins has changed.</summary>
    '''<param name='custom'>Array of parameters that are host application specific.</param>
    '''<remarks></remarks>
    Public Sub OnAddInsUpdate(ByRef custom As Array) Implements IDTExtensibility2.OnAddInsUpdate
    End Sub

    '''<summary>Implements the OnStartupComplete method of the IDTExtensibility2 interface. Receives notification that the host application has completed loading.</summary>
    '''<param name='custom'>Array of parameters that are host application specific.</param>
    '''<remarks></remarks>
    Public Sub OnStartupComplete(ByRef custom As Array) Implements IDTExtensibility2.OnStartupComplete
    End Sub

    '''<summary>Implements the OnBeginShutdown method of the IDTExtensibility2 interface. Receives notification that the host application is being unloaded.</summary>
    '''<param name='custom'>Array of parameters that are host application specific.</param>
    '''<remarks></remarks>
    Public Sub OnBeginShutdown(ByRef custom As Array) Implements IDTExtensibility2.OnBeginShutdown
    End Sub

    Private Sub _RefEvents_ReferenceAdded(ByVal pReference As Reference) Handles _RefEvents.ReferenceAdded
        If pReference.Version <> "0.0.0.0" Then
            CType(pReference, Reference3).SpecificVersion = True
        End If
    End Sub
End Class

我会说你不应该与每个版本更改程序集的版本。您应该使用的文件版本用于这一目的。

苏珊·库克有一个很好的博客文章,详细解释它,但总结是,组装需要的文件版本不低于程序集的版本相同,为构建你需要该文件版本的全部时间,而不是所述组件版本。

苏珊库克的博客文章

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top