Why does VS2010 remove my references? - visual-studio

In a small console application I'm writing to test something I need to add a reference to one of the DLLs built from a build of another solution. The Add References dialog works perfectly; after I browse to the DLL on disk and add it I see it with a green tick and it appears in the list of references in Solution Explorer. All fine so far, but when I close the Add References dialog, the reference just added simply disappears from the list of references in Solution Explorer.
What on earth is going on? Why is this happening and how can I fix it? Any ideas?

Referencing a non-Silverlight DLL in a Silverlight will appear to work until the Add References dialog is closed, when the references simply disappears from the project's list of references. No warning or error message is displayed.

Related

vb6 ocx project - can run EXE directly, not in debugger

I have a VB6 ActiveX control project (creating an .OCX), which has several User Controls. The controls are being loaded by an EXE (also VB6). When I run the EXE directly, it runs OK, but when I try to run it in the debugger (I need to step through the code), it cant't load the user controls (.ctl), gives me "Class not registered. Looking for object with CLSID:..." message
I have the Binary Compatibility set (kept all the old GUIDs), and I see the classes in the registry, everything looks OK - just doesn't run in debugger.
Any help please?
I've been working with VB6 for over a decade now. The problem is that the VBP project reference is out of sync with the latest build of your OCX user control. Simply open the project as a group or the EXE project on it's own and click Project->Components.
You will now see one of two things. Either the reference will be invalid or you have a valid reference chosen. Either way, uncheck the reference and click okay (do not re-select it during this operation.. trust me). Now, close that dialog and go back into Projects->Components, now pick your OCX control from the list. This will solve your problem. If your OCX is not in the list than rebuild it independently first and try again.
This is an undocumented bug with the VB6 IDE. Even with VB6 SP6 it had not been solved.

Error message and empty list of build definitions in VS2012 after adding favorites

We have a bunch of build definitions available through TFS, and these were visible under Team Explorer - Builds in VS until a few minutes ago, when I tried to add a couple of them to "Favourites".
All I did was right click a build definition, and select "Add to favorites", then repeat the process for another build definition:
The result however, is a now empty list of build definitions - I can't seem to find any of them again. Furthermore, I get the following error message:
An item with the same key has already been added.
Any ideas how to fix this? Anyone know where the list of "favorites" is stored? (My reasoning is that if I can find and empty that list, then perhaps this issue would disapear?)
I ran into the same issue today. I was able to resolve it with the following steps.
Close Visual Studio
Open C:\Users[username]\AppData\Local\Microsoft\Team Foundation\4.0\FavoritesStore
Move the xml file from that folder to some other location
Start Visual Studio, open team explorer and navigate to Builds
At this point, the Builds pane opened without the error and "My Favorite Build Definitions" was empty
Moved the xml file back to its original location
Refresh the builds pane.
After refreshing, my favorite build definitions were back!
You may try (this helped to me with the same issue) to delete all the files in the following folder and restart VS2012 (Source):
C:\Users[USERNAME]\AppData\Local\Microsoft\Team Foundation\4.0\Cache
This issue occurred for me today when I had a mystery dialog open and it was blocking user input. I could not locate it or bring focus to it. I had to force a shutdown of VS, and after restarting my favorites were corrupt.
I found you can delete the cache for the favorites directly and restart the IDE. As soon as it launches you will see that VS will recreate the folder, and as soon as you add your first favorite a new favorites file will be created at that location.
C:\Users\\AppData\Local\Microsoft\Team Foundation\4.0\FavoritesStore
Writing an application or clearing the adjacent Cache folder are not necessary.
Favourites are stored in metadata on the user or group. You'll need to write an app to clear them.
http://geekswithblogs.net/TarunArora/archive/2012/10/18/tfs-api-add-favorites-programmatically.aspx

Workflow Foundation: Designer is not working

When I try to open any activity in design mode designer fails with message "The document contains errors that must be fixed before the designer can be loaded. Reload the designer after you have fixed the errors". The project builds and runs fine though. This happens even with a fresh newly created solution. I mean that if I create a new workflow project and add a new item -> activity the problem persists.
If I click "Reload the designer" I get the following error: "Undefined CLR namespace. The 'clr-namespace' URI refers to a namespace 'System' that is not included in the assembly". If I build the project the error disappears but the designer doesn't start working.
I'm using VS2010 Premium. The only plugin installed is ReSharper. However I tried removing it but it didn't solve the problem. I've also asked a friend of mine to reproduce the same error on his computer but everything worked well.
The problem was that there are several types of editor for .xaml files. If you right click open with you can choose one of them. In my case WPF designer was selected by default though it's better to choose automatic selection.
Hope this information will be helpful for someone else :)

How do I show the References folder in Solution Explorer without selecting 'Show All Files' in a VB.NET project?

