question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Steps 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:closed
  • Created 7 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
sksakuracommented, Mar 6, 2018

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

0reactions
potatojaisiladkicommented, Jul 30, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MSB4062 - MSBuild
This error is emitted when a task assembly cannot be loaded prior to executing a task. Error MSB4018 may be caused when running...
Read more >
MSBUILD getting failed with error MSB4062
Schema.SqlTasks.targets(477,5): Error MSB4062: The "SqlModelResolutionTask" task could not be loaded from the assembly \Extensions\Microsoft\ ...
Read more >
MSB4062: The "ValidateNTTargetVersion" task could not ...
MSB4062 says to resolve the MSB4062 error, ensure that the task expresses a dependency on the runtime environment it requires in the task's...
Read more >
dotnet publish fails with MSB4062 ...
Describe the bug Running dotnet publish using a simple project and publish profile consistently fails with an exception.
Read more >
MSBUILD getting failed with error MSB4062
The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found