Skip to content

Commit e6d85f0

Browse files
committed
Drafts created
1 parent 91ce9ad commit e6d85f0

File tree

13 files changed

+170
-56
lines changed

13 files changed

+170
-56
lines changed

docs/msbuild/common-msbuild-project-properties.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Common MSBuild Project Properties
33
description: Learn about common MSBuild project properties that can be defined or used in project files or included in .targets files that MSBuild provides.
4-
ms.date: 01/18/2018
4+
ms.date: 4/17/2025
55
ms.topic: reference
66
dev_langs:
77
- VB
@@ -191,6 +191,7 @@ When setting property values, keep in mind that common properties may be set, re
191191
| FrameworkPathOverride | Visual Basic | Specifies the location of *mscorlib.dll* and *microsoft.visualbasic.dll*. This parameter is equivalent to the `/sdkpath` switch of the *vbc.exe* compiler. |
192192
| GenerateDocumentationFile | .NET | A boolean parameter that indicates whether documentation is generated by the build. If `true`, the build generates documentation information and puts it in an *.xml* file together with the name of the executable file or library that the build task created. |
193193
| GenerateFullPaths | C# | Generate full paths for filenames in output by using the [-fullpaths](/dotnet/csharp/language-reference/compiler-options/fullpaths-compiler-option) compiler option. |
194+
| GenerateResourceUsePreserializedResources | .NET | When MSBuild reads `.resx` files and generates `.resources` files, indicates whether to use the preserialized resources instead of deserializing and then reserializing each resource (for backward compatibility with .NET Framework). |
194195
| GenerateSerializationAssemblies | .NET | Indicates whether XML serialization assemblies should be generated by *SGen.exe*, which can be set to on, auto, or off. This property is used for assemblies that target .NET Framework only. To generate XML serialization assemblies for .NET Standard or .NET Core assemblies, reference the *Microsoft.XmlSerializer.Generator* NuGet package. |
195196

196197
| Property or parameter name | Project types | Description |

docs/msbuild/errors/msb1004.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "MSB1004 diagnostic code"
33
description: "Specify the name of the target."
4-
ms.date: 01/14/2025
4+
ms.date: 04/17/2025
55
ms.topic: "error-reference"
66
f1_keywords:
77
- MSB1004
@@ -36,6 +36,20 @@ MSB1004: Specify the name of the target.
3636
following the switch, as in "msbuild.exe -target:blah".
3737
LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized.
3838
-->
39+
## Description
40+
41+
This errors occurs when the MSBuild command line contains a `-targets` or `-t` switch, which is used to request a specific target to build, but no target was specified.
42+
43+
## Resolution
44+
45+
Provide the target name that you want to build. Check for typos in the command-line syntax, and make sure that the desired target name is given after the `-targets` or `-t` switch. If you're constructing the MSBuild command line using an environment variable or shell script, check that the environment variable exists, has a value, and is referenced using the correct shell-specific syntax, and verify any shell expansions, and the correct syntax of escape characters.
46+
47+
Possible targets might be defined in the project file itself. These appear as a `Target Name="MyTarget"` element in the project file. Or, you can specify one of the system-provided target files. These are files with the `.targets` extension such as `Microsoft.Common.targets`, `Microsoft.Common.CSharp.targets`, and so on in the MSBuild installation folders. If you're using a project SDK (for example, you used the `Sdk="Microsoft.Net.Sdk"` attribute on the `Project` node in the project file), these system `.targets` files are imported implicitly.
48+
49+
If you don't know what the name of your desired target is, or what target you want to build, you can get a list of available targets by issuing the command `MSBuild -targets`.
50+
51+
For more information, see [MSBuild targets](../msbuild-targets.md).
52+
3953
<!-- :::editable-content-end::: -->
4054
<!-- :::ErrorDefinitionDescription-end::: -->
4155

docs/msbuild/errors/msb1011.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "MSB1011 diagnostic code"
33
description: "Specify which project or solution file to use because this folder contains more than one project or solution file."
4-
ms.date: 01/14/2025
4+
ms.date: 04/17/2025
55
ms.topic: "error-reference"
66
f1_keywords:
77
- MSB1011
@@ -26,9 +26,7 @@ This article describes the MSB1011 error code.
2626

2727
## Message text
2828

29-
```output
30-
MSB1011: Specify which project or solution file to use because this folder contains more than one project or solution file.
31-
```
29+
`MSB1011: Specify which project or solution file to use because this folder contains more than one project or solution file.`
3230

