"XAMLTaskFactory" could not be loaded from Assembly - visual-studio

I've been trying to run x86 assembly code on my machine for schoolwork. Sadly I've been getting this error when trying to build the project files and I can't figure out what it's about and how to fix it:
Error MSB4175 The task factory "XamlTaskFactory" could not be loaded from the assembly "Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". The system cannot find the path specified hi C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\masm.targets 70
Has anyone had the same problem? I've tried making new projects, running as administrator, done a clean install of Visual Studio and all the packages, even factory reset my laptop.

Related

VS Community - Cannot run a simple console application: Could not load file or assembly ‘System.Reflection.Metadata'

I’ve installed Microsoft Visual Studio Community 2019 Version 16.9.4 and tried to create a simple console application to print “Hello World”.
If I run the app with dotnet run from the Windows Command Prompt, it will run successfully, but opening the project in VS and trying to start the console app is causing the following error:
Unhandled Exception: System.BadImageFormatException: Could not load file or assembly ‘System.Reflection.Metadata, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The file or directory is corrupted and unreadable. (Exception from HRESULT: 0x80070570)
I’ve already tried to start the console app as x86 and x64, but that did not help.
Another attempt was to uninstall VS 2019 and install VS 2017 Community. Have the same exception when I build the console app.
Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'System.Reflection.Metadata, Version=1.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The file or directory is corrupted and unreadable. (Exception from HRESULT: 0x80070570)
Could someone please help me with this?

Could not load file or assembly 'System.Web.RegularExpressions, Version=4.0.0.0

Last night I upgraded my Visual Studio 2017 to the latest version 15.7.0. Since then all my projects are not running any more.
The error I am getting:
Could not load file or assembly 'System.Web.RegularExpressions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
I tried adding manually a referece to the DLL, I am still getting the error
I fixed the issue by 1) updating Visual Studio from 15.7.0 to 15.7.1 2) repairing the installation

Could not load file or assembly 'Microsoft.CodeAnalysis" in visual studio 2015

I am creating an android app in visual studio 2015. While building the solution I am getting this error :
The specified task executable "csc.exe" could not be run. Could not load file or assembly 'Microsoft.CodeAnalysis, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
I have update my visual studio as well. but nothing is working for me.
Here is snapshot of error:
try to run visual studio as administrator or repair your visual studio from programs
see this post:
Visual Studio 2012 csc.exe Error. Executable not valid for OS

Getting error in visual studion whenver i publish

I formatted my system recently and installed windows 7. so i installed all software again. when after i installed VS it is working fine only. but when i am build / publish it is showing an error. how to resolve this issue?
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9):
Warning MSB3245: Could not resolve this reference. Could not locate
the assembly "System.Web.WebPages, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to
make sure the assembly exists on disk. If this reference is required
by your code, you may get compilation errors.
Is i have to install something ah? please instruct me?
Check if the "System.Web.WebPages" dll is available in the solution/project references. If not add it (the required version). clean solution, build again. Publish.
Hope this helps.

Visual Studio unable to read the project file (anymore)

Ever since my latest windows update, (which system restore is failing to undo) I can't load any projects with visual studio 2010. The project are greyed out (unavailable) and when I try to reload them I get the error:
C:\Users\Benoit\Documents\Visual Studio 2010\Projects\Test123\Test123\Test123.csproj : error : Unable to read the project file 'Test123.csproj'. Could not load file or assembly 'Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
I tried creating new projects: same error
I tried creating different type of projects (command prompt, silverlight, windows phone): same error
Deleting the .suo and .user files did not change anything
I did not move the projects
Using Visual Studio 2010 with Windows Vista
It looks like the Global Assembly Cache (GAC) is messed up, or possibly the update has done something with the Microsoft.Build assembly file itself.
Try repairing .NET 4.0, and if that does not work you can try completely uninstalling and reinstalling the framework.

Resources