Skip to content

Commit eb312e7

Browse files
Learn Build Service GitHub AppLearn Build Service GitHub App
authored andcommitted
Merging changes synced from https://github.com/MicrosoftDocs/visualstudio-docs-pr (branch live)
2 parents dd8b887 + f36ee4b commit eb312e7

File tree

14 files changed

+177
-23
lines changed

14 files changed

+177
-23
lines changed

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

Lines changed: 19 additions & 18 deletions
Large diffs are not rendered by default.

docs/msbuild/errors/msb1004.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@ This article describes the MSB1004 error code.
3737
following the switch, as in "msbuild.exe -target:blah".
3838
LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized.
3939
-->
40+
## Description
41+
42+
This error 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.
43+
44+
## Resolution
45+
46+
Provide the target name that you want to build by putting it just after the `-t` or `-targets` switch. If that isn't the problem, check for typos in the command-line syntax, such as mismatched quotes or unintended shell escape characters. 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.
47+
48+
Possible targets might be defined in the project file itself. These appear with syntax like `<Target Name="MyTarget">`, which begins the specification of a target in the project file. Or, you can specify a target from of the system-provided target files. These are files, typically 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.
49+
50+
If you don't know what the name of your desired target is, or what target you want to build, try issuing the command `MSBuild.exe -targets`, which generates a list of available targets, but doesn't run the build.
51+
52+
For more information, see [MSBuild targets](../msbuild-targets.md).
53+
4054
<!-- :::editable-content-end::: -->
4155
<!-- :::ErrorDefinitionDescription-end::: -->
4256

docs/msbuild/errors/msb1011.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@ This article describes the MSB1011 error code.
3838
fire this error.
3939
LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized.
4040
-->
41+
## Description
42+
43+
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 passing a directory name on the command line.
44+
45+
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.
46+
47+
## Resolution
48+
49+
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.
50+
51+
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.
52+
4153
<!-- :::editable-content-end::: -->
4254
<!-- :::ErrorDefinitionDescription-end::: -->
4355

docs/msbuild/errors/msb1060.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ This article describes the MSB1060 error code.
2828
## Message text
2929

