C# - error : Unable to read the project file - c#

Have a bigSmall problem here.
I cant open any type of project in visual studios. Even when i creating a new one I get the error:
C:\Windows\Microsoft.NET\Framework\v4.0.30319
The element <#text> beneath element is unrecognized.
When I choose to open a SLN file or open trough File>Open>Project/Solution I get an other error:
One or more projects in the solution were not loaded correctly.
Please see the Output Window for details.
Anyone knows? Seen some solutions on the net but it doesnt seem they help me with this.
Thanks.
<>
I have reinstalled Visual Studios but the bug remain.. Seriously. Ripping my hair of. Really need this to work!

Have you maybe installed a Plugin that make problem?

I had the same error. What I did was replace the ControldeMenu.csproj that is found in the project directory, for a backed-up copy, that was what worked for me.

I uninstalled and reinstalled the .NET framework and resolved the issue.

Related

Default template for ASP.NET project in VS Community 2019 not working

So a little bit of context here, I'm completely new to C# and ASP.NET, I was following this video to help setup my project and learn the basics. I downloaded VS Community 2019 (I usually use VS Code) and tried to create a new project, the creation process is not exactly the same as the video (I assume it's a difference from Visual Studio to Visual Studio Community) but I thought that it's not different enough to be a problem.
Right after creating the project, I tried running it to check that everything is fine, but it said that there are build errors and asked if I want to run it anyway, I said yes, that's when I got this error:
I assume it's a generic error that doesn't explain what exactly went wrong, so I went to check what those build errors are, and to my surprise, there are a lot of them :
I copied some of them to look for a reason why this is happening but haven't found anything meaningful so here am I, asking here. Any ideas ?
Thank you for reading.
Edit : I recreated a project with Authentication Type "None" and it works without any problem. Retried after that with Authentication Type "Individual Accounts" and I get the build errors again. Is there something missing in my PC that I need to install or add to the project ?
I'll try to answer this as accurate as possible;
but it said that there are build errors and asked if I want to run it anyway, I said yes, that's when I got this error
This will not work. The build must succeed (at least once) in order to be able to start.
The difference might be due to a different version of visual studio, or a different template. The errors suggest you are missing some nuget packages or references.
Best you can do is find an up to date tutorial or follow the steps very precise.
Alternatively, you can start with a simple default template - those should work out of the box and you can build from there.
The snapshot you posted with the errors tells you exactly what's wrong. You are missing the packages as they don't exist in the local cache.
Try this:
Go to Menu Tools > Nuget Package Manager > Manage Nuget Packages for Solution...
On the new window that opens, verify that the Package Source combo box in the top right corner is set to "nuget.org" or "All".
That should allow Visual studio to go to the web looking for the missing packages and restore them.
Alright, finally found the problem, like Stefan said, it's a NuGet package problem.
There was no online source for the packages, so I added it like this :
Name : nuget.org
Source : https://api.nuget.org/v3/index.json
After that, you go to Project -> Manage NuGet packages -> Updates -> Select all packages and update. Then you need to create a new project (already created ones don't work and I don't exactly know why).

Predefined type 'System.String' is not defined or imported

I have an MVC5 application which I'm trying to run offline. I installed VS2017 offline but when I try to build the project it throws multiple errors relating to it missing all the .NET assemblies and dlls. When I try to add these assemblies they're not available to be added. Anyone please help.
PS: there's NO internet on the machine.
I also have that problem from time to time. What usually helps is to do a dotnet restore. This is different to running restore from the solution explorer within VS, you have to do it through the command line. In order to execute it, you need to have the .NET Core SDK installed. dotnet restore is usually very good at fixing some project problems such as corrupted .json files that VS creates behind the scenes and I would guess that it is able to repair those files without internet connection, but I haven't tried.
Try cleaning and rebuilding your solution. I had this issue and something went funky with my dll's.
It's obvious omnisharp error same as mine. I changed omnisharp path version from c# extension(c# > unistall > install another version) and reopened to vscode. It worked for my project. All error has gone.

Xamarin obj\Debug\libraryimports.cache does not exist

I am new at Xamarin.Android with Visual Studio 2015 and tried to create a little test application.
As soon as I create the new project, a warning appears:
obj\Debug\libraryimports.cache does not exist. No Imported Libraries found.
If I try to start the application, VS tells me, that there is a problem and asks me to go further.
I tried to reinstall Xamarin and Visual Studio and tried to create the Project on my Desktop.
In every case it shows me the same Warning.
Can anybody help me?
For me it helped to move the whole Visual Studio solution to a path with only ASCII characters.
Move the solution to c:\new_folder\solution. new_folder and solution must contains only ASCII characters. My username in windows has "í".
This solution work for me.
Looks like reinstalling is the only known solution: Rebuild failed: ''obj\Debug\libraryimports.cache does not exist. No Imported Libraries found''

visual studio 2010 could not load file or assembly

I know there is plenty of question on that subject, but I didn't find any useful answer about my problem.
I got a project from a co-worker using mercurial. Now when i open the project I cannot open any C# file and I get the following message:
Could not load file or assembly, 'Microsoft.MSXML, Version =8.0.0.0,Culture = Neutral, PublicKeyToken=b03ff5f7f11d50a3a' or one of its dependencies. The file specified is unfindable.
Any idea? I don't know exactly what is in the code, in fact I've never see or programmed the code until now, but I know the code is working and my co-worker manage to make a installer and the software is working fine.
Try to install Microsoft Core XML Services to solve this problem
There was a problem inside Visual Studio 2010.
My resolution was:
I tried to create a basic C# applicaiton but the same error message pop-up
I tried to re-open a old project that I used to work on but the same error message pop-up.
So I used the following utility. I made a fresh install and how everything is working. I don't think it is the most efficient solution , but it worked.
Simply delete all folders in this path then rebuild your project.
C:\Users\'username'\AppData\Local\Temp\Temporary ASP.NET Files\root

Missing project sub type error when trying to create a new MonoGame project

Hello Im using Visual Studio 2012 and whenver I try to create a new MonoGame content project I get this error...Also if I try to start a windows Mono project or a Android mono project I dont get the same error but whenever i try to compile i get errors, i have unstillaed Mono and xamarin and tried installing and that never solved the issue the only thing left to do is uninstall Visual Studio 2012 but that can take a ton of time so if anyone here can help me it will be appreciated here is the link to the following error.
I think I have a workaround for you, although, I still don't fully understand the issue myself and I'd love someone to shed some light on it.
If you open up the project file as plain text you will see a ProjectTypeGuids like so:
<ProjectTypeGuids>{9B831FEF-F496-498F-9FE8-180DA5CB4258};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
If you Google each GUID you will find that one of them is DotNetProjectSubtype id="MonoGame" and the other is Windows (C#).
As far as I can tell you can safely delete the MonoGame one and proceed with your day. I believe it's only used at project creation time.

Categories

Resources