Issue with building .NET project - c#

I've got very strange issue with building .NET project. I am using latest Visual Studio 2012.
When I try to build whole solution it says "Build successful". I have several projects in solution and the problem is with one of them. It builds successfully. But the logic is not updating (like some .NET assembly cache)... I cannot debug it as well.
The project contains entity framework code first context and entities, migrations.
I tried:
Checked solution configuration (I have appropriate checkbox checked)
Build/Clean/Rebuild
Visual Studio reboot, reboot with Administrator permissions
What am I missing? Guys, please help. It frustrates me and makes me angry :)

Try removing any references between projects and then rebuild any library projects and add the references again.
You say the logic doesn't update, it might be it...

Sometimes the clean does not completely clean everything. When this happens, I manually delete all the contents of the bin/Debug or bin/Release depending on your solution's configuration. If your intention is to extend the clean target, this is one of the best sources.

Related

Visual studio 2019 go to definition and Intellisense not working

I have noticed a weird issue with Visual Studio 2019 v16.0.1 the IntelliSense about "Using directive is unnecessary" normally grey is missing and type reference suggestion for missing using is not working.
I also tried with Visual Studio 2019 Preview but no luck.
I have tried the following:
deleted .vs folder and restarted.
Reinstalled Visual Studio
Reset settings via import and export setting under tools
Any other suggestions will be appreciated.
Close Visual Studio
Delete .vs folder (it is a hidden folder inside the folder which contains the solution *.sln)
Start Visual Studio
Solved my problem
Update From the comments
Deleting Browse.VC.db file within .vs folder worked for me. I did this to avoid deleting .suo which has information I want to preserve
NOTE 1: I am using Visual Studio 2019, but it may work on other versions
NOTE 2: This did not solve the OP problem, but it is a good candidate to solve your
Go to Tools -> Options -> Text Editor -> All Languages -> General. Make sure “Auto List Members” is checked. Also, make sure “Parameter Information” is checked.
If you are facing this issue with Unity projects then,
Check in your Unity settings whether it has Visual Studio configured as the external editor.
Click on Regenarate project files in the Unity settings.
Go to Assets => Open C# project.
This will restart Visual Studio with your project.
In my case, Resharper is the culprit. Disabling it immediately solved the issue.
I think these issues are discussed here and are resolved by an update and some worksrounds are bring discussed:
https://developercommunity.visualstudio.com/content/problem/505489/cannot-navigate-to-the-symbol-under-the-caret-3.html
For anyone who are searching for another suggestion, I just go throught this issue, as OP said, I've deleted .vs folder, I've update vs to last version, I've uninstalled and reinstalled vs to the last version, I've reset settings, delete all obj folders, I've installed Microsoft.Net.Compilers but nothing worked, at the end I just remembered that sometimes the projects required WindowsBase library, until now I don't know why, but after adding that dll Intellisense started to function again.
I use resharper (vs 2017) but had not installed it on 2019. After installing Resharper on 2019 the intellisense started working again. (yes, it was working in 2019, then stopped)
I don't have an explanation on why this would fix it. Just did for me.
First time I use VS 2019, I need to manually install Code Analysis. Make sure it is installed at your project properties.
And today, for the new class, the suggestion or namespaces not showing for VS 2019 Intellisense, and Go to Definition not working too.
I must do close solution, and re-open and VS 2019 doing scanning while opening project, and then worked again.
I think this is bug for VS 2019. Try to close solution and re-open it.
I have tried almost all the solution mentioned above but it doesn't helped me. Trying to restart my PC solved my problem.
I tried lots of things but nothing worked for me until I found this post. He mentions a few things I have already tried that didn't work, but his final solution worked for me...
At the root of our solution there is a packages folder. I deleted the
entire contents of this folder. Upon reopening Visual Studio,
Intellisense and Go To Definition were restored to full working order.
close visual stdio
For mac in your folder: do command + shift+ .
you will see hidden files -> delete .vs folder
open solution again
After working for a few months, Intellisense suddenly stopped. This cost me a lot of lost time! I've been worked with Visual Studio for about 10 years, and this problem happens occasionally in every version.
Here's what I tried for this iteration of the problem:
Closing Visual Studio and re-opening does sometimes make the problem disappear for a short time, but it certainly doesn't solve it
Likewise restarting my laptop
Installing the latest Visual Studio 2019 update didn't help (I'm on 16.8.3 now if anyone's interested)
Deleting the hidden .vs folder doesn't seem to solve anything (doing so also means you lose your current window layout, as well as any bookmarks you've set)
Unticking the Track Changes option in this menu: Tools-> Options-> Text Editor-> General.
I've updated my NuGet reference to the Microsoft.Net.Compilers library to the latest stable version, as suggested here, but sadly this made no difference
I thought I've finally solved the problem by following the advice from Homer. I deleted the packages folder at the base level of my project (somewhat nervously, as I wasn't sure if it was needed), and thought it had solved the problem, but no such luck.
However, one thing to watch out for - after doing this, Visual Studio recognised my classes but no longer recognised built-in ones (all the referenced namespaces at the top of my controllers were underlined in red). I then deleted the .vs folder (again), which seemed to solve the problem.
When I recompiled my solution, it gave a few CS0433 compilation errors with duplicate namespaces for the MinLength and MaxLength directives in some identity user name and password validation code. I got round this by removing the Microsoft.EntityFramework Nuget library (I had to also remove Microsoft.AspNet.Identity.EntityFramework too, since this depended on it), then adding them both back in, making sure to include at least version 6.2 of the former (otherwise I got another runtime error to do with the FirstOrDefaultAsync method called somewhere!).
My current situation: all existing Intellisense is working, but it's not recognising new classes I add unless I exit Visual Studio and go back in again. May have to live with this ... unless anyone can help me?
I've got that problem today with only one project. I got no Intellisense warnings (i.e. naming styles, "Variable not referenced", etc..) for files in that project. Not in VS 2017 Pro nor in VS 2019 Community.
Check, if your Project->Build->"Warning level" is set to 0...
If you have Visual Studio 2017 installed side-by-side with Visual Studio 2019, close VS2019, open the project in VS2017, wait until it is fully loaded, then close VS2017, and reopen VS2019 - fixed!
There must be a bug in the VS2019 intellisense stuff, but VS2017 seems to fix it with no need to keep deleting the .vs directory.

