Visual Studio Cannot Open File - visual-studio

I'm working on my first project in Visual Studio and I haven't used Windows much since '05, so please bear with me.
I've got my project open in Visual Studio 2008, and I'm trying to open a particular file for editing, but I get an error that says
"c:\path\to\file
Cannot open file.
I've verified that the file exists, and I can open it from Windows Explorer, but nothing from inside Visual Studio, any ideas?
I'm not familiar with Visual Studio, so my terminology might be incorrect.
The file appears in the tree in the Visual Studio Explorer pane, so I double clicked it, and got the error. The error said nothing more than the file path: Cannot open file.
How can I check permissions/ACLs in Windows? I assumed that since I could open it in Windows Explorer, I would be able to open it in Visual Studio.
And it's a .cpp file.

You may want to right-click on the file in the tree, and delete it from the project.
Then, add back an existing item.
Hopefully that will fix the problem.

Though I'm not familiar with this specifically, if you just want to move forward, I'd recommend creating a new project type and just adding all the existing files to it. Should be quicker and easier than diagnosing what could be many issues.
Other things to check: encoding type of the project file, permissions/ACLs (can you open that actual file from an unelevated VS prompt, for instance), etc.

Additionnaly to the other answers, I found out that this problem may arrise if the target .Net framework version specified in the project file isn't installed.
This seems to prevent visual studio from opening all the files contained in the project, and showing the "Unable to open file " message.
Correcting the version (in the csproj file or in the settings), saving and reloading the project fixes the problem.

I had same problem, my project were build on (.Net 4.5), which I uninstalled on my PC and replaced by (.Net 4.8), so just replacing project's target framework to the one which is installed "in my case (.Net 4.8)" should fix it.

Related

"The project file was unloaded" when moving VS2010 project to another server

I have moved a Visual Studio 2010 project to another server by copying and pasting the folder contents into another folder on a different server.
My understand was that VS2010 handled this well; when I have done this locally it has never been an issue.
Now I get an error like this:
When I right click and "Reload project", the list of files briefly appears before disappearing again, giving the original error.
Am I doing something wrong?
I experienced the same problem today. Here is what I did and worked for me :
Open the .sln file.
Right click on the project folder and click Reload project.
You will see the projects and folders that you originally had.
You will see .xml publish file . Double click it .. You should be good to go now.
I had this problem today and it took me a while to figure out what was going on.
Your problem is most likely that your solution was originally made with a Visual Studio configuration that contained support for certain project types (such as "Windows Service" or some other exotic project type). The Visual Studio configuration you are using to import your solution does not have that support. In other words,
there is probably nothing wrong with your solution,
there is probably nothing wrong with your project,
there is probably nothing wrong with any of the files (as you mentioned they do display briefly, giving you a second of hope)
Just run the installer on the new Visual Studio and make sure the support is enabled for all the project types you need and try again.
In my case the problem was the .vbproj file had somehow been corrupted so the normal xml code was replaced with a long string of null characters. I noticed this thanks to a file that was generated in the same folder as the project file when I tried to open the project - it was called 'UpgradeLog.htm'. This had an entry saying ' Error on line 1. Expected '<' but found 'null character'.'.. suggests there may have been a recent update to Visual Studio that I hadn't noticed?
Luckily I could use my source control system to revert back to a slightly earlier version - I guess it shows how important it is to have backups!
In my case, I saw similar message (Projected was unloaded) and all I had to do was simply re-launching Visual Studio (2017) in Admin mode and the problem went away. Per one of the above answers, I tried to right-click and selected Reload but got a warning that, due to required access to IIS on the machine, I had to launch VS in Admin mode.
HTH
Found this answer and it worked for me.
Note:Sometimes, the path in File path property is grayed out and you are unable to get to the Browse button. In this case try deleting .suo files. Don’t worry, these files gets recreated when you rebuild the solution / project.
http://www.howtosolutions.net/2013/02/solving-project-file-error-could-not-find-part-of-the-path-with-visual-studio/
I had the same problem. I fix path to .csproj files in the .sln file with a text editor and now it is all ok.
Open Visual Studio as Administrator

Copy/Move Visual Studio Projects/Solutions To Another Computer

