The solution compiles successfully until we add the reference to one of the following assemblies:
Microfoft.Dynamics.Ax.Framework.Linq.Data
Microfoft.Dynamics.Ax.Framework.Linq.Data.AdoNet
Microfoft.Dynamics.Ax.Framework.Linq.Data.Msil
Microsoft.Dynamics.Ax.Data.Core
Microsoft.Dynamics.Ax.Server.Core
Microsoft.Dynamics.AX.Xpp.AxShared
Microsoft.Dynamics.AX.Xpp.Support
In that case we get the following error
Severity Code Description Project File Line Suppression State
Error The /ResolveAssemblyReference/ task failed unexpectedly.
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Build.Tasks.ReferenceTable.GetReference(AssemblyNameExtension assemblyName)
at Microsoft.Build.Tasks.Reference.SetFinalCopyLocalState(AssemblyNameExtension assemblyName, String[] frameworkPaths, ProcessorArchitecture targetProcessorArchitecture, GetAssemblyRuntimeVersion getRuntimeVersion, Version targetedRuntimeVersion, FileExists fileExists, GetAssemblyPathInGac getAssemblyPathInGac, Boolean copyLocalDependenciesWhenParentReferenceInGac, Boolean doNotCopyLocalIfInGac, ReferenceTable referenceTable)
at Microsoft.Build.Tasks.ReferenceTable.GetReferenceItems(ITaskItem[]& primaryFiles, ITaskItem[]& dependencyFiles, ITaskItem[]& relatedFiles, ITaskItem[]& satelliteFiles, ITaskItem[]& serializationAssemblyFiles, ITaskItem[]& scatterFiles, ITaskItem[]& copyLocalFiles)
at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute(FileExists fileExists, DirectoryExists directoryExists, GetDirectories getDirectories, GetAssemblyName getAssemblyName, GetAssemblyMetadata getAssemblyMetadata, GetRegistrySubKeyNames getRegistrySubKeyNames, GetRegistrySubKeyDefaultValue getRegistrySubKeyDefaultValue, GetLastWriteTime getLastWriteTime, GetAssemblyRuntimeVersion getRuntimeVersion, OpenBaseKey openBaseKey, GetAssemblyPathInGac getAssemblyPathInGac, IsWinMDFile isWinMDFile, ReadMachineTypeFromPEHeader readMachineTypeFromPEHeader)
at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
What could be a cause of the error and how to fix it?