27

I've made a new content page, but forgot to type the name.. So I deleted it an made it again with proper name..

I have done it like this multiple times already, but this time something went wrong and I cannot compile. I have this error message:

Severity    Code    Description Project File    Line    Suppression State
Error   IDE1100 Error reading content of source file 
'C:\Users\shark\source\repos\GalShare\GalShare\GalShare\Views\Page1.xaml' -- 'Could not find file 
'C:\Users\shark\source\repos\GalShare\GalShare\GalShare\Views\Page1.xaml'.'.    GalShare-XamlProject     
C:\Users\shark\source\repos\GalShare\GalShare\GalShare\Views\Page1.xaml 1   Active

I have done nothing except the steps above.. What is the cause of this error and how can I fix it?

7 Answers 7

48

Cleaning the project did not solve, but closing and reopening solved my problem.

0
20

In addition to the answers of E.Zhao and messyprogrames, here a step-by-step walkthrough.

Clean Solution:
Navigation Bar > "Build" > "Clean Solution"

enter image description here

Unload project:
Choose your "problem project" on the right side within the solution explorer. Right mouse click > "Unload Project"

enter image description here

Reload project:
Choose your unloaded "problem project" again. Right mouse click > "Reload Project".

enter image description here

1
  • 2
    unfortunately this did not help me at all
    – AlThePal78
    Commented May 24, 2022 at 7:41
10

Opening and closing the solution wasn't helping, but unloading and reloading the project worked.

1
  • I had the same experience. Deleting the obj folder, closing and re-opening visual studio did not help, but cleaning the solution then unloading and reloading the problem project fixed it. Side note: I'm working in a .NET Framework project, not a Xamarin project, but the problem appears to be the same.
    – Matt
    Commented Jul 13, 2023 at 18:39
4

Actually, it is unnecessary to exit and reopen current solution, try to clean the error project, unload and then reload it again. hope it works for you.

0
3

Watch out if you get this issue and you have changed to using Project References.

Stackoverflow Approved Graphics:

enter image description here

So changing App to have a Project Reference to Lib A will cause problems if you have another Library B that uses a NuGet Reference to the same Lib A.

You have to change the Nuget ref back to be a Project Reference as well.

2

Unloading and reloading the project worked for me.

To reproduce this, in a new folder add a WPF user control with a accidental typo.

Rename with F2 or simply rename, the code behind doesn't rename, so change that. Initalize component gets a good old red squiggly!

create a new one with an appended number as you want to crack on... delete the user control that you originally created.

You will get this error (well I did on enterprise edition Version 16.7.2)

Then as other contributors have suggest, remove the pain by unloading and reloading the project.

2

In VS click your initials > Account Settings > and check there's no warning there asking you to re-fresh your credentials. It was this for me. After I re-entered my credentials, cleaned and rebuilt all was fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.