3331
<!-- :::editable-content name="postOutputDescription"::: -->
3432
<!--
@@ -37,6 +35,18 @@ MSB1011: Specify which project or solution file to use because this folder conta
3735
fire this error.
3836
LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized.
3937
-->
38+
## Description
39+
40+
If no project or solution file is explicitly specified on the MSBuild.exe command-line, then the engine searches for a project or solution file by looking for `*.*proj` or `*.sln` (or `*.slnx` with MSBuild 17.13 and later). MSBuild searches in the current directory, unless you specify a different working directory by [...]
41+
42+
It's not an error to have a folder with a solution file and a single project file with the same name. In that case, the solution file is used for the build. Similarly, if a solution file and multiple project files are found in the same folder, the solution is built. However, if only one project file is found, and it has a different name than a solution file in the same folder (not counting the file extension), then MSBuild issues this error.
43+
44+
## Resolution
45+
46+
If you get this error because your solution contains one project, and the project has a different name than the solution, then MSBuild can't automatically find what you want to build. Instead, specify either the solution file or the project file explicitly on the command line.
47+
48+
Also, check the command line syntax for problems with special characters such as quotes and escape characters, or for issues with shell expansions and missing or undefined environment variables that could result in an empty string for the project or solution file.
49+
4050
<!-- :::editable-content-end::: -->
4151
<!-- :::ErrorDefinitionDescription-end::: -->
4252

docs/msbuild/errors/msb1060.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "MSB1060 diagnostic code"
33
description: "Undefined environment variable passed in as switch."
4-
ms.date: 01/14/2025
4+
ms.date: 4/17/2025
55
ms.topic: "error-reference"
66
f1_keywords:
77
- MSB1060
@@ -27,10 +27,9 @@ This article describes the MSB1060 error code.
2727

2828
## Message text
2929

30-
```output
31-
MSB1060: Specify one or more warning codes when using the -warnNotAsError switch.
32-
MSB1060: Undefined environment variable passed in as switch.
33-
```
30+
`MSB1060: Specify one or more warning codes when using the -warnNotAsError switch.`
31+
32+
`MSB1060: Undefined environment variable passed in as switch.`
3433

3534
<!-- :::editable-content name="postOutputDescription"::: -->
3635
<!--
@@ -42,6 +41,22 @@ MSB1060: Undefined environment variable passed in as switch.
4241
UE: This error is shown when a user passes in an environment variable (including from a response file)
4342
but the environment variable is not defined.
4443
-->
44+
## Description
45+
46+
There are two errors that can give this error code. The first relates to the `-warnNotAsError` (or the short form `-noerr`) command-line switch. See [MSBuild command line reference](../msbuild-command-line-reference.md). The error is shown when the `-warnNotAsError` (or `-noerr`) switch is used, but no error codes were given. The switch is expected to be followed by a list of error codes, separated by a semicolon or comma. For example:
47+
48+
`msbuild.exe -err -noerr MSB3187;MSBxxxx`
49+
50+
The other error condition that gives this code is when a response file (`.rsp` file) contains an environment variable name, but the environment variable didn't exist or has no value.
51+
52+
## Resolution
53+
54+
If you saw the first of the two messages, heck the command line syntax around the option `-warnNotAsError` or `-noerr` and verify that there are no syntax errors, and that it has one or more error codes listed after it. If there is any shell expansion or environment variable that provides the list of codes, check that it has a value.
55+
56+
If you saw the second error message, use a response file for the MSBuild command line, validate the syntax, spelling, existence, and correct values of any environment variables referenced in the file. The correct syntax in the response file is shell-specific. For example, for `cmd.exe` the syntax is `%ENVIRONMENT_VARIABLE%`.
57+
58+
Note that the response file `MSBuild.rsp` is always used if present, regardless of whether you specify it on the command line. Also, `Directory.Build.rsp` is used, if present in the folders above the current folder.
59+
4560
<!-- :::editable-content-end::: -->
4661
<!-- :::ErrorDefinitionDescription-end::: -->
4762

docs/msbuild/errors/msb3091.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "MSB3091 diagnostic code"
3-
description: "Task failed because 'value' was not found, or the correct Microsoft Windows SDK is not installed. The task is looking for 'value' in the 'bin' subdirectory beneath the location specified in the 'value' value of the registry key 'value'. You may be able to solve the problem by doing one of the following: 1) Install the Microsoft Windows SDK. 2) Install Visual Studio 2010. 3) Manually set the above registry key to the correct location. 4) Pass the correct location into the 'ToolPath' parameter of the task."
4-
ms.date: 12/06/2024
3+
description: Learn about the possible causes of the MSB3091 MSBuild error, and get troubleshooting tips.
4+
ms.date: 4/17/2025
55
ms.topic: "error-reference"
66
f1_keywords:
77
- MSB3091
@@ -26,14 +26,19 @@ This article describes the MSB3091 error code.
2626

2727
## Message text
2828

