building using MSBuild fails

meiru

New member
Joined
Dec 7, 2022
Messages
4
Programming Experience
10+
I try to compile a project directly from the command line with MSBuild (I do this all the time and it works great... but now I tried this for the first time with a project that contains XAML and this seems to cause problems).

So... VS 2019 C#... compiling the project works fine. But when I try to do it with MSBuild alone, the compiler crashes with a MC1000 "the object reference was not set to an object instance". When I read the logs, I can see that this happens before the crash

Code:
2:Die MarkupCompilePass1-Aufgabe aus der PresentationBuildTasks, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35-Assembly wird verwendet.
2:

2:Microsoft (R) Buildaufgabe "MarkupCompilePass1" Version 4.8.4084.0 built by: NET48REL1.
2:Copyright (C) Microsoft Corporation 2005. Alle Rechte vorbehalten.
2:

2:Aktuelles Projektverzeichnis: "X:\Build_Test\GuiBuilder(1.0)\GuiBuilder(1.0)_v1_0_1_0\Gui\VSWizardGui\".
2:Analyseergebnis: All.
2:Neukompilierte XAML-Datei: "X:\Build_Test\GuiBuilder(1.0)\GuiBuilder(1.0)_v1_0_1_0\Gui\VSWizardGui\DialogClassPage.xaml".
2:Neukompilierte XAML-Datei: "X:\Build_Test\GuiBuilder(1.0)\GuiBuilder(1.0)_v1_0_1_0\Gui\VSWizardGui\SinglePageWizard.xaml".
2:Neukompilierte XAML-Datei: "X:\Build_Test\GuiBuilder(1.0)\GuiBuilder(1.0)_v1_0_1_0\Gui\VSWizardGui\Themes\DialogTheme.xaml".
2:Neukompilierte XAML-Datei: "X:\Build_Test\GuiBuilder(1.0)\GuiBuilder(1.0)_v1_0_1_0\Gui\VSWizardGui\WizardPageClassPage.xaml".
2:Markupkompilierung wurde gestartet.
2:OutputType: "library".
2:Eingabe: Assembly Reference-Datei: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\Microsoft.CSharp.dll".
2:Eingabe: Assembly Reference-Datei: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VSSDK\VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.ImageCatalog.dll".
2:Eingabe: Assembly Reference-Datei: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VSSDK\VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Imaging.dll".
2:Eingabe: Assembly Reference-Datei: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.Shell.15.0.dll".
2:Eingabe: Assembly Reference-Datei: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\mscorlib.dll".
2:Eingabe: Assembly Reference-Datei: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\PresentationCore.dll".
2:Eingabe: Assembly Reference-Datei: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\PresentationFramework.dll".
2:Eingabe: Assembly Reference-Datei: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Core.dll".
2:Eingabe: Assembly Reference-Datei: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Data.DataSetExtensions.dll".
2:Eingabe: Assembly Reference-Datei: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Data.dll".
2:Eingabe: Assembly Reference-Datei: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.dll".
2:Eingabe: Assembly Reference-Datei: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Net.Http.dll".
2:Eingabe: Assembly Reference-Datei: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Xaml.dll".
2:Eingabe: Assembly Reference-Datei: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Xml.dll".
2:Eingabe: Assembly Reference-Datei: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Xml.Linq.dll".
2:Eingabe: Assembly Reference-Datei: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\WindowsBase.dll".
2:Das Ziel "_SGenCheckForOutputs" wurde übersprungen, da die Bedingung "false" war . ('$(_SGenGenerateSerializationAssembliesConfig)' == 'On' or ('@(WebReferenceUrl)'!='' and '$(_SGenGenerateSerializationAssembliesConfig)' == 'Auto')) wurde als ('Off' == 'On' or (''!='' and 'Off' == 'Auto')) ausgewertet.

and here starts the difference between an MSBuild and a Visual Studio run... after this line with WindowsBase.dll, Visual Studio continues with listing all the "Facades" dlls... e.g.
Code:
1>  Eingabe: Assembly Reference-Datei: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\Facades\System.Diagnostics.FileVersionInfo.dll".
but MSBuild alone crashes... I'm not sure why. Or what I could try or where I should start searching.

Rudolf
 
Last edited by a moderator:
First thing I would try is to make sure I was using the latest version of MSBuild. You seem to be using an old version from 2005.
 
First thing I would try is to make sure I was using the latest version of MSBuild. You seem to be using an old version from 2005.

Why do you think that? I'm explicitly using the MSBuild of Visual Studio 2019 (must be Version 15.9 or something). The 2005 copyright comes from the MarkupCompilePass1 and that's like this even in the latest version of Visual Studio 2019.
 
Sorry. I don't read German.
 
As I recall, MSBuild has some command line parameters to give more verbose output as well as show more diagnostics. I would try running with those. Also try building single threaded instead of multi threaded.

Debugging MSBuild projects can be painful, but it not as bad as trying to debug makefiles or jamfiles.
 
Back
Top Bottom