0

I have a project that builds properly, but fails in Teamcity. Since Teamcity relies on MSBuild, I ran msbuild manually to see the problem.

So, I take the .net 4.7 / asp.net / core .net 2.0 project and clone it into 2 folders:

On one, I do a build and publish with VS: no errors

On the other folder, I do:

msbuild Test.sln /p:Configuration=Release /p:Platform="Any CPU" /t:publish

and I get 2 errors (twice the same for different libs)

C:\Program Files\dotnet\sdk\2.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Publish.targets(249, 5): error MSB4018: The "ResolvePublishAssemblies" task failed unexpectedly.
System.ArgumentNullException: Value cannot be null.
Parameter name: path1
   at System.IO.Path.Combine(String path1, String path2)
   at Microsoft.NET.Build.Tasks.PublishAssembliesResolver.<GetResolvedFiles>d__7.MoveNext()
   at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
   at Microsoft.NET.Build.Tasks.PublishAssembliesResolver.Resolve(ProjectContext projectContext)
   at Microsoft.NET.Build.Tasks.ResolvePublishAssemblies.ExecuteCore()
   at Microsoft.NET.Build.Tasks.TaskBase.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

I can't really find good info since everything about this error is about beta versions of .net 2.0

Any idea?

Thomas
  • 10,933
  • 14
  • 65
  • 136
  • it would help to get a diagnostic or binary log from the build. could you add `/bl` to the command and upload the resulting `msbuild.binlog` file? You could even open an issue at https://github.com/dotnet/sdk about it since this is where the failing task comes from. – Martin Ullrich Aug 25 '17 at 20:47
  • I just did the same post on on their github (https://github.com/dotnet/sdk/issues/1542) I will post any answers here. – Thomas Aug 26 '17 at 11:59
  • Are you using the latest version of .NET 2.0 (not beta)? – Dávid Molnár Aug 27 '17 at 11:51
  • Can try this command? `msbuild Test.sln /p:DeployOnBuild=true /p:PublishProfile= /p:Configuration=Release /p:Platform="Any CPU" ` – Dávid Molnár Aug 27 '17 at 11:52
  • yes, I'm using the final version of .NET 2.0 – Thomas Aug 27 '17 at 11:53

1 Answers1

0

This was resolved through information from:

dotnet restore vs. nuget restore with teamcity

I had another project with different errors, but similar problems and the information posted there allowed to solve both.

Thomas
  • 10,933
  • 14
  • 65
  • 136
  • thanks for sharing your solution here, you could mark it as the answer, so it could help other community members who get the same issues. – Leo Liu Aug 30 '17 at 05:15