Error message
C:\packages\microsoft.net.sdk\1.0.0-alpha-20161104-2\build\Microsoft.NET.Publish.targets(230,5): error MSB4018: The "ResolvePublishAssemblies" task failed unexpectedly.\r [C:\Enlistments\vstest\src\vstest.console\vstest.console.csproj]
C:\packages\microsoft.net.sdk\1.0.0-alpha-20161104-2\build\Microsoft.NET.Publish.targets(230,5): error MSB4018: System.ArgumentNullException: Value cannot be null.\r [C:\Enlistments\vstest\src\vstest.console\vstest.console.csproj]
C:\packages\microsoft.net.sdk\1.0.0-alpha-20161104-2\build\Microsoft.NET.Publish.targets(230,5): error MSB4018: Parameter name: path1\r [C:\Enlistments\vstest\src\vstest.console\vstest.console.csproj]
C:\packages\microsoft.net.sdk\1.0.0-alpha-20161104-2\build\Microsoft.NET.Publish.targets(230,5): error MSB4018: at System.IO.Path.Combine(String path1, String path2)\r [C:\Enlistments\vstest\src\vstest.console\vstest.console.csproj]
C:\packages\microsoft.net.sdk\1.0.0-alpha-20161104-2\build\Microsoft.NET.Publish.targets(230,5): error MSB4018: at Microsoft.NET.Build.Tasks.PublishAssembliesResolver.<GetResolvedFiles>d__5.MoveNext()\r [C:\Enlistments\vstest\src\vstest.console\vstest.console.csproj]
C:\packages\microsoft.net.sdk\1.0.0-alpha-20161104-2\build\Microsoft.NET.Publish.targets(230,5): error MSB4018: at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)\r [C:\Enlistments\vstest\src\vstest.console\vstest.console.csproj]
C:\packages\microsoft.net.sdk\1.0.0-alpha-20161104-2\build\Microsoft.NET.Publish.targets(230,5): error MSB4018: at Microsoft.NET.Build.Tasks.PublishAssembliesResolver.Resolve(ProjectContext projectContext)\r [C:\Enlistments\vstest\src\vstest.console\vstest.console.csproj]
C:\packages\microsoft.net.sdk\1.0.0-alpha-20161104-2\build\Microsoft.NET.Publish.targets(230,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePublishAssemblies.ExecuteCore()\r [C:\Enlistments\vstest\src\vstest.console\vstest.console.csproj]
C:\packages\microsoft.net.sdk\1.0.0-alpha-20161104-2\build\Microsoft.NET.Publish.targets(230,5): error MSB4018: at Microsoft.NET.Build.Tasks.TaskBase.Execute()\r [C:\Enlistments\vstest\src\vstest.console\vstest.console.csproj]
C:\packages\microsoft.net.sdk\1.0.0-alpha-20161104-2\build\Microsoft.NET.Publish.targets(230,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()\r [C:\Enlistments\vstest\src\vstest.console\vstest.console.csproj]
C:\packages\microsoft.net.sdk\1.0.0-alpha-20161104-2\build\Microsoft.NET.Publish.targets(230,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__25.MoveNext() [C:\Enlistments\vstest\src\vstest.console\vstest.console.csproj]
Repro Step:
1) Restore project https://github.com/Microsoft/vstest/blob/master/src/vstest.console/vstest.console.csproj
2) Build project https://github.com/Microsoft/vstest/blob/master/src/vstest.console/vstest.console.csproj
3) publish for framework net46
Environment:
.NET Command Line Tools (1.0.0-preview5-004478)
Product Information:
Version: 1.0.0-preview5-004478
Commit SHA-1 hash: 4d3e287
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Base Path: C:\Users\faahmad\Desktop\dotnet-dev-win-x64.latest\sdk\1.0.0-preview5-004478
For dotnet CLI build 1.0.0-preview5-004384 it was working fine
I am having this same issue, but with both 1.0.0-preview5-004384 and 1.0.0-preview5-004478. With some help from [email protected], we determined that it seems to happen when you are referencing a library project. The library compiles fine, but the referencing project pukes that error.
This gist has a comparison between my csproj files not working and working: https://gist.github.com/damccull/487604c2751845c5d33d844d3246d379
As for the folder structure, I created a new DAL folder inside my web app and just copied all the lib files into that folder. Magically it all worked.
I was publishing for the 1.1 framework. The debug build worked fine always, just the release publish went wonky.
This prevents any app referencing a library project and is super simple to reproduce..
$ mkdir testlib && cd testlib
$ dotnet new -t lib
$ cd .. && mkdir testconsole && cd testconsole
$ dotnet new -t console1.1
$ dotnet add reference ../testlib/testlib.csproj
$ dotnet restore
$ dotnet publish
/usr/local/share/dotnet/sdk/1.0.0-preview5-004478/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(232,5): error MSB4018: The "ResolvePublishAssemblies" task failed unexpectedly. [/Users/martin/tmp/testconsole/testconsole.csproj]
/usr/local/share/dotnet/sdk/1.0.0-preview5-004478/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(232,5): error MSB4018: System.ArgumentNullException: Value cannot be null. [/Users/martin/tmp/testconsole/testconsole.csproj]
/usr/local/share/dotnet/sdk/1.0.0-preview5-004478/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(232,5): error MSB4018: Parameter name: path1 [/Users/martin/tmp/testconsole/testconsole.csproj]
/usr/local/share/dotnet/sdk/1.0.0-preview5-004478/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(232,5): error MSB4018: at System.IO.Path.Combine(String path1, String path2) [/Users/martin/tmp/testconsole/testconsole.csproj]
/usr/local/share/dotnet/sdk/1.0.0-preview5-004478/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(232,5): error MSB4018: at Microsoft.NET.Build.Tasks.PublishAssembliesResolver.<GetResolvedFiles>d__5.MoveNext() [/Users/martin/tmp/testconsole/testconsole.csproj]
/usr/local/share/dotnet/sdk/1.0.0-preview5-004478/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(232,5): error MSB4018: at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection) [/Users/martin/tmp/testconsole/testconsole.csproj]
/usr/local/share/dotnet/sdk/1.0.0-preview5-004478/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(232,5): error MSB4018: at Microsoft.NET.Build.Tasks.PublishAssembliesResolver.Resolve(ProjectContext projectContext) [/Users/martin/tmp/testconsole/testconsole.csproj]
/usr/local/share/dotnet/sdk/1.0.0-preview5-004478/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(232,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePublishAssemblies.ExecuteCore() [/Users/martin/tmp/testconsole/testconsole.csproj]
/usr/local/share/dotnet/sdk/1.0.0-preview5-004478/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(232,5): error MSB4018: at Microsoft.NET.Build.Tasks.TaskBase.Execute() [/Users/martin/tmp/testconsole/testconsole.csproj]
/usr/local/share/dotnet/sdk/1.0.0-preview5-004478/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(232,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/Users/martin/tmp/testconsole/testconsole.csproj]
/usr/local/share/dotnet/sdk/1.0.0-preview5-004478/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(232,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__25.MoveNext() [/Users/martin/tmp/testconsole/testconsole.csproj]
dotnet --info
.NET Command Line Tools (1.0.0-preview5-004478)
Product Information:
Version: 1.0.0-preview5-004478
Commit SHA-1 hash: 4d3e2872fe
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.12
OS Platform: Darwin
RID: osx.10.12-x64
Base Path: /usr/local/share/dotnet/sdk/1.0.0-preview5-004478
Looks like a nuget bug. The project.assets.json file now includes this:
},
"compile": {
"bin/placeholder/netstandard1.6/PackageClassifier.dll": {}
},
"runtime": {
"bin/placeholder/netstandard1.6/PackageClassifier.dll": {}
}
Looks like something isn't getting string.Replace'd
Diff: preview4 on the left, preview5 on the right

I believe this was fixed by https://github.com/dotnet/sdk/pull/608
cc @dsplaisted
@nguerrera That one sure does seem to be talking about this. It's merged into dev15-rc3. Will it get merged into master too at some point soon?
I manually patched my CLI with the 1.0.0-alpha-20170113-1 Microsoft.NET.Sdk. Seems to have fixed it. I assume dotnet/cli needs to update to this new build but just hasn't yet.
Thanks @natemcmaster. Closing as the fix is in the sdk already.
I can confirm that this now works out of the box with the following cli builds:
https://dotnetcli.blob.core.windows.net/dotnet/Sdk/1.0.0-rc3-004479/dotnet-dev-osx-x64.1.0.0-rc3-004479.pkg
https://dotnetcli.blob.core.windows.net/dotnet/Sdk/1.0.0-rc3-004479/dotnet-dev-win-x64.1.0.0-rc3-004479.exe
Hey guys,
It is indeed the issue with Microsoft.NET.Sdk, however how do I update to the latest?
I have this dependency
<PackageReference Include="Microsoft.NET.Sdk.Web">
<Version>1.0.0-*</Version>
</PackageReference>
and I cannot go any higher (version >1.0.0-* throws error).
How do I solve the issue?
Thanks in advance!
UPD: my error is this:
Microsoft (R) Build Engine version 15.1.548.43366
Copyright (C) Microsoft Corporation. All rights reserved.
shared -> /Users/dbogatov/Desktop/status-site/src/shared/bin/release/netcoreapp1.1/shared.dll
web -> /Users/dbogatov/Desktop/status-site/src/web/bin/release/netcoreapp1.1/web.dll
/Users/dbogatov/.nuget/packages/microsoft.net.sdk/1.0.0-alpha-20161104-2/build/Microsoft.NET.Publish.targets(230,5): error MSB4018: The "ResolvePublishAssemblies" task failed unexpectedly. [/Users/dbogatov/Desktop/status-site/src/web/web.csproj]
/Users/dbogatov/.nuget/packages/microsoft.net.sdk/1.0.0-alpha-20161104-2/build/Microsoft.NET.Publish.targets(230,5): error MSB4018: System.ArgumentNullException: Value cannot be null. [/Users/dbogatov/Desktop/status-site/src/web/web.csproj]
/Users/dbogatov/.nuget/packages/microsoft.net.sdk/1.0.0-alpha-20161104-2/build/Microsoft.NET.Publish.targets(230,5): error MSB4018: Parameter name: path1 [/Users/dbogatov/Desktop/status-site/src/web/web.csproj]
/Users/dbogatov/.nuget/packages/microsoft.net.sdk/1.0.0-alpha-20161104-2/build/Microsoft.NET.Publish.targets(230,5): error MSB4018: at System.IO.Path.Combine(String path1, String path2) [/Users/dbogatov/Desktop/status-site/src/web/web.csproj]
/Users/dbogatov/.nuget/packages/microsoft.net.sdk/1.0.0-alpha-20161104-2/build/Microsoft.NET.Publish.targets(230,5): error MSB4018: at Microsoft.NET.Build.Tasks.PublishAssembliesResolver.<GetResolvedFiles>d__5.MoveNext() [/Users/dbogatov/Desktop/status-site/src/web/web.csproj]
/Users/dbogatov/.nuget/packages/microsoft.net.sdk/1.0.0-alpha-20161104-2/build/Microsoft.NET.Publish.targets(230,5): error MSB4018: at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection) [/Users/dbogatov/Desktop/status-site/src/web/web.csproj]
/Users/dbogatov/.nuget/packages/microsoft.net.sdk/1.0.0-alpha-20161104-2/build/Microsoft.NET.Publish.targets(230,5): error MSB4018: at Microsoft.NET.Build.Tasks.PublishAssembliesResolver.Resolve(ProjectContext projectContext) [/Users/dbogatov/Desktop/status-site/src/web/web.csproj]
/Users/dbogatov/.nuget/packages/microsoft.net.sdk/1.0.0-alpha-20161104-2/build/Microsoft.NET.Publish.targets(230,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePublishAssemblies.ExecuteCore() [/Users/dbogatov/Desktop/status-site/src/web/web.csproj]
/Users/dbogatov/.nuget/packages/microsoft.net.sdk/1.0.0-alpha-20161104-2/build/Microsoft.NET.Publish.targets(230,5): error MSB4018: at Microsoft.NET.Build.Tasks.TaskBase.Execute() [/Users/dbogatov/Desktop/status-site/src/web/web.csproj]
/Users/dbogatov/.nuget/packages/microsoft.net.sdk/1.0.0-alpha-20161104-2/build/Microsoft.NET.Publish.targets(230,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/Users/dbogatov/Desktop/status-site/src/web/web.csproj]
/Users/dbogatov/.nuget/packages/microsoft.net.sdk/1.0.0-alpha-20161104-2/build/Microsoft.NET.Publish.targets(230,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__25.MoveNext() [/Users/dbogatov/Desktop/status-site/src/web/web.csproj]
UPD: here is the amount of hack I had to make to workaround :(
echo "Hack for web"
mkdir -p web/shared
cp -r shared/ web/shared
rm -rf web/shared/{shared.csproj,bin/,obj/}
sed '/<!-- REFERENCE -->/d' ./web/web.csproj > web/web.hack
mv web/web.csproj web/web.old
mv web/web.hack web/web.csproj
dotnet restore web/
dotnet publish -c release web/
rm web/web.csproj
mv web/web.old web/web.csproj
rm -rf web/shared
echo "Done hack for web"
and that is for every project...
It seems you are using a very old version of the CLI. The version of the SDK that shipped with CLI 1.0.1 was 1.0.0-alpha-20170224-6.
I am indeed, unfortunately. But I am confused. CLI (as far as I know) is dotnet executable and its relatives (dotnet-*), and SDK is that nuget package that I have in my .csproj file. So I was able to upgrade my dotnet --version => 1.0.1 but I cannot upgrade Microsoft.NET.Sdk.Web to 1.0.0-alpha-20170224-6. I get Unable to resolve 'Microsoft.NET.Sdk.Web (>= 1.0.0-alpha-20170224-6)' for '.NETCoreApp,Version=v1.1'.
That was the case for a while, but before 1.0 we decided to not ship the SDKs as Nupkgs anymore, for various reasons. I would suggest removing the import and instead using the SDK attribute. The SDK that is present in the CLI/VS will be picked up if you do that.
That worked, thanks!