views:

66

answers:

2

In VS 2008, I used to be able to create a file on the file system (like a .cpp file, for example), and then I could click the refresh button in VS and the file would show up. I have "Show All Files" checked. Note by "create a file on the filesystem" here, I mean like going out to windows explorer and creating a new file, in other words, outside of the IDE.

However, in VS 2010, this doesn't work. I have to close and re-open the solution or it won't see the file, even if I click the refresh button. I realize I can add the file through "Add New Item" and that works fine, but I use the technique above when competing in programming contests, that is, I have a separate tool which creates the file on the file system, and then I can just refresh the file list in VS and see it.

It's not a showstopper, but it's pretty annoying nonetheless. Just wondered if anyone knew a workaround for it. It's a C++ project I'm working with.

EDIT Also, this problem seems to be isolated to C++ projects, I just tried it with a C# console app and the refresh works ok.

EDIT2 I put an issue for this on the Microsoft connect site. I don't know if it will get any response, but I figured it's worth a shot. Here's the link.

A: 

The only time I've ever seen "refresh" do this is in web site projects.. and I found it annoying that it would automatically include stuff ;).

In web apps, which is now the default, you have to click on the Show Hidden Files icon, then right click on the new file and say "include in project"

Chris Lively
It's not a web site project, just a C++ console app project. And the bug was just introduced in VS 2010, you can refer to the link in EDIT2 for steps to reproduce. My guess is the VS team forgot to test this and broke it in VS 2010 with some other code change somebody did.
dcp
I saw the link, I just don't agree with the behavior you want. One of the reason's why we have project files is so that the compiler knows what does and does not belong.
Chris Lively
@Chris Lively - I totally disagree with your response. If I create a .cpp file underneath my project folder on the file system, why isn't it reasonable to want to include that in my project? If I click the refresh button with the "Show All Files" button checked (there is no Show Hidden Files icon by the way, just Show All Files), in my opinion I should see a refreshed view of what is currently on the file system. Otherwise, what's the point of even having the refresh button?
dcp
@Chris Lively - Likewise, if this were indeed desired behavior (which I can't see why it would be) then why does it work one way for C++ projects and another way for C# projects (the refresh works as desired for C# console apps). Anyway, Microsoft confirmed they can duplicate the problem (see the link in EDIT2 for details), so maybe they can fix it in SP1.
dcp
A: 

I put an issue for this on the Microsoft connect site (see EDIT2) in original question for details. MS has acknowledged that they can duplicate the problem, so hopefully they will resolve it in SP1. It does seem to be a bug.

dcp