Visual Studio 2010 refresh not working - file

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.

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"

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.

Related

Visual Studio hangs when adding forms or opening designer

I have a major problem with a Winforms application with a large number of projects. VS 2019 threw an exception and closed a few days ago, and on reopening restored two files since then I have been unable to:
Add a new form to the vast majority of projects, whether the most basic MS template or not
Open the designer for any form that is already in the vast majority of projects
Access the navigation bars (the three combo boxes at the top of the VS work area that normally contain the project, namespace and content information) on any class referencing to WinForms in the vast majority of projects
When trying to do either of the first two things an 'Opening File' message is shown endlessly. If you try to do anything, a notification is shown that Visual Studio is busy, and that Microsoft will be notified but nothing else happens and you can only get out by using the Task Manager to kill all VS tasks.
In the case of the third one, a message is shown saying 'Refreshing Navigation Bars' but again it goes on forever. However, in this case you can click the Cancel button to cancel the loading attempt.
The navigation bars issue I believe is Resharper related. In addition CodeLens is not working at all, so the space for the number of references is generated but there is no content. This is true for ALL files in the solution, not just the form related ones.
Here is what I have tried so far:
Cleaned and Rebuilt the solution - works fine but no difference
Built and deployed the solution - works fine
Deleted the SUO file and reset
Cleared the Resharper caches
Disabled Resharper
Performed a repair install of Visual Studio
Created a new Solution and added forms etc. which was unaffected and worked fine
Opened a different solution which was also working fine
Tried the same processes with a Project in the same solution that is not part of the application (TestBed) and that works fine too, but is the only project that does
Can anyone suggest where to look now? Since new and existing solutions work OK except for this one I am assuming that it is something Solution related rather than something related to VS itself, but I have no idea what that might be. For example, what is it trying to do when it says 'Opening File' (apart from the obvious - opening a file :-)) and what could cause that to fail? Am I looking for something in the Solution file, or could it be something else?
All suggestions and assistance towards resolving this issue would be gratefully received.
Thanks to Jasimov for the only response, I appreciate your attempt to help.
I have now resolved the issue using the following steps:
Uninstall Visual Studio 2019 Community Edition
Perform a fresh install of Visual Studio 2019 Professional
Reload the main solution
Clean the solution
Rebuild the solution
Deal with some issues that were highlighted in the Output and Errors, none of which were directly forms related
Rebuild the solution
Run the application and ensure it runs as expected
Go back and select forms at random and try opening them. All now work as expected.
In addition CodeLens is now working not only properly but actually better than before giving more information more quickly. On the other hand, I have not yet reinstalled Resharper which will be the next step.
I have included all the steps I took just in case anyone else has a similar problem. I have not been able to find this exact issue anywhere else in my searches so I hope it helps someone.
UPDATE: I have since re-installed Resharper with no problems and the designers are all working fine so now back into full flow!
I had a similar issue with the web forms designer in VS2019 hanging as soon as I clicked on anything on the design surface. The same projects were OK in VS2017. Uninstalled VS2019, rebooted, reinstalled VS2019, found that the designer was now working OK. Progressively added back 3rd party toolbox components, one VSIX, and the .Net 4.8 targeting pack. Still working. Thanks for your hint about the reinstall.

Editing a Form in Visual Studio when TFS is offline

