microsoft / microsoft/MSBuildSdks

MSB4060 and MSB4061 errors

Open
#605 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
508
Forks
94
Avg merge
6h 40m
Merged PRs (30d)
2

Description

[regression] [worked-in:17.12]
35>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4858,5): error MSB4060: The “Copy” task has been declared or used incorrectly, or failed during construction. Check the spelling of the task name and the assembly name. [E:\WADev\Websites\src\hosting\EnvSettingsModule\EnvSettingsModule.csproj]
9>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5322,5): error MSB4061: The “Copy” task could not be instantiated from “E:.nuget\packages\microsoft.build.copyonwrite\1.0.315\Sdk…\build\netstandard2.0\Microsoft.Build.CopyOnWrite.dll”. [E:\WADev\Websites\src\OnPrem\Output\OnPremFolder.csproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5322,5): error MSB4061: System.TypeInitializationException: The type initializer for ‘Microsoft.Build.Tasks.Copy’ threw an exception. —> System.ComponentModel.Win32Exception: GetVolumePathNamesForVolumeName(?\Volume{76597d1a-b340-11ef-bf5b-b04f13039cb8}) failed with Win32 error code 2 [E:\WADev\Websites\src\OnPrem\Output\OnPremFolder.csproj]

copied from https://developercommunity.visualstudio.com/t/MSB4060-and-MSB4061-errors/10808156

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure while building EnvSettingsModule.csproj and OnPremFolder.csproj with Visual Studio 2022 MSBuild. Investigate the MSB4060/MSB4061 Copy task errors and the GetVolumePathNamesForVolumeName Win32 error; done means these projects build without those errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.