Skip to content

Commit a7566dc

Browse files
Merge pull request #13939 from ghogen/msbuild-errors-june-2025
Add details for MSBuild error messages (3 of 3)
2 parents 16467f5 + b9f490a commit a7566dc

File tree

14 files changed

+156
-6
lines changed

14 files changed

+156
-6
lines changed

docs/msbuild/errors/msb1025.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ This article describes the MSB1025 error code.
3737
FX/CLR method threw an unexpected exception.
3838
LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" and "MSBuild" should not be localized.
3939
-->
40+
## Description
41+
42+
This error occurs when MSBuild itself generates a fatal error while building your project. This situation could occur if MSBuild encounters an error that it wasn't expecting, such as when your system is out of memory, or it could indicate an engineering defect in MSBuild. The exception is reported after the MSBuild message text.
43+
44+
## Resolution
45+
46+
If the exception text indicates a system issue, such as an out-of-memory error, address that if you can, and then try rerunning MSBuild. For an out-of-memory issue, close open applications. On Windows, use the Task Manager to identify processes that are using up memory, and shut them down. Check for any bad processes that might be using up memory erroneously.
47+
48+
If the exception text isn't obviously a system issue, you can report the issue either as a Visual Studio bug, or as a MSBuild issue. See [Report a problem](../../ide/how-to-report-a-problem-with-visual-studio.md) or the [MSBuild GitHub repository](https://github.com/dotnet/msbuild).
49+
4050
<!-- :::editable-content-end::: -->
4151
<!-- :::ErrorDefinitionDescription-end::: -->
4252

docs/msbuild/errors/msb3096.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,37 @@ This article describes the MSB3096 error code.
2727
## Message text
2828

2929
<!-- :::editable-content name="messageText"::: -->
30-
`MSB3096: Task 'value' is only supported when building on Windows.`
30+
`MSB3096: Task 'task-name' is only supported when building on Windows.`
3131
<!-- :::editable-content-end::: -->
3232
<!-- MSB3096: Task "{0}" is only supported when building on Windows. -->
3333

