Why is Intellisense not working for one unit test project? - visual-studio

I have a Visual Studio 2008 solution which builds a C# class library (Project X) and C# Windows Application (Project Y).
In the unit test project for the C# class library (XTEST) , Intellisense works as expected and auto-completes the names of classes etc.
In the unit test project for the windows application (YTEST), Intellisense has stopped working and only auto-completes with the names of accessor classes, not the names of actual classes. Intellisense also reports lots of class names as being unknown/undefined. These appear in the error tab, but disappear after compilation.
Possibly relevant facts:
The projects all build correctly, and the tests run.
All programming is in C#, .Net 2.0 Framework, VS 2008 SP1.
It used to work...!
The Project Y was converted to VS 2010, then converted back to V20008 at one point. It's possible that other projects may have been converted and then converted back too.
Can any inspired reader point me in the right direction to fix the Intellisense in Project YTEST?
Answer
Turned out to be an issue with .cache files in the project obj directory. Deleting these fixed the problem.

For Visual Studio 2013, I couldn't find .ncb files in project folder. But deleting all the .cache files in obj\Debug folder worked. Didn't have to restart the VS.
Source: Grantly's comment.

try deleting the .ncb file in your project folder.
This will force intellisence to regenerate the symbol database.

what helped me was simply unloading and re-loading the project

Related

Where is the Visual Studio 2017 Winforms Designer cache?

I'm getting some annoying errors from Visual Studio Designer when trying to open one of my forms (Could not load type x from assembly y, even though assembly y clearly contains type x; the project builds and runs fine). It looks like Visual Studio Designer cache issue to me. I looked around and it seems like Visual Studio Designer uses a ShadowCache, normally found at
C:\Users\%UserName%\AppData\Local\Microsoft\VisualStudio\15.0_6d397e1a\Designer\ShadowCache
However, that folder is empty. This suggests to me that there must be some other cache location, since I am using designer for some other things, there should at least be something in the designer cache location...
To clean windows forms designer project assemblies, you need to delete subforlders of ProjectAssemblies folder which is located in %userprofile%\appdata\local\Microsoft\VisualStudio\ under one of the folders depending to your visual studio version and edition.
For example for me:
%userprofile%\appdata\local\Microsoft\VisualStudio\15.0_a26f780e\ProjectAssemblies
If you look in the folder, you see subfolders containing assemblies of your projects.

Visual Studio 2017 not updating references

I have a VS solution with three projects. When I make changes to the class library the references doesn't update and it keeps expecting the old namespaces and classes and results in error when building since it can't find the old namespace.
It also results in build errors if I try "using LC.Tools.API.Models" since it can't find the namespace and intellisense shows the old namespaces (LC.Tools.API.Model) with the old classes.
The solution contains two ASP.NET Core web projects and one ASP.NET Core Class Library. The class library is referenced as a project reference in the other two projects.
I've tried deleting the bin and obj folder on all projects, re added the references, rebuild, build, clean solution.. Is there a way I can fix this without having to recreate the projects?
Sometimes had similar issue in Visual Studio 2015 Update 3.
Solved it by right clicking on project in Solution Explorer and then choose the "Unload the project" option and after that right click on unloaded project again and choose "Reload the project".

Namespace/Assembly errors in "Views" section in Visual Studio 2017

I have a .Net Core application that I used to develop on "back in the days of Visual Studio 2015". I have now moved on to Visual Studio 2017 and back to this project and I have a need to rename the project. I started following numerous guides online on how to rename a Visual Studio project, however none of them seems to support .Net Core and Visual Studio 2017. I believe it is important to mention that the only part of my project that complains about the namespace is the "Views" section, and it only seems to refer to files that have been created/edited recently.
After doing the following, I have still not found a solution:
Rename Solution in solution explorer.
Rename project in solution explorer.
Changing Assembly name in "Project" -> " Properties".
Changing Default namespace in "Project" -> " Properties".
Going to Program.cs and changing namespace using "Right-click" -> "Rename" -> "Rename all occurances".
Adding "#using " in _ViewImports.cshtml (complains about missing namespace here as well).
I am getting desperate as I feel like I have tried everything and nothing seems to works.
I have recently renamed my project from MobileFront to MSPFrontend and even if I change the "#using" statements inside my _ViewImports.cshtml back to MobileFront it still complains.
I am hoping that I am not the first one to encounter this tedious problem.
EDIT
I noticed the errors occured only when the files were open. I don't know if this is important to know of whether it has some importance for finding the solution.
I ended up downloading Microsoft.AspNetCore version 1.1.1 through NuGet. After doing that I created a completely new project and reopened my original project. That solved the problem. All of a sudden my project could find all namespaces and assemblies.

After a short while Visual Studio no longer accepts semicolon

When I start up Visual Studio 2013 everything works perfectly, then after 10-20 minutes it stops allowing me to type semicolon but everything else sill works. I can copy/paste semicolons from elsewhere in the source file, but this is a real pain.
It has been doing this for a few days. I didn't manually update anything recently.
I tried clearing the Resharper cache and even disabled Resharper altogether just in case but the problem keeps on happening.
Help!!!
I finally discovered what my problem is. I am writing a reusable library and want to build .Net 4.0 and .Net 4.5 versions from the same source code. I achieved this by creating two projects in the same folder that reference the same source files but are configured to target different frameworks, and use different bin and obj folders.
This setup seems to work really well for the most part, but it appears to really confuse the Visual Studio intellisense system because when you open a source file and edit it, Intellisense doesn't know whether to make suggestions from the .Net 4.0 or 4.5 framework because the source file belongs to both projects.
I solved my semicolon problem by unloading the .Net 4.5 project whilst editing and debugging the code, then reloading it when I want to make a release build.

Upgrade to Visual Studio 2010 throws a build error

Recently upgraded to VS 2010 from 2008, the previously built solutions are throwing the following error.
Error 14 Encountered multiple versions of the assembly with GUID 'a5851ea0-2f9a-40b2-a73a-cd7db32f09c5'. Try pre-importing one of these assemblies
I tried re-installing VS 2010 and it didnot help. Any ideas?
Is it the VS 2010 application itself crashing, or does it not like your solution? Can you open VS 2010 by itself? If so, it sounds like it doesn't like some of your references in one or more of your projects. Check the project references. If that doesn't work, start removing projects until you find the offending one.
This may happen, if you copy-paste-renamed a project file to re-use its settings but didn't changed the project GUID of it. Also could be a project migration error, anyway you will have to manually edit the project file and remove the duplicate references if the project fails to load because of the error.
I had the same issue when migrating 2008 -> 2013.
It was caused that we use same linked AssemblyInfo.cs for all projects in solution.
And only for the assembly that used some COM objects (MSMQ) it seems that it starts looking on referenced assemblies GUID and two of them from our solution...
So when I provide individual AssemblyInfo.cs for projects with unique GUIDs it start working.
Hope this info will helpful.
Try to remove the references to the debug folder.
In Visual Studio right click on Project
Select Properties
Select the references tab.
Check to see if any of the references are from the obj\Debug folder and remove them.
See similar question here.

Resources