Error MSB4062
See original GitHub issueSteps to reproduce
I have a lot old library projects(4.5.1) that builds correctly with new web site project. But one project that using some web references cannot be build from dotnet build with different configurations. For example dotnet build --configuration Debug normally executed but dotnet build --configuration Staging gives following error: Can someone help with this? Thanks
Actual behavior
C:\Program Files\dotnet\sdk\1.0.0\Microsoft.Common.CurrentVersion.targets(3344,5): error MSB4062: The “Microsoft.Build.Tasks.SGen” task could not be loaded from the assembly Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Confirm that the <UsingTask> 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. [D:\ep\ServiceLayer\ServiceLayer.csproj]
Environment data
dotnet --info
output:
.NET Command Line Tools (1.0.0)
Product Information: Version: 1.0.0 Commit SHA-1 hash: e53429feb4
Runtime Environment: OS Name: Windows OS Version: 10.0.14393 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\1.0.0
Issue Analytics
- State:
- Created 7 years ago
- Comments:7
Top GitHub Comments
We have the save problem with build core project (release configuration and dotnet publish). Now it is working with msbuild.
msbuild %myPath%\MyProject.csproj /p:DeployOnBuild=true /p:Configuration=Release /p:PublishProfile=%myPath%\Properties\PublishProfiles\Release.pubxml /p:publishUrl=D:\Publish\MyProject
Thanks! This worked for me. I had spent an entire day troubleshooting this issue.