Null reference exception when using mdtool to build an .xproj
mrward opened this issue · 1 comments
mrward commented
mdtool build src/Autofac/Autofac.xproj
FATAL ERROR [2015-12-10 09:04:55Z]: System.NullReferenceException: Object reference not set to an instance of an object
at MonoDevelop.Dnx.DnxProjectService.GetDiagnostics (MonoDevelop.Dnx.DnxProjectBuilder builder) <0x407ccde0 + 0x000c7> in :0
at MonoDevelop.Dnx.DnxProjectBuilder.Build () <0x407cccc0 + 0x00027> in :0
at MonoDevelop.Dnx.DnxProject.OnRunTarget (IProgressMonitor monitor, System.String target, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc800 + 0x00087> in :0
at MonoDevelop.Projects.DefaultProjectServiceExtension.RunTarget (IProgressMonitor monitor, IBuildTarget item, System.String target, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc630 + 0x00126> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc5e0 + 0x00046> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, IBuildTarget item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc0a0 + 0x000ae> in :0
at MonoDevelop.Projects.ProjectServiceExtension.RunTarget (IProgressMonitor monitor, IBuildTarget item, System.String target, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cbfb0 + 0x00062> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc5e0 + 0x00046> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, IBuildTarget item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc0a0 + 0x000ae> in :0
at MonoDevelop.Projects.ProjectServiceExtension.RunTarget (IProgressMonitor monitor, IBuildTarget item, System.String target, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cbfb0 + 0x00062> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc5e0 + 0x00046> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, IBuildTarget item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc0a0 + 0x000ae> in :0
at MonoDevelop.Projects.ProjectServiceExtension.RunTarget (IProgressMonitor monitor, IBuildTarget item, System.String target, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cbfb0 + 0x00062> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc5e0 + 0x00046> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, IBuildTarget item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc0a0 + 0x000ae> in :0
at MonoDevelop.Projects.ProjectServiceExtension.RunTarget (IProgressMonitor monitor, IBuildTarget item, System.String target, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cbfb0 + 0x00062> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc5e0 + 0x00046> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, IBuildTarget item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc0a0 + 0x000ae> in :0
at MonoDevelop.Projects.ProjectServiceExtension.RunTarget (IProgressMonitor monitor, IBuildTarget item, System.String target, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cbfb0 + 0x00062> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc5e0 + 0x00046> in :0
at MonoDevelop.Projects.CustomCommandExtension.Build (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem entry, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc260 + 0x0012b> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, IBuildTarget item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc0a0 + 0x000ae> in :0
at MonoDevelop.Projects.ProjectServiceExtension.RunTarget (IProgressMonitor monitor, IBuildTarget item, System.String target, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cbfb0 + 0x00062> in :0
at MonoDevelop.Projects.SolutionItem.RunTarget (IProgressMonitor monitor, System.String target, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cbf50 + 0x0004d> in :0
at MonoDevelop.Projects.BuildTool.Run (System.String[] arguments) <0x40771fa0 + 0x008ed> in :0
at MonoDevelopProcessHost.Main (System.String[] args) <0x406c9d50 + 0x00745> in :0
``
The problem is that 'projectSystem' == null in MonoDevelop.Dnx.DnxProjectService.GetDiagnostics.
The underlying problem is that the addin does not support building from the command line using mdtool or xbuild. Microsoft provide their own MSBuild targets and tasks that allow MSBuild to build from the command line. The addin does not have these and cannot ship them. The only way to currently build the project is from within MonoDevelop.
mrward commented
This is no longer a problem with the latest version of the addin since .NET Core now generates an assembly on disk.
mdtool.exe build src\net1consoleapp\net1consoleapp.xproj
Xamarin Studio Build Tool
Building: net1consoleapp (Debug)
Project net1consoleapp (.NETCoreApp,Version=v1.0) will be compiled because
expected outputs are missing
Compiling net1consoleapp for .NETCoreApp,Version=v1.0
Compilation succeeded.
0 Warning(s)
0 Error(s)
Time elapsed 00:00:01.8931514