29-
```output
30-
MSB3091: Task failed because 'value' was not found, or the correct Microsoft Windows SDK is not installed. The task is looking for 'value' in the 'bin' subdirectory beneath the location specified in the 'value' value of the registry key 'value'. You may be able to solve the problem by doing one of the following: 1) Install the Microsoft Windows SDK. 2) Install Visual Studio 2010. 3) Manually set the above registry key to the correct location. 4) Pass the correct location into the 'ToolPath' parameter of the task.
31-
```
29+
`MSB3091: Task failed because 'file' was not found, or the correct Microsoft Windows SDK is not installed. The task is looking for 'file' in the 'bin' subdirectory beneath the location specified in the 'value' value of the registry key 'key'. You may be able to solve the problem by doing one of the following: 1) Install the Microsoft Windows SDK. 2) Install Visual Studio 2010. 3) Manually set the above registry key to the correct location. 4) Pass the correct location into the 'ToolPath' parameter of the task.`
3230

3331
<!-- :::editable-content name="postOutputDescription"::: -->
3432
<!--
3533
{StrBegin="MSB3091: "}
3634
-->
35+
## Description
36+
37+
This error occurs when a task failed, because it depends on the Windows SDK, which was not found or not installed.
38+
39+
## Resolution
40+
41+
Install or reinstall the Windows SDK.
3742
<!-- :::editable-content-end::: -->
3843
<!-- :::ErrorDefinitionDescription-end::: -->
3944

docs/msbuild/errors/msb3501.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "MSB3501 diagnostic code"
3-
description: "Could not read lines from file 'value'."
4-
ms.date: 12/06/2024
3+
description: Learn about the possible causes of the MSB3501 MSBuild error, and get troubleshooting tips.
4+
ms.date: 4/17/2025
55
ms.topic: "error-reference"
66
f1_keywords:
77
- MSB3501
@@ -26,14 +26,22 @@ This article describes the MSB3501 error code.
2626

2727
## Message text
2828

29-
```output
30-
MSB3501: Could not read lines from file 'value'.
31-
```
29+
`MSB3501: Could not read lines from file 'filename'.`
3230

3331
<!-- :::editable-content name="postOutputDescription"::: -->
3432
<!--
3533
{StrBegin="MSB3501: "}
3634
-->
35+
## Description
36+
37+
This error occurs when your project is using the [`ReadLinesFromFile` task](../readlinesfromfile-task.md), but the specified file wasn't found.
38+
39+
## Resolution
40+
41+
Check the input to the `ReadLinesFromFile` task. You can use the `-v:diag` switch on the MSBuild command line to get more detailed information about the MSBuild execution, such as the values of the input parameters provided to the `ReadLinesFromFile` task. In Visual Studio, in **Tools, Options, Build and Run**, set **Verbosity** to **Diagnostic**.
42+
43+
If the input comes from a property value, check that the property has a value. If it comes from a property set at the command line, check that the syntax of the command line are the value of the environment variable is correct, especially check shell escape characters and ensuring proper use of quotes, especially the need for quotes when providing filenames with spaces in the path. If the input file comes from an environment variable, check the spelling of the environment value and verify that it has the expected value.
44+
3745
<!-- :::editable-content-end::: -->
3846
<!-- :::ErrorDefinitionDescription-end::: -->
3947

docs/msbuild/errors/msb3823.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "MSB3823 diagnostic code"
3-
description: "Non-string resources require the property GenerateResourceUsePreserializedResources to be set to true."
4-
ms.date: 12/06/2024
3+
description: Learn about the possible causes of the MSB3823 MSBuild error, and get troubleshooting tips.
4+
ms.date: 4/17/2025
55
ms.topic: "error-reference"
66
f1_keywords:
77
- MSB3823
@@ -26,14 +26,20 @@ This article describes the MSB3823 error code.
2626

2727
## Message text
2828

29-
```output
30-
MSB3823: Non-string resources require the property GenerateResourceUsePreserializedResources to be set to true.
31-
```
29+
`MSB3823: Non-string resources require the property GenerateResourceUsePreserializedResources to be set to true.`
3230