Visual Studio 2017 outputting older build versions in bin/debug folder

When I build a C# program (this has been going on for several different solutions/projects I have been working on) in Visual Studio 2017, the new, updated code will build and run in debug mode (and run correctly).
However, the application that Visual Studio has been outputting when I build/debug them has been remaining with the original, first version of code that I saved. When I choose the options to rebuild, it will update the time stamp on the application and .pdb files, but the application will perform the way it did in earlier code versions, not the most recent code version that was running problem when I ran debug mode immediately after pressing Ctrl + F5.
These are C# Console Apps with the .NET Framework 4.6.1, if that makes any difference. I checked the output folder, and it is indeed the desired folder and the one I have been looking in... so why is the time stamp updating on the application (.exe file) that it outputs, but not the code itself? What am I missing?
When I run into strange things like this in Visual Studio, the first thing that usually works is to clean the project and rebuild. If that doesn't work, I'll close Visual Studio, re-launch, then clean and rebuild again. If that doesn't work, I would start looking into any extensions you have installed that might be getting in the way of your build process.
Further, you can look into logging the extensions activity to help troubleshoot if there are issue there. See the following article:
https://blogs.msdn.microsoft.com/visualstudio/2010/02/24/troubleshooting-extensions-with-the-activity-log/
You may have already tried this, but since it wasn't mentioned I thought I'd provide it for others in a similar situation.
Two possible reasons:
(1) Your project was not recompiled during debugging. Please enable Edit and Continue under TOOLS->Options->Debugging.
(2) Visual Studio has a concept of incremental build. If you have a solution with two or much more projects and if you change source code in only one of the two projects, the "Build" command will compile only the modified project. But the "Rebuild" command, on the other hand, it will recompile all projects in this solution.

