w0051977
w0051977

Reputation: 15807

.NET versioning - no error

I have read that versioning can be a problem if a project is split into multiple DLLs. I am trying to introduce a versioning problem to understand what it means. I have two simple projects i.e. a windows forms application and a class library. Here is the form:

Imports ClassLibrary1

Public Class Form1

    Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        Dim c1 As Class1 = New class1
        c1.TEST()
    End Sub
End Class

Here is the class library:

Public Class Class1
    Public Sub TEST()
        MsgBox("TEST1")
    End Sub
End Class

Please see the version number of the windows form app below:

enter image description here

Please see the version of the class library below:

enter image description here

When I build the project I get an executable and a DLL as expected. I have followed these steps in an attempt to introduce a versioning problem:

 1) Build the project
 2) Go to the bin folder and create a copy of debug/WindowsApplication1.exe 
 3) Go into the DLL properties and change the DLL version in Visual Studio
 4) Rebuild the project
 5) Overwrite the .EXE in the BIN folder (debug/WindowsApplication1.exe) with the .EXE copied in step 2
 6) Launch the .EXE in the bin folder

I thought I would see an error at step five as an old version of the .exe is using the new DLL. However, the program runs as expected. What am I missing? I realise this is a basic question. I have Googled it this afternoon.

Upvotes: 0

Views: 80

Answers (1)

granadaCoder
granadaCoder

Reputation: 27874

The GUID is the more important part. Open up your vbproj file (or csproj file for future readers) and see how the .EXE vbproj references the .DLL project.

The numbers (on the version) which you are changing .... are kinda like friendly FYI's.

If the GUID matches and there are not breaking changes, your old exe can use the new dll and vice versa.

  <ItemGroup>
    <ProjectReference Include="..\MyDll\MyDll.csproj">
      <Project>{33333333-3333-3333-3333-33333333333}</Project>
      <Name>MyDll</Name>
    </ProjectReference>
  </ItemGroup>

EDIT:

You may want to try:

Changing the signature of your method.

Public Sub TEST(s as String)
    MsgBox("TEST1")
End Sub

Or change the name (which is the same as removing it)

Public Sub TEST1()
    MsgBox("TEST1 Msg")
End Sub

Or change the GUID of the "DLL" project in the project properties (that you already know about from your screen shot above)

Upvotes: 2

Related Questions