-3

Everything was fine, I was following along with a course when all of a sudden this error appears, I revert the changes to when the project ran fine but the error still persisted.

I haven't changed anything in regards to .NET versions the error was very surprising to me. Any help?

My code:

var app = builder.Build(); 

I get this error:

TypeLoadException: Could not load type 'System.Runtime.CompilerServices.NullableAttribute' from assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

I will be happy to provide any additional information, this error has set me back too much so I appreciate all the help.

github link to the project

I just added areas just like done in the course video I was following, moved controllers and other things in them. just as seen in the github project files, nothing major, why would it cause such error, even when I reverted the changes the error was still there

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • You have a runtime error. The code is compiling properly. You may be missing data. Check the course material again and see if anything that you installed was deleted like files. – jdweng Sep 02 '23 at 15:12
  • can't see what i'm missing to be honest, I also didn't have any added files or anything like that. i just closed the visual studio after making sure everything worked and next time i opened it this error appeared. i'm still clueless – Nika Khurtsilava Sep 02 '23 at 15:47
  • An intermediate file with got deleted and is now missing. Best to review the curse and see what is missing. – jdweng Sep 02 '23 at 17:28
  • just checked the github for the course, i have everything the same, nothing seems to be missing :/ – Nika Khurtsilava Sep 02 '23 at 18:44
  • Go to each project csproj file and double click and see if each one compiles. Compile by using menu Build : Rebuild Solution. Probably this is the first time you are actually running after removing the build errors. Rebuild will remove intermediate Files. Also check the course material and see what version Of Net/Core the target should be. I'm getting an error that wrong Target is being used. – jdweng Sep 02 '23 at 19:29
  • you project is targeting Net 8 SDK preview. Does your course material indicate the version? This is a preview library and may be the reason for the error. I would try the Net 7 SDK will last update was August 8. – jdweng Sep 02 '23 at 21:31

0 Answers0