3331
<!-- :::editable-content name="postOutputDescription"::: -->
3432
<!--
3533
{StrBegin="MSB3823: "}
3634
-->
35+
## Description
36+
37+
There is a difference in how non-string resources are serialized and deserialized between .NET Framework and .NET Core. In .NET Framework applications, resources are both deserialized and then preserialized, which is not efficient but was meant to handle diverse serialization and deserialization techniques. In .NET Core, the extra steps are avoided. However, you can also opt-in to preserialization for .NET Framework projects, by setting the property mentioned in the error message.
38+
39+
## Resolution
40+
41+
If you want to use preserialized resources in a .NET Framework project, you must add a reference to the [System.Resources.Extensions](https://www.nuget.org/packages/System.Resources.Extensions) NuGet package, and also set the property `GenerateResourceUsePreserializedResources` to true.
42+
3743
<!-- :::editable-content-end::: -->
3844
<!-- :::ErrorDefinitionDescription-end::: -->
3945

docs/msbuild/errors/msb3825.md

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
---
22
title: "MSB3825 diagnostic code"
3-
description: "Resource 'value' of type 'value' may be deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to known security risks and is removed from .NET 9+. If you wish to continue using it, set property 'GenerateResourceWarnOnBinaryFormatterUse' to false.
4-
More information: https://aka.ms/binaryformatter-migration-guide"
5-
ms.date: 12/06/2024
3+
description: Learn about the possible causes of the MSBuild warning MSB3825, and get troubleshooting tips.
4+
ms.date: 4/17/2025
65
ms.topic: "error-reference"
76
f1_keywords:
87
- MSB3825
@@ -22,23 +21,43 @@ ms.subservice: msbuild
2221

2322
<!-- :::ErrorDefinitionDescription::: -->
2423
<!-- :::editable-content name="introDescription"::: -->
25-
This article describes the MSB3825 error code.
24+
This article describes the MSB3825 warning code.
2625
<!-- :::editable-content-end::: -->
2726

2827
## Message text
2928

30-
```output
31-
MSB3825: Resource 'value' of type 'value' may be deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to known security risks and is removed from .NET 9+. If you wish to continue using it, set property 'GenerateResourceWarnOnBinaryFormatterUse' to false.
32-
More information: https://aka.ms/binaryformatter-migration-guide
33-
```
29+
`MSB3825: Resource 'value' of type 'value' may be deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to known security risks and is removed from .NET 9+. If you wish to continue using it, set property 'GenerateResourceWarnOnBinaryFormatterUse' to false. More information: https://aka.ms/binaryformatter-migration-guide`
3430

3531
<!-- :::editable-content name="postOutputDescription"::: -->
3632
<!--
3733
{StrBegin="MSB3825: "}
3834
-->
35+
## Description
36+
37+
This warning occurs with .NET 8 and earlier. The .NET type <xref:BinaryFormatter>, previously commonly used for serializing and deserializing arbitrary .NET types, is not considered secure, because it allows arbitrary .NET types to be injected into an assembly via the deserialization process.
38+
39+
.NET 9 handles BinaryFormatter using a secure algorithm, so there is no issue when using .NET 9.
40+
41+
## Resolution
42+
43+
If you upgrade to .NET 9, you won't get this warning and your app won't be exposed to the security risk if it uses `BinaryFormatter`.
44+
45+
For .NET 8 and earlier, see the [migration guide](https://aka.ms/binaryformatter-migration-guide) for alternatives to `BinaryFormatter`.
46+
47+
You can also suppress the warning either by setting the `GenerateResourceWarnOnBinaryFormatterUse` property to false, as mentioned in the message, or by setting the `$(NoWarn)` property to a property group in your project file, as follows:
48+
49+
```xml
50+
<PropertyGroup>
51+
<!-- other properties -->
52+
<GenerateResourceWarnOnBinaryFormatterUse>false<GenerateResourceWarnOnBinaryFormatterUse>
53+
<!-- or -->
54+
<NoWarn>`$(NoWarn);MSB3825</NoWarn>
55+
</PropertyGroup>
56+
```
57+
3958
<!-- :::editable-content-end::: -->
4059
<!-- :::ErrorDefinitionDescription-end::: -->
4160

4261
## Applies to
4362

44-
All versions of MSBuild
63+
All recent versions of MSBuild

docs/msbuild/errors/msb3883.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "MSB3883 diagnostic code"
33
description: "Unexpected exception:"
4-
ms.date: 12/06/2024
4+
ms.date: 4/17/2025
55
ms.topic: "error-reference"
66
f1_keywords:
77
- MSB3883
@@ -26,14 +26,20 @@ This article describes the MSB3883 error code.
2626

2727
## Message text
2828

29-
```output
30-
MSB3883: Unexpected exception:
31-
```
29+
`MSB3883: Unexpected exception:` - usually followed by exception-specific text.
3230

3331
<!-- :::editable-content name="postOutputDescription"::: -->
3432
<!--
3533
{StrBegin="MSB3883: "}
3634
-->
35+
## Description
36+
37+
This error is emitted by the [C# compiler task - Csc](../csc-task.md), when an exception occurs in the C# compilation process that wasn't otherwise handled.
38+
39+
## Resolution
40+
41+
This error should never occur during normal operations; if it does occur, you should report it at [Dev Community](https://developercommunity.visualstudio.com/dotnet) or at the [Roslyn](https://github.com/dotnet/roslyn/issues) project at GitHub.
42+
3743
<!-- :::editable-content-end::: -->
3844
<!-- :::ErrorDefinitionDescription-end::: -->
3945

0 commit comments

Comments
 (0)