MSB4018: The task failed unexpectedly


May 14, 2022
Programming Experience
Hi, after reinstalling Visual Studio, I get the error in question by recompiling a program that I had previously written and that worked correctly.
At the same time it is also reported that the "AssemblyInfo.cs" file is not found
I tried to reset visual studio and update packages but i can't fix the problem, does anyone know how to fix it?
At the same time it is also reported that the "AssemblyInfo.cs" file is not found
Did you check whether the file is there or not? Is it there or not? What type of project is it exactly and what framework is it targeting? I'm guessing that it's targeting .NET Framework rather than .NET Core, as I don't think the latter uses that file. If you create a new, similar project, do you see that file included? If you do and it's missing from the other project, you could copy it across and edit it appropriately.

This is also an example of why everyone should be using source control. If strange things like this happen for whatever reason, you can always roll back to a previous good version.
Hello, yes net framework, a console type program, I had the backup on an external disk and I copied it to the same location on the internal disk where it was before the problem, the AssemblyInfo.cs file is present in the backup, only I need to recompile the project, when I recompile it the AssemblyInfo.cs file disappears, it is deleted.
Where exactly is that file located? Is it under Properties, both in the Solution Explorer and the file system? If you open the project file in a text editor, is that file referenced? I just opened a basic .NET Framework Console app project file and I saw this:
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
Do you see something similar?
It's a simple console app, I've also tried creating a new project, and compiling the default line of code that prints "Hello World", it gives the same error.
No, I didn't have any specific problems, just a crowded disk so I decided to format it and install only the strictly necessary applications, then I reinstalled Visual Studio and I started having the problem.
I've already tried to repair via the installer, and it didn't fix it, but I could uninstall and then download Visual Studio again and try installing again.
Top Bottom