3434
<!-- :::editable-content name="postOutputDescription"::: -->
3535
<!--
3636
{StrBegin="MSB3096: "}
3737
-->
38+
## Description
39+
40+
Certain tasks are only supported on Windows, because they use resources or tools that are only available on the Windows operating system. If you're building a project that depends on these tasks on another operating system, such as Linux or macOS, then you get this error. The tasks that produce this error are only relevant on Windows, because they relate to Windows-specific features such as application manifests.
41+
42+
The following tasks are only supported on Windows:
43+
44+
- [GenerateApplicationManifest](../generateapplicationmanifest-task.md)
45+
- [GenerateDeploymentManifest](../generatedeploymentmanifest-task.md)
46+
- GenerateLauncher
47+
- GenerateManifestBase
48+
- GetInstalledSDKLocations
49+
- GetSDKReferenceFiles
50+
- ResolveSDKReference
51+
- [SignFile](../signfile-task.md)
52+
53+
## Resolution
54+
55+
Build the project on Windows, if that is appropriate in your situation. In CI/CD environments, check pipeline configurations and be sure the pipeline is requesting a Windows build agent for the project.
56+
57+
For projects that are intended to build on Linux or macOS, you need to find out where in your build logic the request to the task mentioned in the error message is coming from. Turn on verbose diagnostics (use the `-v:diag` command-line switch), or generate a binary log (`-bl` command-line switch) and use the [MSBuild Structured Log Viewer](https://msbuildlog.com) to debug the build logic.
58+
59+
Check the documentation for the task in the [MSBuild task reference](../msbuild-task-reference.md) to see what its requirements are, and if any equivalent exists that supports your operating system.
60+
3861
<!-- :::editable-content-end::: -->
3962
<!-- :::ErrorDefinitionDescription-end::: -->
4063

docs/msbuild/errors/msb3097.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,22 @@ This article describes the MSB3097 error code.
2727
## Message text
2828

2929
<!-- :::editable-content name="messageText"::: -->
30-
`MSB3097: File 'value' is not a valid assembly.`
30+
`MSB3097: File 'filename' is not a valid assembly.`
3131
<!-- :::editable-content-end::: -->
3232
<!-- MSB3097: File "{0}" is not a valid assembly. -->
3333

3434
<!-- :::editable-content name="postOutputDescription"::: -->
3535
<!--
3636
{StrBegin="MSB3097: "}
3737
-->
38+
## Description
39+
40+
This error occurs when MSBuild tries to register an assembly for COM, but it failed.
41+
42+
## Resolution
43+
44+
Check the assembly mentioned in the error text to see if it built correctly and it's registerable for COM. Try registering it from the command-line using the command-line tools, [regasm.exe](/dotnet/framework/tools/regasm-exe-assembly-registration-tool) to see if it gives an error message that gives information about the problem.
45+
3846
<!-- :::editable-content-end::: -->
3947
<!-- :::ErrorDefinitionDescription-end::: -->
4048

docs/msbuild/errors/msb3172.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ This article describes the MSB3172 error code.
3535
<!--
3636
{StrBegin="MSB3172: "}
3737
-->
38+
## Description
39+
40+
This error occurs when MSBuild tries to read a manifest file, but some error occurs. The text from MSBuild is followed by a more detailed error message from the operating system.
41+
42+
## Resolution
43+
44+
Look to the detailed message for more information about the problem. Open the manifest file in an XML editor and check for any invalid syntax, or other unexpected or incorrect changes to the file.
45+
3846
<!-- :::editable-content-end::: -->
3947
<!-- :::ErrorDefinitionDescription-end::: -->
4048

docs/msbuild/errors/msb3232.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ This article describes the MSB3232 error code.
3535
<!--
3636
{StrBegin="MSB3232: "}
3737
-->
38+
## Description
39+
40+
This warning occurs when MSBuild tries to remove a directory, but the directory provided to the `RemoveDir` task was an empty string. See [RemoveDir task](../removedir-task.md).
41+
42+
## Resolution
43+
44+
If you're using `RemoveDir` in your project code or your own imported MSBuild files, review the parameters for the `RemoveDir` task, and make sure they're correct. Check that any property values provided have been defined at the point of the call, and have the correct value.
45+
46+
To find the `RemoveDir` code that produces the error and debug its parameters, enable diagnostic logging (use the `-v:diag` command-line switch for MSBuild), or generate a binary log (use the `-bl` switch) and use the [MSBuild structured log viewer](https://msbuildlog.com).
47+
3848
<!-- :::editable-content-end::: -->
3949
<!-- :::ErrorDefinitionDescription-end::: -->
4050

docs/msbuild/errors/msb3268.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,28 @@ This article describes the MSB3268 error code.
2727
## Message text
2828

2929
<!-- :::editable-content name="messageText"::: -->
30-
`MSB3268: The primary reference 'value' could not be resolved because it has an indirect dependency on the framework assembly 'value' which could not be resolved in the currently targeted framework. 'value'. To resolve this problem, either remove the reference 'value' or retarget your application to a framework version which contains 'value'.`
30+
`MSB3268: The primary reference 'assembly' could not be resolved because it has an indirect dependency on the framework assembly 'framework-assembly' which could not be resolved in the currently targeted framework. 'framework'. To resolve this problem, either remove the reference 'assembly' or retarget your application to a framework version which contains 'framework'.`
3131
<!-- :::editable-content-end::: -->
3232
<!-- MSB3268: The primary reference "{0}" could not be resolved because it has an indirect dependency on the framework assembly "{1}" which could not be resolved in the currently targeted framework. "{2}". To resolve this problem, either remove the reference "{0}" or retarget your application to a framework version which contains "{1}". -->
3333

3434
<!-- :::editable-content name="postOutputDescription"::: -->
3535
<!--
3636
{StrBegin="MSB3268: "}
3737
-->
38+
## Description
39+
40+
This warning occurs when your project references an assembly that itself has a dependency on a framework assembly that requires a different version of the framework. This is a warning because there's a risk to using the assembly in that case due to the version incompatibility.
41+
42+
## Resolution
43+
44+
As the error text indicates, there are multiple ways to resolve the issue. Which solution is appropriate in your situation depends on the project requirements and on how your project's code depends on the assembly that triggered the error.
45+
46+
- If you can target the application to the version of the framework mentioned in the error message text, then that would solve the issue. You might need to update your code if there are any compatibility issues with the updated framework version.
47+
- If you have a project requirement to target a particular framework version, then you can't use the version of the assembly you tried to reference. Try to find an earlier version of that assembly that that works with the framework you're targeting.
48+
- If there is no version of the assembly that's compatible with the framework version you're targeting, and you can't change the targeted framework version, then your only option is to not use that assembly. You then need to find a way to rewrite your code to avoid the dependency on that assembly.
49+
50+
For more information, see [Troubleshoot assembly references](../troubleshoot-assembly-references.md).
51+
3852
<!-- :::editable-content-end::: -->
3953
<!-- :::ErrorDefinitionDescription-end::: -->
4054

docs/msbuild/errors/msb3374.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ This article describes the MSB3374 error code.
3535
<!--
3636
{StrBegin="MSB3374: "}
3737
-->
38+
## Description
39+
40+
The error occurs when MSBuild tries to update the timestamp on a file, but it couldn't be updated. This could occur when the file exists, but its permissions are set to not allow write access, or it could occur when some other program, such as Antivirus software, has a lock on the file. The error from the operating system is shown after the MSBuild message text. In the case of a file lock, the message might contain the process or application that has the lock.
41+
42+
## Resolution
43+
44+
If the error indicates a permissions issue, update the file permissions to allow write access to the account that runs MSBuild.
45+
46+
If the error indicates a file was locked, if the message indicates the service, process or application that has the lock, try to disable the service, kill the process, or shut down the application. You can also try building again or building again after a system reboot.
47+
48+
If the file is generated by the build, review the part of the build process that generates that file and see if its permissions are being set incorrectly.
49+
50+
To help debug the issue use the diagnostic logs (`-v:diag` command-line option) or generate a binary log (`-bl` command-line option) and view it in the [MSBuild structured log viewer](https://msbuildlog.com).
3851
<!-- :::editable-content-end::: -->
3952
<!-- :::ErrorDefinitionDescription-end::: -->
4053

docs/msbuild/errors/msb3568.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ This article describes the MSB3568 error code.
3535
<!--
3636
{StrBegin="MSB3568: "}
3737
-->
38+
## Description
39+
40+
This error occurs when a resource file has more than one resource with the same name.
41+
42+
## Resolution
43+
44+
The resource name that has more than one occurrence is listed in the error message. If this is a manually maintained text resource file (`.resx` file) or binary resource file (`.resources` file), open the file in a resource editing tool such as Visual Studio, and manually remove the duplicate resources.
45+
46+
If the duplicate resource is from an automatically generated resource file, check the inputs to the script or tool that that modifies or generates the resource file.
47+
48+
For more information, see [Create resource files for .NET apps](/dotnet/core/extensions/create-resource-files).
49+
3850
<!-- :::editable-content-end::: -->
3951
<!-- :::ErrorDefinitionDescription-end::: -->
4052

docs/msbuild/errors/msb4017.md

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

3030
<!-- :::editable-content name="messageText"::: -->
31-
`MSB4017: The build stopped unexpectedly because of an unexpected logger failure.
32-
MSB4017: The build stopped unexpectedly because of an unexpected logger failure.`
31+
`MSB4017: The build stopped unexpectedly because of an unexpected logger failure.`
3332
<!-- :::editable-content-end::: -->
3433
<!-- MSB4017: The build stopped unexpectedly because of an unexpected logger failure.
3534
MSB4017: The build stopped unexpectedly because of an unexpected logger failure.
@@ -47,6 +46,15 @@ MSB4017: The build stopped unexpectedly because of an unexpected logger failure.
4746
-->
4847
<!-- :::editable-content-end::: -->
4948
<!-- :::ErrorDefinitionDescription-end::: -->
49+
## Description
50+
51+
This error occurs when a logger fails while logging an event, most likely because of a programming error in the logger. When a logger encounters a fatal error, MSBuild can't continue with the build, and you get this error. The message text from MSBuild is followed by the exception or error from the logger.
52+
53+
## Resolution
54+
55+
If this is occurring when using your own custom logger, you have to debug the logger itself to diagnose and fix the error, and then rebuild the logger and try building again.
56+
57+
If this occurs with a built-in logger, then it's either an engineering defect in MSBuild, or a system issue such as an out-of-memory error. If you suspect a MSBuild bug, see [Report a problem](../../ide/how-to-report-a-problem-with-visual-studio.md), or enter an issue at [https://github.com/dotnet/msbuild].
5058

5159
## Applies to
5260

docs/msbuild/errors/msb4023.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ This article describes the MSB4023 error code.
3737
%(RootDir) to an item-spec that's not a valid path, would result in this error.
3838
LOCALIZATION: "{1}" is a localized message explaining the problem.
3939
-->
40+
## Description
41+
42+
This error occurs when the value of an item metadata can't be computed, usually because the item wasn't a file or path, but the metadata only applies to files or paths. For example, this error occurs if you try to invoke the `%(RootDir)` metadata, but the item is not a path.
43+
44+
## Resolution
45+
46+
Review the build logic in the project file or one of its imported where the error occurred. Check that the item in the expression that causes this error is valid and set correctly, or remove the use of that metadata. Refer to the documentation for the metadata at [MSBuild well-known item metadata](../msbuild-well-known-item-metadata.md).
47+
48+
To help debug the issue, generate a diagnostic log (use the `-v:diag` MSBuild command-line option), or generate a binary log (`-bl` command-line option) and use the [MSBuild Structured Log Viewer](https://msbuildlog.com).
49+
4050
<!-- :::editable-content-end::: -->
4151
<!-- :::ErrorDefinitionDescription-end::: -->
4252

0 commit comments

Comments
 (0)