1

I cannot see why the below build is failing.

The project builds successfully.

What could "##[error]Unexpected exit code received from msbuild.exe: 1" result from in the below output?

 Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\tasks\VSBuild\1.0.13\VSBuild.ps1
 C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe "C:\a\8ac4a4f6\Root\src\MyProject.Api\MyProject.Api.xproj" /nologo /m /nr:false /fl /flp:"logfile=C:\a\8ac4a4f6\Root\src\MyProject.Api\MyProject.Api.xproj.log" /dl:CentralLogger,"C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agent\worker\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll"*ForwardingLogger,"C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agent\worker\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /t:Build,FileSystemPublish /p:PublishConfiguration=release /p:PublishOutputPathNoTrailingSlash=C:\a\8ac4a4f6\Root\MyProject\artifacts\bin\release\Publish /p:platform="any cpu" /p:configuration="release" /p:VisualStudioVersion="14.0"
 Build started 8/3/2015 9:27:34 AM.
      1>Project "C:\a\8ac4a4f6\Root\src\MyProject.Api\MyProject.Api.xproj" on node 1 (Build;FileSystemPublish target(s)).
      1>PrepareForBuild:
          Creating directory "..\artifacts\bin\MyProject.Api\".
          Creating directory "..\artifacts\obj\MyProject.Api\any cpu\release\".
        PreComputeCompileTypeScript:
          C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.4\tsc.exe  --noEmitOnError COMPUTE_PATHS_ONLY
        CompileTypeScript:
        Skipping target "CompileTypeScript" because it has no outputs.
        CoreCompile:
          C:\Users\buildguest\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta6\bin\dnx.exe --appbase "C:\a\8ac4a4f6\Root\src\MyProject.Api" "C:\Users\buildguest\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta6\bin\lib\Microsoft.Framework.PackageManager\Microsoft.Framework.PackageManager.dll" pack "C:\a\8ac4a4f6\Root\src\MyProject.Api" --configuration release --out "..\artifacts\bin\MyProject.Api"
          Microsoft .NET Development Utility CLR-x86-1.0.0-beta6-12256
          Building MyProject.Api for DNX,Version=v4.5.1
            Using Project dependency MyProject.Api 1.0.0
              Source: C:\a\8ac4a4f6\Root\src\MyProject.Api\project.json
            Using Project dependency MyProject.Domain.Model 1.0.0
              Source: C:\a\8ac4a4f6\Root\src\MyProject.Domain.Model\project.json
            ... (deleted for readability)
            Using Assembly dependency framework/fx/mscorlib 4.0.0.0
              Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\mscorlib.dll
            Using Assembly dependency framework/fx/System 4.0.0.0
              Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.dll
            ... (deleted for readability)
          The following commands will not be exported for global install: web.
          MyProject.Api -> C:\a\8ac4a4f6\Root\src\artifacts\bin\MyProject.Api\release\MyProject.Api.1.0.0.nupkg
          MyProject.Api -> C:\a\8ac4a4f6\Root\src\artifacts\bin\MyProject.Api\release\MyProject.Api.1.0.0.symbols.nupkg
          Build succeeded.
              0 Warning(s)
              0 Error(s)
          Time elapsed 00:00:09.0953302
          Total build time elapsed: 00:00:09.1660739
          Total projects built: 1
        GetTypeScriptCopyToOutputDirectoryItems:
          Adding items with BuildAction=TypeScriptCompile to the same collections that will be populated (with items of other BuildActions) by the GetCopyToOutputDirectoryItems target
        GatherAllFilesToPublish:
          Environment variables:
          Path=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\extensions\microsoft\web tools\external;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Users\VssAdministrator\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\Microsoft Emulator Manager\1.0\;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.4\;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;C:\NPM\Modules;C:\Program Files\nodejs\;C:\NPM\Modules;C:\cordova;C:\java\ant\apache-ant-1.9.4\bin;;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\extensions\microsoft\web tools\external\.git
          C:\Users\buildguest\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta6\bin\dnu.cmd publish "C:\a\8ac4a4f6\Root\src\MyProject.Api" --out "C:\a\8ac4a4f6\Root\MyProject\artifacts\bin\release\Publish" --configuration release --runtime dnx-clr-win-x86.1.0.0-beta6 --quiet
          Microsoft .NET Development Utility CLR-x86-1.0.0-beta6-12256
          Copying to output path C:\a\8ac4a4f6\Root\MyProject\artifacts\bin\release\Publish
          Time elapsed 00:00:07.6405449
      1>Done Building Project "C:\a\8ac4a4f6\Root\src\MyProject.Api\MyProject.Api.xproj" (Build;FileSystemPublish target(s)) -- FAILED.
 Build FAILED.
     0 Warning(s)
     0 Error(s)
 Time Elapsed 00:00:19.07
 ##[error]Unexpected exit code received from msbuild.exe: 1

