Search code examples
visual-studioasp.net-core.net-corevisual-studio-2017microsoft-web-deploy

Unable to publish ASP.NET Core application with "CreateManifestFile" task could not be loaded


I have an ASP.NET Core app which I can publish using web deploy and pre-configured publishing profile via Visual Studio 2017. Now I need to configure CI and trying to achieve the same from the command line so I installed [.NET Core SDK][1] and followed this guide

dotnet build -c release /p:DeployOnBuild=true /p:PublishProfile=publish-profile-name

Unfortunately, it gives the following error:

C:\Program Files\dotnet\sdk\1.0.4\Sdks\Microsoft.NET.Sdk.Publish\build\netstanda rd1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(227,5): error MSB4062: The "CreateManifestFile" task could not be loaded from the assembly C:\Program Files\dotnet\sdk\1.0.4\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0 ....\tools\netcoreapp1.0\Microsoft.NETCore.Sdk.Publish.Tasks.dll. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

How can I fix the dotnet build line?


Solution

  • If your publish profile uses MSDeploy, it cannot be built via the .NET Core based build tools (dotnet build).

    See the related GitHub issue https://github.com/aspnet/websdk/issues/166

    The workaround is to use msbuild /p:Configuration=Release … from a VS 2017 installation instead of dotnet build.