msbuild: Creating a Microsoft.Build.Evaluation.Project with an SDK fails with an "Internal MSBuild Error"

Microsoft Visual Studio Enterprise 2017 Int Preview Version 15.6.0 Preview 5.0 [27411.0.d15.6]

  1. Run the following:

           var projectRootElement = @"
<Project Sdk=""Microsoft.NET.Sdk"">

</Project>"

            var stringReader = new System.IO.StringReader(projectRootElement);
            var xmlReader = new XmlTextReader(stringReader);
            var root = ProjectRootElement.Create(xmlReader);
            var project = new Project(root);
Result StackTrace:	
at Microsoft.Build.Shared.ErrorUtilities.ThrowInternalError(String message, Object[] args)
   at Microsoft.Build.Shared.ErrorUtilities.VerifyThrow(Boolean condition, String unformattedMessage, Object arg0)
   at Microsoft.Build.Shared.AssemblyResources.GetStringFromEngineResources(String name)
   at Microsoft.Build.Shared.AssemblyResources.GetString(String name)
   at Microsoft.Build.BackEnd.Logging.LoggingService.LogWarningFromText(BuildEventContext buildEventContext, String subcategoryResourceName, String warningCode, String helpKeyword, BuildEventFileInfo file, String message)
   at Microsoft.Build.BackEnd.Logging.LoggingService.LogWarning(BuildEventContext buildEventContext, String subcategoryResourceName, BuildEventFileInfo file, String messageResourceName, Object[] messageArgs)
   at Microsoft.Build.BackEnd.SdkResolverLoader.LoadResolvers(LoggingContext loggingContext, ElementLocation location)
   at Microsoft.Build.BackEnd.SdkResolution.Initialize(LoggingContext loggingContext, ElementLocation location)
   at Microsoft.Build.BackEnd.SdkResolution.GetSdkPath(SdkReference sdk, LoggingContext loggingContext, ElementLocation sdkReferenceLocation, String solutionPath, String projectPath)
   at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List`1& projects, Boolean throwOnFileNotExistsError)
   at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement)
   at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
   at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
   at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(ILoggingService loggingService, BuildEventContext buildEventContext)
   at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(IEvaluatorData`4 data, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary`1 environmentProperties, ILoggingService loggingService, IItemFactory`2 itemFactory, IToolsetProvider toolsetProvider, ProjectRootElementCache projectRootElementCache, BuildEventContext buildEventContext, ProjectInstance projectInstanceIfAnyForDebuggerOnly, SdkResolution sdkResolution)
   at Microsoft.Build.Evaluation.Project.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings)
   at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings)
   at Microsoft.Build.Evaluation.Project.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings)
   at Microsoft.Build.Evaluation.Project..ctor(ProjectRootElement xml, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings)
   at Microsoft.Build.Evaluation.Project..ctor(ProjectRootElement xml)
   at Microsoft.VisualStudio.ProjectSystem.VS.Input.Commands.Ordering.OrderingHelperTests.MoveDownFolder_ContainsNestedFolder_IsSuccessful()
Result Message:	Microsoft.Build.Shared.InternalErrorException : MSB0001: Internal MSBuild Error: Missing resource ''

This is failing all our tests that use MSBuild.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (10 by maintainers)

Commits related to this issue

Most upvoted comments

I am using 15.1.548 and have started seeing this since updating my VS to 15.6. Not sure if thats a coincidence

Output:

Message: Microsoft.Build.Shared.InternalErrorException : MSB0001: Internal MSBuild Error: Missing resource ‘’

Test Name: DnnVsProjectSystem.BuildTools.Tests.ManifestBuildTests.Replaces_Tokens_In_Manifest Test FullName: DnnVsProjectSystem.BuildTools.Tests.ManifestBuildTests.Replaces_Tokens_In_Manifest Test Source: E:\Repos\DnnVsProjectSystem\src\DnnVsProjectSystem.BuildTools.Tests\ManifestBuildTests.cs : line 88 Test Outcome: Failed Test Duration: 0:00:01.462

