Visual Studio Error: Unable to load the file or assembly
Solved
Anonymous user
-
Anonymous user -
Anonymous user -
Hello, while I was quietly developing a WinForms app in C#, I decided to run it, and then a Visual Studio error appeared:
"Could not load the file or assembly 'projectname, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The specified file is not found."
So I decided to close and restart Visual Studio, and all the content of my forms disappeared. I encountered the problem again when trying to recreate my app. If anyone can help me, I would appreciate it as I haven't found a solution to my problem.
Thanks in advance to everyone who replies.
Azeur
"Could not load the file or assembly 'projectname, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The specified file is not found."
So I decided to close and restart Visual Studio, and all the content of my forms disappeared. I encountered the problem again when trying to recreate my app. If anyone can help me, I would appreciate it as I haven't found a solution to my problem.
Thanks in advance to everyone who replies.
Azeur
1 réponse
Hello
It may be due to a crash or bug in Visual Studio during the save process (files are saved first during compilation).
As a result, some are corrupted and boom.
If you're using a free version of VS (Express or Community), this can happen more often than with the pro versions (which are far from free...)
I assume you haven't made any backups (copies over time) or versioning.
This is the best way to avoid this kind of problem
That’s for the future; if you want to prevent this kind of trouble from happening again, I wrote a little tutorial on a versioning solution https://codes-sources.commentcamarche.net/faq/11714-suivre-les-versions-d-un-code-source-avec-git-et-sourcetree
For today, you'll have to play the apprentice wizard, worst case you further degrade your project.
It's up to you to decide if you want to try.
In the constructor of each form, there is a method called InitializeComponent.
Right-click / Go to Definition.
This will lead you to a hidden file that contains everything that VS writes for you when you "play" with design mode; in short, the entire interface is described in lines of code.
You need to try to find the ones that are corrupted and fix them.
VS can help you by flagging errors.
--
When I was little, the Dead Sea was only sick.
George Burns
It may be due to a crash or bug in Visual Studio during the save process (files are saved first during compilation).
As a result, some are corrupted and boom.
If you're using a free version of VS (Express or Community), this can happen more often than with the pro versions (which are far from free...)
I assume you haven't made any backups (copies over time) or versioning.
This is the best way to avoid this kind of problem
- backup => you restore the project to the state it was in at the last backup
- versioning => you start by trying to restore lines, blocks, or entire files, and as a last resort, you revert to the previous version.
That’s for the future; if you want to prevent this kind of trouble from happening again, I wrote a little tutorial on a versioning solution https://codes-sources.commentcamarche.net/faq/11714-suivre-les-versions-d-un-code-source-avec-git-et-sourcetree
For today, you'll have to play the apprentice wizard, worst case you further degrade your project.
It's up to you to decide if you want to try.
In the constructor of each form, there is a method called InitializeComponent.
Right-click / Go to Definition.
This will lead you to a hidden file that contains everything that VS writes for you when you "play" with design mode; in short, the entire interface is described in lines of code.
You need to try to find the ones that are corrupted and fix them.
VS can help you by flagging errors.
--
When I was little, the Dead Sea was only sick.
George Burns
Anonymous user
Thank you for your help. I will try to recover my project by fixing the possible errors. But otherwise, in the future I will make regular backups and/or versioning on my projects to avoid this kind of problem.