I'm running Visual Studio 2010 and using Team Foundation Server, and this thing is pissing me off no end.
Here's the scenario: since I work from home it often happens to me to work at strange hours or on the week-end, when our TFS is offline. This has never been a problem, since usually I just reload the solution and when VS detects that the TFS is not available it promprts you to work offline.
Now, I usually work on WPF projects, and working offline has never be a problem, even when editing XAML files it works with no issues. But now I have to edit a Form from a Windows Forms project, and VS refuses to collaborate. Whatever I do to the form, VS just does nothing other than playing that obnoxious "bing" sound that usually plays when an error of some kind occours. It doesn't even popup an error dialog box, just does nothing!
Any ideas??
Ok figured it out, I had to remove the "Read Only" attribute from ALL the files in the project (I had tried with the project file and form file, but that isn't enough evidently).

Add Service Reference not appearing

In a Windows Phone 7 Silverlight project, I had a service reference to a WCF service. This morning when I opened up the project, suddenly the namespaces for my WCF service were unknown. The option for "Update Service Reference" in Solution Explorer was not there, so I deleted the Service Reference with the intent of re-adding it. But the option for "Add Service Reference" is also not there. Gone. Disappeared.
Closed and re-opened the solution. Restarted VS2010 Ultimate. No dice. Anyone run across this?
I don't know how this happends in the first place, so we don't know the cause yet, but I found a solution to the problem.
Open your *.csproj file in Notepad or Textpad or something like that. Find where it has the tag. Replace that tag with this:
<ProjectTypeGuids>{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Close and re-open the project and the option to add service references will be usable.
In my case,
I changed my target framework from .Net Framework 2 to .Net Framework 4. The "Add Service Reference" appears immediately
Change Project Properties
I had the exact same problem with the missing "Add Service Reference" context menu option in Visual Studio 2017 with a regular C# desktop app project.
For me, the problem could be fixed by simply re-creating the entire project solution from scratch within Visual Studio. It turned out that the original project solution file had been created by an earlier version of Visual Studio, and this seems to have caused the problem.

Debugging silverlight application problem

My VS2010 doesn't stop at breakpoints inside of silverlight application. It appears that no symbols for it have been loaded during debugging. When I hover over the break point it says "The braekpoint will not currently be hit, no symbols have been loaded".
I have tried all of possible solutions offered by google and have no success. The problem occurs even when I create brand new silverlight app hosted by an ASP .NET web project. All of my project configuration looks fine - silverlight debugging is enabled in the Web project.
I am using silverlight 4.
here a link to the sample project created out from the tepmlate.
Any thoughts ?
P.S I just tried to reinstall VS2010 and the problem still exists.
EDIT: I just tested the same project on another machine and it stops at the break point it seams that the problem is somewhere in the configuration of VS or silverlight.
with Matt Dotson's help I managed to attach the debugger manually. However this solution is not good enough for daily use.
Depending on my experience in Silverlight following these steps keep your project debug-gable.
Condition 1>
Firstly we need to be ensure that in Web Project's properties there is a Web section, as you see below Silverlight checkbox must be checked.
Condition 2>
Follow In Menu Debug => Attach Debugger>
Visual Studio sometimes can't attach debugging platform you need to lead the way :) . By this way you may debug other platforms,(also you may debug your product platform but pdb files must be sync and don't forget you may suspend your product platform using this).
Condition 3> Your default web browser may be Firefox,Chrome or other than IE.By Visual Studio default try to attach to IE. But when you run VS calls default browser,so you need to have a manual attachment in Condition 2 or set your default browser by right clicking on default page > Browse with .
Condition 4> There is xap file generally located in web project\ClientBin directory. Sometimes after build operations this file can't be replaced and your ProjectDll and your Project PDB files not be sync. This cause wrong line match while debugging or can't find a debugging file attached caution. I strongly suggest delete all generated files in Bus project and delete Clientbin\ProjectName.xap file. After rebuild all it must be ok!
Hope helps.
What broswer are you using? You need to be using Internet Explorer to debug silverlight projects.
I have had a similar frustrating experience with this but in my case the solution was very simple. It seems that somehow, and I really have no idea how, the debugger option for Silverlight had become unchecked in the properties on the hosting ASP.NET project.
I just assumed that as I had been previously debugging, this option was set and I didn't bother to make sure that this was this case. Just goes to show that one should always check the basics first; if I had done that it would have saved me some time.
To check this in VS2010, right-click on the project and select properties, change to the Web tab and check the Silverlight option at the bottom of the page, in the debuggers section.
Also see the debugger to a silverlight process
http://msdn.microsoft.com/en-us/library/cc838267(VS.95).aspx
If that doesn't work, then
reset iis (if you are debugging in that)
delete temporary asp.net files (%SystemRoot%\Microsoft.NET\Framework\versionNumber\Temporary ASP.NET Files)
clean and rebuild your solution
The resolution came after 2 days of headbanging. It appears that the link which Malcolm gave covers exactly my problem but my I was narrow-minded enough not to pay it enough attention because when I run the debugger as long with the app my default browser was FF. So I thought that after the FF starts I can load the page from IE or Chrome.
Actually the problem is that the debugger cannot be attached to the silverlight project because of the FF. And when I load the app from IE or Chrome the debugger dis still not attached.
Thanks to everyone that tried to help.
if you have multiple project, Rebuild the project separately that you want break point. Its work for me
Try also picking internet explorer from browser list menu as your browser

Silverlight Web Project shows install icon when debugging

When I add a Silverlight project to a blank solution, it asks me whether I want to add a web project to host the silverlight page or automatically generate a test page. Oddly enough, when I automatically generate a test page, everything in fine. However, when I add the web project I have problems.
I first get an error saying that it needs System.Web.Silverlight.dll in the bin folder of the web, so I do this. Then when I run it, all I get is the “Install Silverlight” icon. I’ve tried playing with and/or removing the minimum version tag and the version tag, but I just can’t seem to get it to work that way.
Has anyone had this problem before? If so, how did you get around it?
Sounds like you've got an old toolkit installed or the project template is corrupt.
Try a re-install the lattest Silverlight Tools for Visual Studio
To get rid of the first error, go to your references in your web project, and go to the properties for System.Web.Silverlight and go to its properties. Make CopyLocal true.
To get rid of the install icon problem, go to the Silverlight control markup in your aspx page and remove the MinimumVersion attribute. This doesn't seem like te most ideal solution, but at least one can debug.

Resources