As I compare many C# example projects to my VB.NET projects, I see that the References folder shows in the Solution Explorer without having to select "Show All Files". Is it possible to have this for a VB.NET project as well? I find that it would be very helpful to have this folder displayed without having to see all the other hidden files as well.
I'm using VS2010 Professional.
This adds to my list of reasons why I should have learned C# first...
I guess I will have to definitively crush your dream. Sorry. It has been a decision by Microsoft to remove this from the default view to reduce the 'clutter'. However, your 'Show All Files' setting will persist when you save your project. So if you show all files once and then save, then it will always be on.
You can also see your References in the Project designer, which you can always keep open in a tab.
As of Visual Studio 2015, this behavior has been changed to show the References folder without selecting Show All Files.
From MSDN:
What’s new is the References node. This used to be hidden and you had to click Show All Files to see it—but that also showed lots of irrelevant files.
This previous behavior might have made sense 10 years ago when you’d start with a Windows Forms project and it would generally have the right set of references. But it’s a reality of modern development nowadays that the References node is used frequently—especially to manage NuGet references. It’s a small but handy convenience to be able to find it easily in Solution Explorer.
I add a separate folder called Dependencies, add my dll's to it and check them in as described here. That way my dll's are always visible in the Solution explorer without having to turn on Show All Files.
Select 'Show All Files option' in the solution explorer.

Why is loaded dll missing in Visual Studio's modules list?

I am currently bug hunting and need to debug into a specific dll in the release configuration in Visual Studio 2005.
At some point I closed the solution, did some other stuff and reloaded it. From that point on my breakpoint doesn't get hit and I get the infamous "No symbols have been loaded..." message. So I opened the modules window and the dll that I want to debug doesn't appear in the list anymore, therefore I cannot load symbols manually. The application behaves normal so I am absolutely sure that the dll MUST have been loaded to execute certain functions. Sure enough, if I rename the dll and start up the application it doesn't work anymore, so it also must be the right dll.
I tried setting the dll project as startup project and the command to execute to the application's exe and starting the application from outside visual studio and then attaching to the process, all to no avail.
Question is, why is the dll not appearing in the list of loaded modules although it must have been loaded? I cannot think of any other changes that I've done, that could cause this, am I missing something? (Maybe something really obvious?)
Any help appreciated!
Use process explorer to check if the dll is loaded or not.
When you attach the process make sure that you are enabling both 'Native' and 'Managed' code type (in the code type selection option).
See also this question: Visual Studio is not loading modules when attaching to process
I encountered a similar issue after transferring a project from one computer to another. I will simply explain what I discovered and how I fixed it, and you can determine if it fits your problem and solution.
The work computer I wrote an application on contained a .dll file which my program was referencing. After moving the application to my home computer, the application could no longer locate the .dll file it was previously referencing because the file was no longer there.
The application compiled and ran even without the referenced resource (.dll file) because the previously compiled assembly (debug folder) contained its own copy of the .dll file and other resources. Put simply, it is the old assembly build that is running and not the current application you're working on. This is also why this error tends to suspend the designer window and throw an error after the app is done running.
I would take a look at the following:
a) Under Solution Explorer, go into the References folder and right click the missing reference node and select properties. In the properties box, observe the Path of the resource being referenced. Is the resource still located at this path?
b) Check the debug folder for a copy of the resource you're looking for. If the resource is there, make a copy and save it to your desktop. If it's not there, get the file from the original source.
c) Under Solution Explorer, right click 'Properties' and 'open'. From the menu that appears select 'Resources' from the left and at the top of the new window that appears you you should see 'Add Resource' with a small drop down arrow. Click the arrow and select 'Add existing file' and then browse to the file. If you don't see it you may have to change the file being browsed from the small drop down above the 'open' and 'Cancel' buttons. After the file is located it should create a new folder in the solution explorer called 'resources.' Now the file is a permanent part of your application and not merely a reference to it.
I had the same issue today with Visual Studio 2008. I was using a simple tester to test a new method in an assembly. So added a reference to my assembly I wrote the code to load the assembly and call the new method, build, everything OK. But during execution the debugger would throw an exception saying that new new method did not exist, and the modules window was empty.
Turns out the assembly I was modifying was in the GAC, and was using instead of the new one in my build directory.
I had the same issue with visual studio 2017 Pro and searched for a week but no luck then i installed VS2019 Pro and test with same project but the break point wasn't working at all and the project's DLL was missing from the modules list.
I was running multiple projects under one solution and i suddenly observed that if select project1 as "Startup Project" the DLL of that project is loaded only in the module list. So as i was testing an API and I switched API project as Startup Project and observed now the API DLL files are loaded into the modules list.
Right Click on your required project that you want to include it's DLL files in the module list and set it as "Startup Project"

Resources