3030
<!-- :::editable-content name="messageText"::: -->
31-
`MSB1060: Specify one or more warning codes when using the -warnNotAsError switch.
32-
MSB1060: Undefined environment variable passed in as switch.`
31+
`MSB1060: Specify one or more warning codes when using the -warnNotAsError switch.`
32+
`MSB1060: Undefined environment variable passed in as switch.`
3333
<!-- :::editable-content-end::: -->
3434
<!-- MSB1060: Specify one or more warning codes when using the -warnNotAsError switch.
3535
MSB1060: Undefined environment variable passed in as switch. -->
@@ -44,6 +44,22 @@ MSB1060: Undefined environment variable passed in as switch. -->
4444
UE: This error is shown when a user passes in an environment variable (including from a response file)
4545
but the environment variable is not defined.
4646
-->
47+
## Description
48+
49+
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:
50+
51+
`msbuild.exe -err -noerr MSB3187;MSB3243`
52+
53+
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.
54+
55+
## Resolution
56+
57+
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.
58+
59+
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%`.
60+
61+
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.
62+
4763
<!-- :::editable-content-end::: -->
4864
<!-- :::ErrorDefinitionDescription-end::: -->
4965

docs/msbuild/errors/msb3091.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ This article describes the MSB3091 error code.
3535
<!--
3636
{StrBegin="MSB3091: "}
3737
-->
38+
## Description
39+
40+
This error occurs when a task failed because it depends on the Windows SDK, which was not found or not installed.
41+
42+
## Resolution
43+
44+
Install or reinstall the Windows SDK.
3845
<!-- :::editable-content-end::: -->
3946
<!-- :::ErrorDefinitionDescription-end::: -->
4047

docs/msbuild/errors/msb3178.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ms.subservice: msbuild
2121

2222
<!-- :::ErrorDefinitionDescription::: -->
2323
<!-- :::editable-content name="introDescription"::: -->
24-
This article describes the MSB3178 error code.
24+
This article describes the MSB3178 diagnostic code.
2525
<!-- :::editable-content-end::: -->
2626

2727
## Message text
@@ -35,6 +35,26 @@ This article describes the MSB3178 error code.
3535
<!--
3636
{StrBegin="MSB3178: "}
3737
-->
38+
## Description
39+
40+
This warning occurs when MSBuild tries to process a manifest file, but encountered a file that looks like an assembly that was specified as an ordinary file, instead of using the correct XML structure for an assembly. Assembly manifests used in ClickOnce deployment for .NET applications are XML files that contain an XML-encoded of the contents of an application, which might include assemblies and files. Assemblies are specified using the `assembly` element, which also includes child elements such as `assemblyInformation`; plain files are specified using the `file` element.
41+
42+
In Visual Studio when you generate a ClickOnce manifest using the Publish process, you might get this warning if you specify a DLL or EXE with the `Build Action` set to `Content`. In Visual Studio, `Content` means add something as an ordinary file, not as an assembly. In a project file, `Content` is an item group. If the item group contains files that look like assemblies, you get this warning.
43+
44+
## Resolution
45+
46+
Check the assembly manifest XML file for the assembly given in the text of the error message. For more information, see [Assembly manifest](/dotnet/standard/assembly/manifest). You can generate a binary log to see why a particular file is being passed as an assembly. Use the `-bl` switch on the MSBuild command line, and then use the [MSBuild structured log viewer](https://msbuildlog.com) to open the binary log (`.binlog` file).
47+
48+
If your project file contains an item group `Content` or your Visual Studio project specifies the `Build Action` as `Content` for some files with the DLL or EXE extension, consider whether this is intentional or not.
49+
50+
If your manifest file was generated by a custom tool or process, check any `file` elements to see if any of them reference files that should be referenced as assemblies instead (look for file extensions such as `.dll` or `.exe`.). If it was generated by a tool or MSBuild task, check the command line syntax, shell expansions, and validate any input files to the tool or task.
51+
52+
You can disable this warning by using the `NoWarn` property:
53+
54+
`<NoWarn>$(NoWarn);MSB3178</NoWarn>`
55+
56+
You should only disable the warning if you've verified that including what appear to be assemblies as ordinary files is valid and intentional in your scenario.
57+
3858
<!-- :::editable-content-end::: -->
3959
<!-- :::ErrorDefinitionDescription-end::: -->
4060

docs/msbuild/errors/msb3501.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ This article describes the MSB3501 error code.
3535
<!--
3636
{StrBegin="MSB3501: "}
3737
-->
38+
## Description
39+
40+
This error occurs when your project is using the [`ReadLinesFromFile` task](../readlinesfromfile-task.md), but the specified file wasn't found.
41+
42+
## Resolution
43+
44+
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**.
45+
46+
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 and the value of the environment variable are correct; especially check shell escape characters and ensure 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.
47+
3848
<!-- :::editable-content-end::: -->
3949
<!-- :::ErrorDefinitionDescription-end::: -->
4050

docs/msbuild/errors/msb3823.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ This article describes the MSB3823 error code.
3535
<!--
3636
{StrBegin="MSB3823: "}
3737
-->
38+
## Description
39+
40+
There's a difference in how nonstring resources are serialized and deserialized between .NET Framework and .NET Core. In .NET Framework applications, resources are both deserialized and then preserialized, which isn't 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.
41+
42+
## Resolution
43+
44+
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.
45+
3846
<!-- :::editable-content-end::: -->
3947
<!-- :::ErrorDefinitionDescription-end::: -->
4048

docs/msbuild/errors/msb3825.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ms.subservice: msbuild
2121

2222
<!-- :::ErrorDefinitionDescription::: -->
2323
<!-- :::editable-content name="introDescription"::: -->
24-
This article describes the MSB3825 error code.
24+
This article describes the MSB3825 warning code.
2525
<!-- :::editable-content-end::: -->
2626

2727
## Message text
@@ -37,9 +37,30 @@ This article describes the MSB3825 error code.
3737
<!--
3838
{StrBegin="MSB3825: "}
3939
-->
40+
## Description
41+
42+
This warning occurs with .NET 8 and earlier. The deprecated .NET type <xref:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter>, previously commonly used for serializing and deserializing arbitrary .NET types, isn't considered secure, because it allows arbitrary .NET types to be injected into an assembly via the deserialization process.
43+
44+
.NET 9 handles BinaryFormatter using a secure algorithm, so there's no issue when using .NET 9.
45+
46+
## Resolution
47+
48+
If you upgrade to .NET 9, you won't get this warning for resources, but may have to implement another solution if another part of your code uses `BinaryFormatter`. See the [migration guide](https://aka.ms/binaryformatter-migration-guide) for alternatives to `BinaryFormatter`.
49+
50+
For .NET 8 and earlier, you can 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:
51+
52+
```xml
53+
<PropertyGroup>
54+
<!-- other properties -->
55+
<GenerateResourceWarnOnBinaryFormatterUse>false<GenerateResourceWarnOnBinaryFormatterUse>
56+
<!-- or -->
57+
<NoWarn>$(NoWarn);MSB3825</NoWarn>
58+
</PropertyGroup>
59+
```
60+
4061
<!-- :::editable-content-end::: -->
4162
<!-- :::ErrorDefinitionDescription-end::: -->
4263

4364
## Applies to
4465

45-
All versions of MSBuild
66+
All recent versions of MSBuild

docs/msbuild/errors/msb3883.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ This article describes the MSB3883 error code.
3535
<!--
3636
{StrBegin="MSB3883: "}
3737
-->
38+
## Description
39+
40+
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.
41+
42+
## Resolution
43+
44+
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.
45+
3846
<!-- :::editable-content-end::: -->
3947
<!-- :::ErrorDefinitionDescription-end::: -->
4048

0 commit comments

Comments
 (0)