Changing assemblyVersion adds version to Application.LoadComponent causing compile errors

Viewed 82

I have a C# WPF application. It uses a small commercial framework (https://www.inosoft.com/en/product/product-features/).

I'm building this application both locally and via a buildserver (Azure pipelines). I use a marketplace task to change the assemblyinfo.cs before building: https://marketplace.visualstudio.com/items?itemName=bleddynrichards.Assembly-Info-Task

The build server executes the following tasks:

  • NuGet restore
  • Inject/Edit assemblyVersion, AssemblyFileVersion and AssemblyInformationalVersion with the right version info
  • Build

Now when I run this application, it starts up and runs for a while. Quickly after starting I hook the VS debugger into the process. Then all of the sudden the application crashes:

This is weird, because when I build locally, this runtime error does not occur. Note that i set all properties to the same values for testing:

AssemblyVersion: 1.2.3.4
AssemblyFileVersion: 5.6.7.8
AssemblyInformationalVersion: 9.10.11.12

I then use Telerik justAssembly to compare the build output from my local build and the buildserver: enter image description here

As we can see the local output (on the left) does not have a version added to the Application.LoadComponent(..) whilst the build server output (on the right) does.

public void InitializeComponent()
        {
            if (!this._contentLoaded)
            {
                this._contentLoaded = true;
                Application.LoadComponent(this, new Uri("/HmiMetis;component/views/app.xaml", UriKind.Relative));
            }
        }

This means that this is the root cause of the runtime exception.

I find it weird that the build process on my local machine differs from the build server output. Both (should) use visual studio 2017 to build. Why does the buildserver add the version to the uri of loadComponent and my local machine does not?

Anyways, I need this exception gone. Therefore I think the easiest way would be to force the buildserver to not add the version information under any circumstances. Is this possible and how?

Edit: I Found a relating issue report that may have something to do with this: https://github.com/dotnet/core/issues/3189

0 Answers
Related