Visual Studio 2015 Community - All References Broken

I just installed VS2015 community on my home machines. On my laptop, it works great. However I've run into an odd issue on my desktop. No matter what the reference is, it displays as unable to find (yellow warning symbol). It doesn't matter what or where it is. I have tried adding framework references (As basic as System) and references to external API DLLs in the local directory like Protobuf. NuGet will download packages referenced by projects I am working on and they will also be marked invalid. The properties for these references does not include a path, even when I specify one.
I'm a develop at work so I understand how to handle these issues generally. I've tried deleting the references and re-adding them, creating new solutions from scratch, pretty much everything I can think of and I'm out of ideas.
This is a Win7 machine with .NET 4.6.1 installed. I have tried changing my projects to target framework of 2,4,4.5,4.6, and 4.6.1 (no difference). This is a C# project if it matters.
Can anyone recommend next steps? Thank you.
I found the issue. Last month I tried to upgrade to Win10 and it didn't work out for me so I rolled it back. It deleted all the ACL information on all my directories. Specifically, the access to Microsoft.CSharp.Targets was lost. I restored that and everything worked again. Of course, now I have to try and fix every file and directory on my computer so I have access again. Thanks, Win10!

Visual Studio project references not recognized. Forced to remove then re-add the project reference

I'm having an issue with my solution finding project references after I pull the source code from TFS. After I get latest, I'll compile my solution and it will complain that it cannot find classes in other projects. These have been added as project references. When I check the references folder of the project that has the issue, the project reference is there and appears to be correct (properties look correct and I do no have the warning tooltip over the reference in the solution explorer) The only way I have been able to fix this is by removing the project reference then re-adding. As soon as I do that the errors go away even before I compile and all is well. I did some searching but was not able to find anyone with this specific issue. It seems to happen whenever someone adds in a new project into our solution then we get latest to get their changes. This will also happen on everyone's machine except the person who added the project. Once one of us goes through the steps of re-adding the references and commits those changes, it works for the rest of the team. All of use are adding project references like normal.
Here are the details of my development environment:
Windows 7
Visual Studio 2015 (v14.0.2317.0 D14REL)
C# .NET 4.6
TFS 2015
Resharper 10.0.1
I too faced similiar issue today. And now I understood the problem.... under 4.5 framework related project1 is referring superior framework 4.5.2 related project2.
So I did made them both as same and my solution started working..
Not sure whether same will work for you or not. Please verify on your solution as well.

One or more project was not loaded properly

After copying the project to another laptop/ PC, when I want to open the solution, VS2010 shows the error "One or more project was not loaded properly". I have tried running visual studio in admin mode but that did not solve the problem.
This is usually a result of an inconsistency in your solution or projects. Open the solution file in an external editor (such as notepad) and check that the path it has to the projects is available and did not change. There shouldn't be any absolute paths in the solution file.
Maybe because the project from where you copied was configured with IIS configurations and you are trying to run the project in visual studio's default environment.
you have to right click on your project and set as a start up project after that you have run your project,
I seem to have found unloaded project, after noticing there's one missing by manually counting and comparing it to the number of projects the solution explorer reported. It was deep inside another folder in the solution explorer that I never used and assumed that had nothing worthwhile.
It's a familiar issue. Looks like the project you are trying to open was created in higher version than what you have. If the project is in MVC, make sure you have installed MVC OR Make sure you have appropriate version of .NET installed in your system.
I work with NopCommerce and a couple of times I downloaded new version and got same error message. It goes away once I install the dependencies.
Because you tagged it ASP.NET make sure you have all the ASP.NET components installed. Those are not part of .net framework but might be necessary in your project.

Categories