dotnet / dotnet/msbuild

naming collision Microsoft.Build.Utilities.Task vs System.Threading.Tasks.Task

Open
#12,034 1 comment 1 reaction 0 assignees View on GitHub
Area: Documentation triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

The documentation here:
https://learn.microsoft.com/en-us/visualstudio/msbuild/task-writing?view=vs-2022
might appreciate an update. (Or maybe my project setup is just weird)

There is a naming collision between Microsoft.Build.Utilities.Task and System.Threading.Tasks.Task and it took me a while to notice what was going on and why my code didn't work.

Steps to reproduce:
Create a new console project (to satisfy the `A Visual Studio project that builds with MSBuild.` requirement above)
Add dependency on the Microsoft.Build.Utilities.Core.dll
Add a new .cs file, paste in the
```
using System;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

namespace MyTasks
{
public class SimpleTask : Task
{
public override bool Execute()
{
return true;
}
}
}
```
snippet from the documentation.

It won't work due to the collision.

Contributor guide

No contributing guide indexed for this repository

Research direction

Review the linked MSBuild task-writing documentation and reproduce the issue in a new console project with Microsoft.Build.Utilities.Core.dll using the included C# snippet. Confirm the naming collision and update the documentation example or explanation so the intended Task type is unambiguous; done when the documented example builds successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.