So I have a handful of Visual Studio projects that I need to move to another computer. Is it as simple as a copy and paste or will that mess something up? Both machines will have the same version of Visual Studio installed, so that shouldn't be an issue.
Is there an export function that I've overlooked?
If the Visual Studio version is the same, you can just copy the project folder.
Till the time you are moving your solution file and associated files you should be good.
In case you are using any source control update your solution from there.
Hope you have the same VS version and any addon frameworks you have
You can directly copy the project to the projects folder. This worked perfectly for Visual C++ projects for me (and also some other projects). But when I copied my Cordova App from one PC to the other (Both had Visual Studio 2015), I wasn't able to open the project. Whenever I tried to open the project, trying both the ways - directly from the Project file and the open option in Visual Studio, it at first opened but when I tried to open a file, it just got hung and didn't respond.
This problem may occur because Cordova apps have some configuration files that might be different for different PCs. I am not sure that this is the reason for the problem.
A solution that I used was that I created a new Project and copied the files to the project folders (excluding the configuration files).
Can you save the file to cloud? if so then you could potentially upload the file to cloud and download the file to the new

Error HRESULT E_FAIL has been returned from a call to a COM component VS2012 when debugging

I have a problem debugging a project migrated from Visual Studio 2010 to 2012. Every time I go to debug it I get the error message:
"Error HRESULT E_FAIL has been returned from a call to a COM component".
Compiling and running the application in a local IIS server works fine - just cannot debug.
The other change other than moving to VS2012 is I am now using Team Foundation Server for source control and issue tracking - but I cannot see how that would affect it.
I can narrow it down to the following
The project file - it has been migrated from VS 2003 as a website project and has been chopped and changed up the different versions
Crystal Report runtime library/ some other library
Anyone with any ideas?
I had the same problem with a c++ project in Visual Studio 2019.
The following solution worked for me:
Close Visual Studio.
Go to the project's root folder and delete the .vs directory.
Start Visual Studio and open the solution.
The build should now work.
I have been getting this a lot lately. I've been having to create a new file and move the code to the new file to get around it.
I fixed it by deleting the solution's suo file (as far as I can tell, it just stores info like what files are open in the IDE and stuff, and deleting it does no real damage).
My file was seemingly corrupt. (The IDE wouldn't remember what files were open when restarting. It was 1.7MB in size, which seems large, even for my 40 project solution, which rarely has more than 50 files open at once.)
Edit: I just recently had to do this in VS2017 but for another reason, it was taking longer to build and took 5+ minutes to stop a debug session, deleting that pesky suo file fixed it right up, now anytime VS acts weird deleting SUO is my first port of call.
I removed the csproj.user files and it worked for me.
In some other cases, to fix this error, I go to Web tab in the project properties and check "Use Visual Studio Development Server" and "Auto-assign Port". After that I need to rebuild the project and restart VS
This solved my problem:
Start —> Run —> regsvr32 %SystemRoot%\System32\msxml3.dll
Start —> Run —> regsvr32 %SystemRoot%\SysWOW64\msxml3.dll
Before this I tried the above solution from Simon, but didn't work for me!
Perhaps combining these two solutions did the job!
Sorry to revive a dead thread but i solved this on VS2017 by deleting the project template cache and item template cache folders in
%localappdata%\Microsoft\VisualStudio\[BUILD]
Then resetting the visual studio settings via
Tools>Import and export settings>reset all settings
Also ive heard turning off "Lightweight solution load for all projects" can help.
Doh! In case anyone else gets this error when trying to attach to an IIS Website.
Triple check that your hostname is correct, I had forgotten a '/' in (e.g.) http://my.testsite.com
Try this before re-installing Visual Studio like I did.. Terrible error message..
I wanted to add that I encountered this error when opening designer file in WinForms app. My issue was that one of the references in the project was referencing itself. Apparently this can happen as mentioned here
https://social.msdn.microsoft.com/Forums/office/en-US/00aede04-d8cd-4475-8114-4b4792261052/winforms-designer-error-hresult-efail-has-been-returned-from-a-call-to-a-com-component
I removed the reference and it is working fine.
Maybe this page helps:
Scenario Two:
The Microsoft Visual Studio 2010 IDE crashes while creating OR debugging a web application project.
This above error occurs because of corrupted Cache of Visual Studio 2010. In order to resolve the issue just delete the project Cache from the below location:
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplatesCache
C:\Program Files(x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplatesCache
Then run devenv.exe /setup to re-build the cache.
I tried all of the above solutions none work for me, I found the solution here
Open ActivityLog.xml by going into
C:\Users\{UserName}\AppData\Roaming\Microsoft\VisualStudio\15.{Id}
Check if error states that
"CreateInstance failed for package
[ReferenceManagerPackage]Source: 'mscorlib' Description: Could not load type
'Microsoft.VisualStudio.Shell.Interop.' from assembly
'Microsoft.VisualStudio.Shell.Interop.11.0'
Then run this gacutil command through VS Cmd prompt (admin mode):
Navigate to
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\PublicAssemblies
Run gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll
It seems that to bring up the Add Reference dialog in Visual Studio 2017 the Microsoft.VisualStudio.Shell.Interop.11.0.dll needs to be regsitered in the GAC. You can follow these steps to register this assembly in the GAC:
Open the Develop Command Prompt for VS2017 (ensure you run the as administrator otherwise the GAC registration may fail)
Change the current directory to the PublicAssemblies folder for your Visual Studio 2017 installation. Mine was:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies
Run the following command to register the assembly in the GAC:
gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\PublicAssemblies>gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll
Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.0
Copyright (c) Microsoft Corporation. All rights reserved.
Assembly successfully added to the cache
Now restart VS2017 and try to add a reference to your project again and you should see the Add Reference dialog appear.
For more clarification please follow below link
https://camerondwyer.com/2017/05/03/how-to-fix-the-operation-could-not-be-completed-error-adding-reference-to-visual-studio-2017/#more-2286
I found the solution below on https://developercommunity.visualstudio.com/content/problem/260196/add-a-reference-raise-error-error-hresult-e-fail-h.html address.
It worked for me in VS 2019:
1 Open "Developer Command Prompt for VS 2017" as Admin
2 CD into "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\PublicAssemblies"
3 Run "gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll"
After a restart, it all worked well.
I had the same issue after an upgrade from VS2013 to VS2015.
The project I was working at referenced itself. While VS2013 didn't care, VS2015 didn't like that and I got that error. After deleting the reference, the error was gone. It took me around 4 hours to find that out...
Just delete packages folder.That helped me
Root Cause:
Microsoft.VisualStudio.Shell.Interop.11.0.dll is missing from GAC.
Solution:
1. Go to start menu and Open Command Prompt for Visual Studio
2. Enter command gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll
3. If in case your system unable to find this dll file then you may download it from Nuget package manager and then can provide the path of dll
All set! hit enter and you're done!
In my case, it seems it was because I stashed some files, but some related windows remained open.
Closing all windows and rebuilding solution fixed it for me.
I wrote a simple program to open different folder while clicking on some specific buttons. I made the file properties as "content" and "copy if newer" to make deployment. So if I installed the exe file in the other software it actually install all of its resources and run the program fine.
So, this is all about my program. While developing this sometimes if I run the program to check, it showed the error
"HRESULT E_FAIL has been returned from a call to a COM component"
and I could not open the designer view. But Somehow I got an easy solution for me. I am not sure whether it will work for other or not.
Here is the solution:
Copy the whole application folder to another location. click on the application file from there.
it will not work since it is just a copy and you will not see the designer
From the solution explorer delete the form1.vb ( or may be a different name if it was changed during developing)
In the solution explorer>right click>add an existing item> browse the file Form1.vb from where the folder is copied ( orginal location)
run the program in the new location. It will work
The problem with this solution if you want to add something and after running the program you find the same error, you have to copy the whole application folder in another location again and follow the above steps
Not sure about the exact reproduction steps for the error (HRESULT E_FAIL has been returned from a call to a COM component), but the solution for me was:
Close Visual Studio and Repair it through Control Panel.
Restart system
After the restart, the error was gone.
The error occurred for me after I installed the latest Windows 10 SDK. I was getting the error while building a C++ project using SDK 8.1. In Project properties, I switch to latest 10 SDK. rebuild. That worked. Changed back to 8.1. Rebuild. No error.
Steps to resolve the issue:
1.Open your solution/Web Application in VS 2012 in administrator mode.
2.Go to IIS and Note down the settings for your application (e.g.Virtual directory name, Physical Path, Authentication setting and App pool used).
3.Remove (right click and select Remove) your application from Default Web Site. Refresh IIS.
4.Go back to VS 2012 and open settings (right click and select properties) for your web application.
5.Select Web.In Servers section make sure you have selected "Use Local IIS Web Server".
6.In Project Url textbox enter your application path (http://localhost/Application Path). Click on Create Virtual Directory.
7.Go to IIS and apply settings noted in step 2. Refresh IIS.
8.Go to VS 2012 and set this project as startup Project with appropriate page as startup page.
9.Click run button to start project in debug mode.
This resolved issue for me for web application which was migrated from VS 2010 to 2012.Hope this helps anyone looking for specific issue.
My machine configuration is:
IIS 7.5.7600.16385
VS 2012 Professional
Windows 7 Enterprise (Version 6.1 - Build 7601:Service Pack 1)
This happens in our TFS build server some times (Gated check in). It is about workspace folder. I don't know why but workspace folder access sometimes corrupt. What I am doing to fix issue is deleting TFS build workspaces and deleting relevant workspace folders. TFS build machine then create new workspaces for itself and problem is fixed.
Tousif Ahmed's solution should work for local builds. Copy application folder to another place should do the same thing what I am doing in TFS build machine.
In my case, it appears that this message can be issued by Intellisense in Visual Studio 2013. The screenshot below shows the error at the bottom of VisualStudio 2013 after the first load of a customer project.
I started googling what causes this error, and decided to try deleteing the user.vxproj files as mentioned above. I found however that the project built with no issues, then after exiting and re-loading the project, I no longer received the error. So I'm assuming in my case, it was some corruption due to moving the project from the customers directory tree structure to my local development disk tree structure. The key here is that in my case, the problem was transient. I did NOTHING and the problem appeared to resolve itself. (Not generally a desirable thing as I didn't fix anything so it might come back).
I recently spent about 3 hours trying to fix this issue on my ASP.NET app running on local IIS. I had 'Override application root URL' specified and I specified the url with an ending forward slash (/) such as http://my.dev.com/. If I saved the project options and came back in it would show the overrided root url as http://http://my.dev.com. Once I removed the last forward slash it started to behave ok and the error went away.
HRESULT E_FAIL has been returned from a call to a COM component
In my case, it was because i had differents projects with same GUID in my solution. (Project was created by copy/paste)
My problem manifested with opening Win10 appxmanifest file (no pun intended). Simply installing Windows 10 tools and SDK (go to New->Project->Select Windows->Install Tools) fixed it.
Add on development initiated on x86 architecture or 64 bit system then it will run on 32bit system also.
but if you Add on development initiated on 32 bit system and then you want to do changes on source code in 64 bit
Note: if you are connected SAP Licence on server system then set the port and set server name through service manager otherwise System will give error:
Connection Context :- Retrieving the COM class factory for component
with CLSID {632F4591-AA62-4219-8FB6-22BCF5F60090} failed due to the
following error: 80040154 Class not registered (Exception from
HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
I fixed the same issue by deleting ComponentModelCache folder
Close Visual Studio (if you haven’t done so already out of despair)
Open a file explorer window and navigate toyour AppData folder. You can get there by:
In the search bar, type %APPDATA%/.. and press enter
Alternatively, navigate to C:\Users\\AppData
Go into Local\Microsoft\VisualStudio\<version> where is 12.0 for Visual Studio 2013.
Delete the ComponentModelCache folder.
From here: http://withmartin.net/how-visual-studios-component-model-cache-can-be-a-pain/
I faced the same issue in Visual Studio 2017,
Do follow these steps:
Start —> Run —> regsvr32 %SystemRoot%\System32\msxml3.dll
Start —> Run —> regsvr32 %SystemRoot%\SysWOW64\msxml3.dll
Clean the Project.
Restart visual studio.
Step 1 and 2 were copied from Besnik Kastrati post.
I find this answer
click Ctrl+Alt+J
click (...) in the top
now you can add dll from Browse , .Net or another
After clicking the OK button click at (add to references in selected Project in solution explorer) (this is a green plus "+" button)
I got this error when trying to install a nuget package that I had previously downloaded and installed in another project.
Clicking Clear all NuGet Cache(s) under Tools > Options > NuGet Package Manager solved this for me
I encountered this error after installing VS2019 but while trying to open a large solution (20+ projects), with both vcxproj and csproj projects, that target VS2015. The csproj all loaded fine, while the vcxproj all failed with the OP's error. Deleting the .vs folder did not work.
What did work was setting VC++'s "Fallback Location", under the "Browsing Database Fallback" settings.
Tools (menu)
-Options...
--Text Editor
---C/C++
---Advanced
----Browsing Database Fallback
-----Fallback Location
I set mine to D:\VC++\v16. Where I use v140 for VS2015 and v141 for VS2017. Also set "Always Use" and "Do not warn".

Recover a .CS class file after crash

I was working on a class in visual studio 2010 when suddenly my computer crashes. after I restart the computer. I start Visual studio and I find that class to be completely empty.
it contained more than 1000 lines of codes before the class.
is there anyway i can recover that file?
Help please because I don't have another copy of it (Stupid of me)
If you cannot find the source code file, try using Reflector to decompile the most recently built dll you have containing that class. It won't give you your complete source, but at least will give you something to start with.
Note: Reflector is no longer free; if that matters, try dotPeek from JetBrains instead.
Also, look into using a source code control system. This will let you 'commit' versions of your code to a repository, so you'll have a copy in case something like this happens in the future.
Subversion, Git, and Mercurial are popular ones; In my opinion, Subversion would be the easiest to start out with, especially with TortoiseSVN (OS integration) and AnkhSVN (Visual Studio integration). If you don't want to worry about setting up a repository/server, look into a hosted solution, like Beanstalk, which offers Subversion and Git and lets you try it out with a free, limited account.
Good luck - I hope you are able to recover your source!
Something which worked for me was back-up.
BTW I was trying to recover a VS2013 file on a Windows 8 machine.
Try to check in below location in your system.
C:\Users\username\My Documents\Visual Studio \Backup Files\ProjectFolder
I found an original file with original-date.filename.cs name and a recovered-date.filename.cs files.
The original was the one needed.
Deleted the one in project, added the original file and renamed it to file.cs. Tried building and debugging and it gave the expected results.
Also just want to add one more thing...
In my case i had an aspx page with its respective .cs and designer.cs
The .cs file got corrupted and I did build on project, with the designer.cs the project got build successfully and the dll got replaced. And when i tried to recover using reflector everything was in a state no return. :(
So don't build the project if you see any file got corrupted.
in visual studio 2019 I find the file in a files with TMP extension
FileName.cs~xxxxxxxx.TMP
This happened to me a few times as well when Visual Studio was crashed or System was shutdown unexpectedly.You can recover these corrupted file using Recuva. It dose not recover the file every time but in most of the cases it's work perfectly.
Below are the settings which you need to configure before recovery.
Start Recuva. Enter Advanced mode if the Wizard launches.
Click Options.
In the Options dialog box, click the Actions tab.
Click Scan for non-deleted files, and then click OK.
Run the Recuva scan as normal. Non-deleted files are indicated with a green double-circle status icon.
Hopefully, you will find your corrupted file in recovered files as it recover multiple versions for that file.
Very useful question. I got issue of file crash on sudden shutdown of my PC. recovered file using "Recuva"(download link: https://filehippo.com/download_recuva/) software. Scan for non-deleted files was helpful.
I got help from: https://www.samnoble.co.uk/2014/11/30/visual-studio-crashes-and-a-corrupted-cs-file/
Well, that happen recently for me and I did get my file back this way.
1. Find the project DLLs in the bin folder. Example MySolution.dll
2. Download and Install .Net Reflector from https://www.red-gate.com/products/dotnet-development/reflector/trial/thank-you
3. Open the .Net Reflector app and click the open folder icon then move to your bin directory and select MySolution.dll file
4. Then traverse and expand through your namespaces and classes to look into your codes.
5. Have fun!

Why does it say "Project with that name already opened in the solution"?

I recently migrated a VSS database to TFS 2008. Using Source Control Explorer, I got the latest version of a solution with 12 projects.
When I opened the solution in VS 2005, two of the projects were not found. I am not sure why these two projects were not found, but thought it easiest to just delete and re-add them to the solution.
When I do this, VS gives me a "A project with that name is already open in the solution." The project doesn't appear in solution explorer, and is not listed in the .sln file.
Any ideas?
I had this problem and I was able to solve it using the following steps:
Remove the project from the solution.
restart visual studio.
add the project to the solution as an existing project.
I had the same message... Seems like it comes from (.csproj) project file. Under first propertygroup there is a section named
<ProjectTypeGuids>...</ProjectTypeGuids>
which generally tells Visual Studio to handle that project in some specific way. Some Guids can be found here.
First make a backup copy of that file. Then removing that section can help you open the project as usual project. As it seems that the Visual Studio thinks that the project is not the type that is specified in the ProjectTypeGuids.
This did it for me:
remove the section <ProjectTypeGuids>...</ProjectTypeGuids> in each project
reopen each project, then save to overwrite the existing project file, finally exit
reopen the solution file
pray (optional)
If anyone uses AnkhSVN instead of TFS, it's also possible, that the .sln-file need the following lines:
GlobalSection(SubversionScc) = preSolution
Svn-Managed = True
Manager = AnkhSVN - Subversion Support for Visual Studio
EndGlobalSection
in the "Global" section.
Before anyone tries tempering with their solution- and project files, figure if you may have project dependencies outside the solution, such as IIS - and you forgot to start Visual Studio in Administrator-mode
For me, the project not loaded was because it was configured to use IIS on the local machine and I needed to start Visual Studio as an Administrator.
I have to say that removing the section <ProjectTypeGuids>...</ProjectTypeGuids> could create some problems.
In fact, such a section defines the type of the project and, if removed, could disable some features.
For example, if your project was originally defined as Smart Device (C#), after removing the aforementioned section the on-device debug may not working properly.
Delete .suo file. Build solution. Add Projects.
Unfortunately I don't know the why behind the obtuse error message, I can merely provide what steps I took to get it to go away.
In my case, I had reconfigured my local IIS (<UseIIS> not <UseIISExpress>) and it was no longer hosting the URL that was in the csproj <IISUrl> field.
Editing the .csproj file in another editor and changing that field to the new URL, followed by closing and opening the solution in VS resolved the issue.
I would try hand editing the project/solution files, they are text and pretty easy to read. You can edit the file in notepad. To open up the file as text in visual studio you need to first close the solution. Then do file->open and select the sln file, but instead of hitting the open button, press on the right side where there is an arrow and select open with.. from there you can select source code editor (text).
Somehow VS 2022 doesn't create a virtual directory anymore. I had to manually create the website in IIS
I had the same problem when i migrated a website to a web app project.
Unload the web app.
Add the existing website.
Reload the web app.
The following worked for me when I moved a project running vs2010 to another laptop.
I removed exactly the following and it worked:
<ProjecctType>Guid of sorts</ProjectType>
<SccProjectName>Svn</SccProjectName>
<SccLocalPath>Svn</SccLocalPath>
<SccAuxPath>Svn</SccAuxPath>
<SccProvider>SubversionScc</SccProvider>
For those looking for this while dealing with VSTO projects...
Be sure to have the Office Tools for Visual Studio installed in your machine before opening the project.
I solved it by changing Windows' regional settings. Instead of "English (Europe)", I used "English (United States)". Others have reported similar behaviors with changing for example from "Russian (Ukraine)" to "Russian (Russia)", etc.
-AlessandroSegala
Work For me.
Ref: http://answers.microsoft.com/en-us/windows/forum/windows_10-windows_install/customized-cultures-cannot-be-passed-by-lcid-only/26eb9d4b-7ddb-4774-8a40-7a7d84ba9277?auth=1&rtAction=1455534187354
In my case it was corrupted vbproj file. First line was missing:
<?xml version="1.0" encoding="utf-8"?>
After adding this line I had to close the solution, delete .vs folder and open again.
I got it in Visual Studio 2022 version 17.4.4.
You may also see:
Error HRESULT E_FAIL has been returned from a call to a COM
component.
when you try to reload your project.
One way to load the project (and deal with IIS directories later) is to edit the .csproj file and set UseIISExpress to true.
Replace:
<UseIISExpress>false</UseIISExpress>
with
<UseIISExpress>true</UseIISExpress>
Then you need to close your solution and open it again and the project should load.
I encountered this issue with web application projects.
When I tried to reload the projects, the VS2022 output said something like :
"The project is configured to use IIS. Unable to find the server
'{site_url}' on the local computer. Ensure that the local IIS is
configured to handle secure communications."
Which is pretty clear. Indeed, in my case, this was caused by my website https binding that just vanished for no reason (it happened to me several times, looks like a bug with Windows 11 & IIS 10). Things got fixed when I got my https binding back (projects could load norammly).
In VS 2022 to open a legacy web project I had to:
Remove from Solution
Change framework version from 4.6.x to <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> in from csproj
Remove <OutputType>Library</OutputType> from csproj
Close Solution and open it again (!!!)
Add project to the sln again.

Resources