Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions documentation/specs/BuildCheck/Codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ Report codes are chosen to conform to suggested guidelines. Those guidelines are
| [BC0106](#bc0106---copytooutputdirectoryalways-should-be-avoided) | Warning | N/A | 9.0.200 | CopyToOutputDirectory='Always' should be avoided. |
| [BC0107](#bc0107---targetframework-and-targetframeworks-specified-together) | Warning | N/A | 9.0.200 | TargetFramework and TargetFrameworks specified together. |
| [BC0108](#bc0108---targetframework-or-targetframeworks-specified-in-non-sdk-style-project) | Warning | N/A | 9.0.300 | TargetFramework or TargetFrameworks specified in non-SDK style project. |
| [BC0109](#bc0109---building-using-the-exec-task) | Warning | N/A | 9.0.300 | Building using the Exec task. |
| [BC0201](#bc0201---usage-of-undefined-property) | Warning | Project | 9.0.100 | Usage of undefined property. |
| [BC0202](#bc0202---property-first-declared-after-it-was-used) | Warning | Project | 9.0.100 | Property first declared after it was used. |
| [BC0203](#bc0203----property-declared-but-never-used) | None | Project | 9.0.100 | Property declared but never used. |
| [BC0301](#bc0301---building-from-downloads-folder) | None | Project | 9.0.300 | Building from Downloads folder. |

| [BC0302](#bc0302---building-using-the-exec-task) | Warning | N/A | 9.0.300 | Building using the Exec task. |

Notes:
* What does the 'N/A' scope mean? The scope of checks are only applicable and configurable in cases where evaluation-time data are being used and the source of the data is determinable and available. Otherwise the scope of whole build is always checked.
Expand Down Expand Up @@ -138,14 +137,6 @@ dotnet build my-multi-target.csproj /p:TargetFramework=net9.0

Make sure the Target Framework is specified appropriately for your project.

<a name="BC0109"></a>
## BC0109 - Building using the Exec task.

"The 'Exec' task should not be used to build projects."

Building projects using the dotnet/msbuild/nuget CLI in the `Exec` task is not recommended, as it spawns a separate build process that the MSBuild engine cannot track. Please use the [MSBuild task](https://learn.microsoft.com/visualstudio/msbuild/msbuild-task) instead.


<a name="BC0201"></a>
## BC0201 - Usage of undefined property.

Expand Down Expand Up @@ -205,6 +196,13 @@ Placing project files into Downloads folder (or any other folder that cannot be

Place your projects into trusted locations - including cases when you intend to only open the project in IDE.

<a name="BC0302"></a>
## BC0302 - Building using the Exec task.

"The 'Exec' task should not be used to build projects."

Building projects using the dotnet/msbuild/nuget CLI in the `Exec` task is not recommended, as it spawns a separate build process that the MSBuild engine cannot track. Please use the [MSBuild task](https://learn.microsoft.com/visualstudio/msbuild/msbuild-task) instead.

<BR/>
<BR/>
<BR/>
Expand Down
6 changes: 3 additions & 3 deletions src/Build/BuildCheck/Checks/ExecCliBuildCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ namespace Microsoft.Build.Experimental.BuildCheck.Checks;
internal sealed class ExecCliBuildCheck : Check
{
public static CheckRule SupportedRule = new CheckRule(
"BC0109",
"BC0302",
"ExecCliBuild",
ResourceUtilities.GetResourceString("BuildCheck_BC0109_Title")!,
ResourceUtilities.GetResourceString("BuildCheck_BC0109_MessageFmt")!,
ResourceUtilities.GetResourceString("BuildCheck_BC0302_Title")!,
ResourceUtilities.GetResourceString("BuildCheck_BC0302_MessageFmt")!,
new CheckConfiguration() { Severity = CheckResultSeverity.Warning });

private const string ExecTaskName = "Exec";
Expand Down
4 changes: 2 additions & 2 deletions src/Build/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2206,10 +2206,10 @@ Utilization: {0} Average Utilization: {1:###.0}</value>
<value>Project {0} specifies 'TargetFramework(s)' property '{1}', which does not use the .NET SDK. Those properties are not understood by projects that import C# targets directly.</value>
<comment>Terms in quotes are not to be translated.</comment>
</data>
<data name="BuildCheck_BC0109_Title" xml:space="preserve">
<data name="BuildCheck_BC0302_Title" xml:space="preserve">
<value>The 'Exec' task should not be used to build a project.</value>
</data>
<data name="BuildCheck_BC0109_MessageFmt" xml:space="preserve">
<data name="BuildCheck_BC0302_MessageFmt" xml:space="preserve">
<value>Task {0} from project {1} builds a project using the {2} CLI. The MSBuild task should be used instead.</value>
</data>
<data name="BuildCheck_BC0201_Title" xml:space="preserve">
Expand Down
4 changes: 2 additions & 2 deletions src/Build/Resources/xlf/Strings.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Build/Resources/xlf/Strings.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Build/Resources/xlf/Strings.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Build/Resources/xlf/Strings.fr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Build/Resources/xlf/Strings.it.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Build/Resources/xlf/Strings.ja.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Build/Resources/xlf/Strings.ko.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Build/Resources/xlf/Strings.pl.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Build/Resources/xlf/Strings.pt-BR.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Build/Resources/xlf/Strings.ru.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/Build/Resources/xlf/Strings.tr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Build/Resources/xlf/Strings.zh-Hans.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Build/Resources/xlf/Strings.zh-Hant.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/BuildCheck.UnitTests/ExecCliBuildCheck_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void ExecTask_WithCommandExecutingBuild_ShouldShowWarning(string? command
}));

_registrationContext.Results.Count.ShouldBe(1);
_registrationContext.Results[0].CheckRule.Id.ShouldBe("BC0109");
_registrationContext.Results[0].CheckRule.Id.ShouldBe("BC0302");
}

[Theory]
Expand Down