Skip to content

Commit 75c5cff

Browse files
authored
Add details for MSBuild error messages (2 of 3) (#13915)
* More MSBuild error messages * Fix errors * Add MSB4260 * Fix various issues * add info about long paths * edit resolution section
1 parent 749f923 commit 75c5cff

File tree

15 files changed

+127
-15
lines changed

15 files changed

+127
-15
lines changed

docs/msbuild/errors/msb1022.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ This article describes the MSB1022 error code.
3737
message does not need in-line parameters because the exception takes care of displaying the invalid arg.
3838
LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized.
3939
-->
40+
## Description
41+
42+
This error occurs if MSBuild was provided a response file at the MSBuild command line, but the file was not found. Response files typically have the extension `.rsp`. See [MSBuild response files](../msbuild-response-files.md).
43+
44+
## Resolution
45+
46+
Check that the response file specified in the MSBuild command line exists in the expected directory, and that the path, syntax, and spelling are correct. For paths with spaces, ensure that quotes are used to prevent the command from being misinterpreted.
47+
48+
If the first response file contains references to other response files, be sure to check each nested response file. Check the default response files (*MSBuild.rsp* or *Directory.Build.rsp*) that are included automatically as well, if they exist and reference other response files.
49+
50+
Be aware that some third-party tools invoke MSBuild using a generated response file in a temporary folder, based on the path specified in the TMP or TEMP environment variable. Refer to the documentation of the third-party tools to troubleshoot the problem.
51+
4052
<!-- :::editable-content-end::: -->
4153
<!-- :::ErrorDefinitionDescription-end::: -->
4254

docs/msbuild/errors/msb3022.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ This article describes the MSB3022 error code.
3535
<!--
3636
{StrBegin="MSB3022: "}
3737
-->
38+
## Description
39+
40+
The `Copy` task can be used in one of two ways. You can specify a list that contains the destination path for each file in the source list, or you can specify a destination directory. This error occurs if you specify both a list of files and a directory.
41+
42+
## Resolution
43+
44+
If you control the invocation of the `Copy` task, choose the most appropriate method of specifying the destination files, and remove the other parameter.
45+
46+
See [Copy task](../copy-task.md).
47+
3848
<!-- :::editable-content-end::: -->
3949
<!-- :::ErrorDefinitionDescription-end::: -->
4050

docs/msbuild/errors/msb3028.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ MSB3028: {0} is an invalid retry count. Value must not be negative. -->
4040
4141
{StrBegin="MSB3028: "} LOCALIZATION: {0} is a number.
4242
-->
43+
## Description
44+
45+
The retry count parameter of a Copy or Delete task determine how many attempts are made to perform the operation before returning an error. This must be a positive number.
46+
47+
## Resolution
48+
49+
Check the values provided for the parameters of the task, and if any properties are referenced, ensure the properties are defined, and the values are correct.
50+
4351
<!-- :::editable-content-end::: -->
4452
<!-- :::ErrorDefinitionDescription-end::: -->
4553

docs/msbuild/errors/msb3094.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ This article describes the MSB3094 error code.
3737
3838
{StrBegin="MSB3094: "}
3939
-->
40+
## Description
41+
42+
In certain operations, MSBuild tasks accept two input parameters that represent lists of items, such as sets of source and destination files for the Copy task. The logic of the task requires that the lists have the same number of items. If there's a mismatch in the number of items when they should be the same, you get this error.
43+
44+
## Resolution
45+
46+
The error message points to the items and the counts of each item. Check the items and how they're created for logic or syntax errors.
47+
4048
<!-- :::editable-content-end::: -->
4149
<!-- :::ErrorDefinitionDescription-end::: -->
4250

docs/msbuild/errors/msb3171.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ This article describes the MSB3171 error code.
3535
<!--
3636
{StrBegin="MSB3171: "}
3737
-->
38+
## Description
39+
40+
This error is a generic error that you get when MSBuild is unable to provide a more specific error about the exact problem that occurred when trying to generate a manifest.
41+
42+
## Resolution
43+
44+
Try running with verbose diagnostics (`-v:diag` on the MSBuild command line), and check everything related to signing the assembly, and the ClickOnce manifest generation. In Visual Studio, go to Project Properties (press **Alt**+**Enter**), and check the **Strong naming** settings under the **Build** section. Verify the correctness of any information provided, such as the key file. On Windows, type **certmgr.msc** in the search section of the taskbar to open the certificate management console. Check any relevant certificates in the certificate store on the machine.
45+
46+
You can also generate a binary log using the `-bl` option, and use the [MSBuild Structured Log Viewer](https://msbuildlog.com) to get more details about what was happening in the build process before the error occurred.
47+
3848
<!-- :::editable-content-end::: -->
3949
<!-- :::ErrorDefinitionDescription-end::: -->
4050

docs/msbuild/errors/msb3248.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,10 @@ This article describes the MSB3248 error code.
3232
<!-- MSB3248: Parameter "{0}" has invalid value "{1}". {2} -->
3333

3434
<!-- :::editable-content name="postOutputDescription"::: -->
35-
## Remarks
35+
## Description
3636

3737
The error code MSB3248 occurs in the `ResolveAssemblyReference` task in MSBuild when there's an issue with the parameters specified for resolving assembly references. The `ResolveAssemblyReference` task is responsible for resolving assembly references in a project. You don't normally invoke this task directly; it's called during the .NET build process.
3838

39-
### Common causes
40-
4139
The most likely cause is an MSBuild property setting that creates an issue with the assembly resolution process. See [Common MSBuild properties](../common-msbuild-project-properties.md).
4240

4341
## Resolution

docs/msbuild/errors/msb4020.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@ This article describes the MSB4020 error code.
3636
{StrBegin="MSB4020: "}UE: This is a generic message that is displayed when we find a project element with an incorrect value for one of its
3737
attributes e.g. <Import Project=""> -- the value of Project should not be an empty string.
3838
-->
39+
## Description
40+
41+
This error occurs when a project element has an incorrect value for one of its attributes. For example, an `Import` element with an empty string for the Project.
42+
43+
```xml
44+
<Import Project="">
45+
```
46+
47+
## Resolution
48+
49+
Check the attribute and value referenced in the text of the error message. If the values provided are determined by properties, ensure that the properties are defined and have the correct values.
50+
3951
<!-- :::editable-content-end::: -->
4052
<!-- :::ErrorDefinitionDescription-end::: -->
4153

docs/msbuild/errors/msb4061.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ This article describes the MSB4061 error code.
3535
<!--
3636
{StrBegin="MSB4061: "}LOCALIZATION: "{2}" is a localized message from a CLR/FX exception.
3737
-->
38+
## Description
39+
40+
This error occurs when MSBuild tries to create a task, but the task creation fails. If this occurs with a build system task, it's usually due to an installation issue. If this occurs with your own custom task, it means that something failed, perhaps in the task constructor.
41+
42+
## Resolution
43+
44+
Reinstall MSBuild or the .NET SDK, or repair your installation of Visual Studio. See [Repair Visual Studio](../../install/repair-visual-studio.md).
45+
46+
For your own custom tasks, you have to debug the issue. Set breakpoint in the task constructor to see if the constructor gets called, and executes successfully. Consider adding error checks or logging information in the constructor code. For more information about debugging and testing a custom task, see [Create a custom task for code generation - Generate a console app and use the custom task](../tutorial-custom-task-code-generation.md#generate-a-console-app-and-use-the-custom-task).
3847
<!-- :::editable-content-end::: -->
3948
<!-- :::ErrorDefinitionDescription-end::: -->
4049

docs/msbuild/errors/msb4068.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ This article describes the MSB4068 error code.
3535
<!--
3636
{StrBegin="MSB4068: "}
3737
-->
38+
## Description
39+
40+
This error occurs when MSBuild is given an XML file to build, but the file isn't a project file. Specifically, MSBuild looks for the top-level `Project` XML element to see if it can process the input file as a valid project file, and if it doesn't find it, you get this error. The error text gives the name of whatever top-level element that was found.
41+
42+
## Resolution
43+
44+
Check the file that was provided. Note that the file MSBuild tries to build might be found automatically. For example, if you invoke MSBuild in a project folder, it tries to find the project file or a solution file in that folder.
45+
46+
If you were using a tool that runs MSBuild, such as `dotnet pack`, check its documentation to ensure it is being invoked correctly. For example, if you invoke `dotnet pack` with a `.nuspec` file, which uses a different XML schema, the error references the `package` element found in those files.
47+
48+
If the provided file is a project file, check for any spelling or syntax errors in or near the top-level `Project` element.
49+
3850
<!-- :::editable-content-end::: -->
3951
<!-- :::ErrorDefinitionDescription-end::: -->
4052

docs/msbuild/errors/msb4078.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ This article describes the MSB4078 error code.
3535
<!--
3636
{StrBegin="MSB4078: "}
3737
-->
38+
## Description
39+
40+
This error occurs when a project file contains a project of a type that can't be built by MSBuild. Most modern project types support MSBuild, but some older project types in Visual Studio, and project types supported in Visual Studio extensions, do not.
41+
42+
This issue only occurs when you build from the MSBuild or `dotnet` command line; the solution should still build in Visual Studio, if the required workloads, components, and extensions are installed.
43+
44+
## Resolution
45+
46+
If your solution contains project types that don't support MSBuild, use `devenv /build` to build the solution on the command line. See [/Build (devenv.exe)](../../ide/reference/build-devenv-exe.md).
47+
3848
<!-- :::editable-content-end::: -->
3949
<!-- :::ErrorDefinitionDescription-end::: -->
4050

0 commit comments

Comments
 (0)