Result StackTrace:

at Microsoft.Build.Shared.ErrorUtilities.ThrowInternalError(String message, Object[] args) at Microsoft.Build.Shared.ErrorUtilities.VerifyThrow(Boolean condition, String unformattedMessage, Object arg0) at Microsoft.Build.Shared.AssemblyResources.GetStringFromEngineResources(String name) at Microsoft.Build.Shared.AssemblyResources.GetString(String name) at Microsoft.Build.BackEnd.Logging.LoggingService.LogWarningFromText(BuildEventContext buildEventContext, String subcategoryResourceName, String warningCode, String helpKeyword, BuildEventFileInfo file, String message) at Microsoft.Build.BackEnd.Logging.LoggingService.LogWarning(BuildEventContext buildEventContext, String subcategoryResourceName, BuildEventFileInfo file, String messageResourceName, Object[] messageArgs) at Microsoft.Build.BackEnd.SdkResolverLoader.LoadResolvers(LoggingContext loggingContext, ElementLocation location) at Microsoft.Build.BackEnd.SdkResolution.Initialize(LoggingContext loggingContext, ElementLocation location) at Microsoft.Build.BackEnd.SdkResolution.GetSdkPath(SdkReference sdk, LoggingContext loggingContext, ElementLocation sdkReferenceLocation, String solutionPath, String projectPath) at Microsoft.Build.Evaluation.Evaluator4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List1& projects, Boolean throwOnFileNotExistsError) at Microsoft.Build.Evaluation.Evaluator4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement) at Microsoft.Build.Evaluation.Evaluator4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement) at Microsoft.Build.Evaluation.Evaluator4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport) at Microsoft.Build.Evaluation.Evaluator4.Evaluate(ILoggingService loggingService, BuildEventContext buildEventContext) at Microsoft.Build.Evaluation.Evaluator4.Evaluate(IEvaluatorData4 data, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary1 environmentProperties, ILoggingService loggingService, IItemFactory2 itemFactory, IToolsetProvider toolsetProvider, ProjectRootElementCache projectRootElementCache, BuildEventContext buildEventContext, ProjectInstance projectInstanceIfAnyForDebuggerOnly, SdkResolution sdkResolution) at Microsoft.Build.Evaluation.Project.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings) at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings) at Microsoft.Build.Evaluation.Project.Initialize(IDictionary2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings) at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings) at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary2 globalProperties, String toolsVersion) at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName) at DnnVsProjectSystem.BuildTools.Tests.MsBuildHelper.Build(String fileName, Action1 configure, String& consoleOutput) in E:\Repos\DnnVsProjectSystem\src\DnnVsProjectSystem.BuildTools.Tests\Util\MsBuildHelper.cs:line 108 at DnnVsProjectSystem.BuildTools.Tests.ManifestBuildTests.BuildTestProject(String projectFileName, Boolean assertIsSuccess, Action1 onBeforeBuild, String& consoleOutput) in E:\Repos\DnnVsProjectSystem\src\DnnVsProjectSystem.BuildTools.Tests\ManifestBuildTests.cs:line 198 at DnnVsProjectSystem.BuildTools.Tests.ManifestBuildTests.WhenProjectIsBuilt(String projectName, Boolean assertSuccess, Action1 assert) in E:\Repos\DnnVsProjectSystem\src\DnnVsProjectSystem.BuildTools.Tests\ManifestBuildTests.cs:line 136 at DnnVsProjectSystem.BuildTools.Tests.ManifestBuildTests.Replaces_Tokens_In_Manifest() in E:\Repos\DnnVsProjectSystem\src\DnnVsProjectSystem.BuildTools.Tests\ManifestBuildTests.cs:line 89 Result Message: Microsoft.Build.Shared.InternalErrorException : MSB0001: Internal MSBuild Error: Missing resource ‘’