MSBuild Build Error with ImageList in Windows Forms C#
Mahmoud Khaled
0
Reputation points
Details
Encountering build errors when using the ImageList
control in a Windows Forms application built with C#. The following errors are present after attempting to run the program:
Errors:
- Task host node exited prematurely. Diagnostic information may be found in files in the temporary files directory named MSBuild_*.failure.txt.
- The "GenerateResource" task's outputs could not be retrieved from the "FilesWritten" parameter. Object does not match target type.
Several attempts have been made to resolve the issue:
- Fixed
.resx
file corruption, as theImageList
component stores image resources in.resx
files (e.g.,Form1.resx
). - Ensured correct image formats, confirming that images in the
ImageList
are in formats like PNG, BMP, or JPEG. - Cleaned and rebuilt the project using MSBuild commands:
dotnet clean
dotnet restore
dotnet build
- Verified .NET SDK installation.
- Checked for architecture mismatch, ensuring the project’s target architecture (x86/x64) matches the SDK installation.
- Disabled MSBuild node reuse by adding the
/nodeReuse:false
option.
Despite these efforts, the same issue persists. Any guidance on resolving this problem would be appreciated.
Sign in to answer