global.json:

{
  "sources": [ "src", "test" ],
  "sdk": {
    "version": "1.0.0-beta6",
    "runtime": "clr",
    "architecture": "x86"
  }
}

project.json:

{
  "webroot": "wwwroot",
  "version": "1.0.0-*",

  "dependencies": {
    "Microsoft.AspNet.Server.IIS": "1.0.0-beta6",
    "Microsoft.AspNet.Server.WebListener": "1.0.0-beta6",
    "Microsoft.AspNet.Mvc": "6.0.0-beta6"
  },

  "commands": {
    "web": "Microsoft.AspNet.Hosting --config hosting.ini"
  },

  "frameworks": {
    "dnx451": { }
  },

  "publishExclude": [
    "node_modules",
    "bower_components",
    "**.xproj",
    "**.user",
    "**.vspscc"
  ],
  "exclude": [
    "wwwroot",
    "node_modules",
    "bower_components"
  ]
}

EDIT:

Removing the following arguments from msbuild.exe leads to a successful build:

/t:Build,FileSystemPublish /p:PublishConfiguration=release /p:PublishOutputPathNoTrailingSlash=C:\a\8ac4a4f6\Root\MyProject\artifacts\bin\release\Publish

There is clearly something wrong with my publish arguments.

7
  • Do you have a postbuild step that invokes msbuild? Or a reference to a wrapped project? Commented Aug 3, 2015 at 0:49
  • @VictorHurdugaci: I don't believe so. I edited to included the entire build output above. You can now see how msbuild is being executed. Commented Aug 3, 2015 at 9:32
  • Can you share the project.json file? Commented Aug 3, 2015 at 15:34
  • @VictorHurdugaci: Edited. Thanks :) Commented Aug 3, 2015 at 15:41
  • Like I mentioned in you other question (stackoverflow.com/questions/31771495/…) try adding a build step that invokes a cmd file rather that using "Visual Studio Build". MsBuild is flaky with dnx projects Commented Aug 4, 2015 at 5:24

2 Answers 2

0

I found the issue.

The following was throwing the exception:

dnu.cmd publish "C:\a\8ac4a4f6\Root\src\MyProject.Api" --out "C:\a\8ac4a4f6\Root\MyProject\artifacts\bin\release\Publish" --configuration release --runtime dnx-clr-win-x86.1.0.0-beta6 --quiet

I ran it without the --quiet argument and out comes an ArgumentNullException:

Restoring packages for C:\a\8ac4a4f6\Root\src\RelatedProject\project.json
----------
System.ArgumentNullException: Value cannot be null.
Parameter name: key
   at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
   at Microsoft.Framework.Runtime.Project.GetTargetFramework(FrameworkName targetFramework)
   at Microsoft.Framework.Runtime.ProjectReferenceDependencyProvider.GetDescription(LibraryRange libraryRange, FrameworkName targetFramework)
   at Microsoft.Framework.PackageManager.LocalWalkProvider.FindLibrary(LibraryRange libraryRange, FrameworkName targetFramework, Boolean includeUnlisted)
   at Microsoft.Framework.PackageManager.RestoreOperations.<FindProjectMatch>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Framework.PackageManager.RestoreOperations.<FindLibraryMatch>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Framework.PackageManager.RestoreOperations.<FindLibraryEntry>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Framework.PackageManager.RestoreOperations.<CreateGraphNode>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Framework.PackageManager.RestoreCommand.<CreateGraphNode>d__71.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.Framework.PackageManager.RestoreCommand.<RestoreForProject>d__70.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Framework.PackageManager.RestoreCommand.<>c__DisplayClass69_0.<<Execute>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Framework.PackageManager.RestoreCommand.<Execute>d__69.MoveNext()
----------
Restore failed
Value cannot be null.
Parameter name: key

I removed the project dependency and it now works. I have no idea what the exception entails. Posted a question regarding that here.

Sign up to request clarification or add additional context in comments.

Comments

0

I also faced this issue. I am posting this answer if somebody has a similar issue then try this solution. My visual studio solution has projects targeting different versions of .NET Framework (one project .NET 4.5.1 and the others .NET 4.5.2). It also has a database project with Target Platform set as Sql Server 2016.

I had to make sure all the projects in my solution are targeting .NET 4.5.2 and the database project's Target Platform set as Sql Server 2012. It's because our build server has a different version of Visual studio installed. So check the target frame works for your projects as well as if you have database projects then make sure they're targeting correct version of Sql Server.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.