Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Cannot Open File

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.

like image 933
thepocketwade Avatar asked Aug 22 '09 23:08

thepocketwade


2 Answers

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.

like image 135
James Black Avatar answered Oct 03 '22 09:10

James Black


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.

like image 23
Jeff Wilcox Avatar answered Oct 03 '22 08:10

Jeff Wilcox