VS 2015 & vNext/MVC 6 IntelliSense issues - Resharper - visual-studio

I am having an issue with Visual Studio 2015 RC and IntelliSense when running the MVC6 vNext project template. The project builds and runs just fine and nuget restores packages if I manually remove them. The issue is that VS 'shows' that it cannot resolve my using statements throughout the project, thus breaking intellisense. Has anyone had this issue where it builds and runs fine but does not show the using statements as resolved?

OK, figured it out. Suspending resharper removed the red text, but still no intellisense. Tried to update resharper via the resharper menu in VS, this failed. Manually installed version 9.1.1 of resharper over version 9.0.0, this made everything happy again (full install removed previous version of resharper).

You need to use ReSharper 2016.2 or above to support .net core.
You can use the early access version available from https://confluence.jetbrains.com/display/ReSharper/ReSharper+2016.2+EAP

This is an issue of Resharper 9. Don't use Resharper 9 with MVC 6. It will suggest you the wrong path when you import CSS or JavaScript file to your page, as I said in this question.
So, the solution is: update to Resharper 10. However, there are many problem remains when using Resharper with MVC 6.

Related

Target Framework not installed when opening a Unity project with Visual Studio 2022

I am trying to open a C# solution that has been generated from a Unity v2020.3.19f project with Visual Studio 2022. Opening it with Visual Studio 2019 works just fine, but there are reasons I'd like to be able to open it with v2022 (such as GitHub Copilot). I did not have issues with this on my previous install of Windows 10.
Upon opening the solution in VS2022, I get the following pop-up prompt for every project in the solution:
Choosing the first option updates the target project to .NET Framework 4.8 and loads the project, but the whole file appears with red lines. When hovering over an underlined bool Property, the error shows as: `CS0518: Predefined type 'System.Boolean' is not defined or imported.
Choosing the second option opens this URL in my browser, prompting me to install .NET Framework 4.7.1 targeting pack (which was already installed via the Visual Studio Installer). When I try to install the .NET Framework 4.7.1 runtime, the installer responds with .NET Framework 4.7.1 or a later update is already installed on this computer. When I try to install the .NET Framework 4.7.1 Developer Pack, the installer allows me to choose from "Repair", "Uninstall", or "Cancel". Repairing has no effect.
I installed both versions of Visual Studio (2019 & 2022) the usual way through the Visual Studio Installer, along with the "Game Development with Unity" workload, which tells me it's installed all dependencies just fine:
Here's what I've tried so far:
Uninstall & reinstall all versions of Visual Studio through the Visual Studio Installer
Uninstall & reinstall Unity, with the Visual Studio module installed through Unity Hub (which just opens the Visual Studio Installer for me to choose which version I want to install)
Regenerate project files through the Unity Editor
Uninstall any references to .NET Framework through the Control Panel
Try reinstalling .NET Framework targeting pack 4.7.1 either from the Visual Studio Installer or manually through the Microsoft SDK website from the prompt
Nothing works for me. Any help on how to make VS2022 stop complaining is greatly appreciated.
Update 1: I found a couple of threads where people suggested simply pressing the Regenerate project files button in "Edit -> Preferences -> External Tools`. This has not helped me.
Update 2: I've tried everything I can possibly imagine, in different orders and different combinations. I even reinstalled Windows 10 to no avail. It's like Visual Studio just doesn't want to accept that the .NET Framework 4.7.1 targeting pack is installed. Please help :(
check this
https://learn.microsoft.com/en-us/answers/questions/733018/visual-studio-2022-cannot-locate-installed-net-fra.html
If you modified the value of ProgramFilesDir(x86), just to modify it back to C:\ProgramFiles(x86) can solve the problem
That is a very interesting problem, my main solution for you to first try is to make sure you are even targeting the correct .net framework in UNITY before you even build the solution. You are using the .NET 4.x, you need to go into your configuration settings and player settings in unity and ensure its not on a different version, for me, unity still defaults to .net standard 2.0. Follow the steps located here. To do so.
Another solution is to see if that first option actually gives you errors that prevent you from using unity, because I know that Visual Studio Code has problems occasionally where it tells me im wrong, my program is wrong, every life choice I have made was poor and I am poor, yet in unity, there are no errors showing in the console and I can hit play no problem. In that case I just had to rebuild a few times and fiddle with vs code until omnisharp stopped yelling at me.
Apperently I have been in a similar situation as when you were getting the error "Predefined type 'System.Object' is not defined or imported" because looking into it, I already have clicked on some of the links, try this one if that error persists. If you cannot prevent the errors to begin with, I would recommend you trying to fix the upgraded version from option one as that is more than likely going to get you the closest to a solution.

Visual Studio 2019 hangs on "Execute Suggested Action" when adding a reference

I've got a problem with Visual Studio Enterprise 2019, it hangs on "Execute Suggested Action" when I use it to add a reference to another project or library.
It's a Visual Studio bug. They are working on it.
Take a look here: https://developercommunity2.visualstudio.com/t/Infinite-suggested-action-never-ends/1223055
The fix will be probably released on the next release (16.9).
UPDATE:
Still in vs 16.8.4 but should be solved in 16.9.
UPDATE 2:
In 16.9 PREVIEW 3, this issue seems to be resolved.
UPDATE 3:
Fix has been released! You can download the new version of VS now.
if anyone struggle with adding references: go to your project -> right click on Dependencies -> select eg Add Project Reference -> look for proper reference
I was having the same issue when adding on the suggestion of Intellisense. For me, it turned out to be an issue of cyclic reference. My bad. I corrected it and now it doesn't hang.
It was VS 2019 community, Windows Forms (C#)

Visual Studio 2015 Enterprise with ReSharper 10 Ultimate -- Cannot be properly resolved

I have Visual Studio 2015 Enterprise, version 14.0.24720.00 Update 1 as well as ReSharper 10 Ultimate, version 10.0.2 installed. I have a typescript file that is using AtScript syntax to refer to the Angular2 directive module, as its annotation. However, ReSharper is stating the following error:
Symbol 'Directive' cannot be properly resolved, probably it is located in inaccessible module.
Below is the full error tooltip.
The application compiles and runs as expected, and the angular portions of the application also function as desired. It appears as though this is a ReSharper false negative. Is anyone familiar with a workaround other that simply disabling ReSharper or ignoring the warning?
The issue is simply a bug with the latest version of ReSharper, if you Suspend ReSharper the issue simply goes away and all the source code works as expected.
Update
This has since been addressed in the ReSharper 2016.1 version.
As a workaround, if you are using angular2 from your node_modules folder, then you can reference it directly instead of relying on the new node module resolution. For example you can do:
import {Directive} from '../../node_modules/angular2/core';
As of 02/2016, the issue is fixed in the ReSharper Ultimate 10.1 EAP 3
this version still has some other typescript issues though
Original answer, explaining why it couldn't work in previous versions:
Had the same setup and same issue. I strongly believe this is related to: "moduleResolution": "node"
https://youtrack.jetbrains.com/oauth?state=%2Fissue%2FRSRP-273158
Unfortunately, no way now. We're working on node.js support for the next ReSharper version.
If updating to latest ReSharper version does not work and this only affects .js(x) and .ts(x) files you only need to suspend those. You can do that by going to ReSharper -> Options -> Unclick JavaScript and TypeScript.
It could be Resharper problem. disable it from tools->option->Resharper Ultimate->General->Suspend Now and the errors will be hide.
I was getting the same problem on one of my modules on Resharper 2017.1 in Visual Studio 2017.
But after updating my Resharper to 2017.2.2, that solved the problem.

the service microsoft.visualstudio.shell.interop.iselectioncontainer already exists in the service container

I recently installed Visual Studio 2013 Ultimate version on my machine. I'm just trying to create a sample windows form project and trying to open the designer / form by double clicking on Form1.cs and I'm getting this weird error message:
"the service microsoft.visualstudio.shell.interop.iselectioncontainer already exists in the service container"
My system is already having Visual Studio 2010 which is working smoothly from a long time. I then installed Visual Studio 2012 which was giving the same problem as above. So I went ahead with installing VS 2013 hoping that I might be able to get rid of this issue, but no use.
Once I click OK on the error windows, I can see the following "message" in the bottom Error List window:
"The file 'C:\Users\ABCD\Documents\Visual Studio 2013\Projects\WebSite1\WindowsFormsApplication1\Form1.cs' does not support code parsing or generation because it is not contained within a project that supports code."
I have spent 2-3 days searching various blogs like these, all of which talk about previous version of Visual Studio like VS 2005 / VS 2008:
https://connect.microsoft.com/VisualStudio/feedback/details/311949/the-service-microsoft-visualstudio-shell-interop-iselectioncontainer-already-exists-in-the-service-container
Form inheritance in Visual Studio 2008 doesn't work
I have even tried uninstalling and reinstalling VS 2013, again no use.
It would be really great if someone can help me out in fixing this.
I've just had the exact same error message.
After compiling the solution(F6 or Build->Build Solution) it worked fine for me.
To deal with your issue, please first make sure that you installed latest updates on your Windows 8 machine, and then repair VS2013.
During your repairing process, please temporally turn off your anti-virus/antispyware software and repair VS2013 with the Administrator privilege.
follow this link
The problem got resolved finally, after so many days and various frustrating tries to resolve the issue. I should thank Tim Atkins from Microsoft for helping me with resolving this issue.
Fix: When we tried 'gacutil /l system.design', we found that there were 3 variants of system.design; One from .Net 2.0 targetting MSIL, second from .Net 4.0 targetting x86 and last one also from .Net 4.0, but targetting MSIL.
On a working machine, there were only 2 entries, the .Net 4.0 one targetting x86 wasn't there. Hence we uninstalled this version using gacutil which did the magic. I was so relieved seeing the win forms popping up without any errors anymore :)
I changed the target framework from 4.5 to 4.6.1 and it fixed it for me. My assumption is sometimes when you change target framework back and forth and the process does not go through all the way (cancelling in the middle of changing it) - something happens that leads to this error. Hope that helps
I solved this be closing VS, deleting contents of the .vs folder where my solution is, restarting VS and recompiling.
Seems like one of those file/settings/caching problems that pop up now and then, might be after switching source branch.
VS2019, .net fw 4.6.2.
If your C drive (Where you are installing Visual Studio) does not have enough space, try moving some files from the C drive to another drives.

Resharper 6.0 code analysis and font configuration unavailable

After I uninstalled Resharper 5.0 and installed the latest 6.0, code analysis stopped working on VS 2010 (on vs 2008 it still works).
During investigation I noticed that Fonts and Colors is also not showing Resharper's items.
I tried clearing the Registry value at HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\FontAndColors\Cache and it didn't work.
I tried uninstalling 6.0, resetting VS's settings, reinstalling 6.0.
I tried then repairing the installation for 6.0.
I tried disabling stylecop plugin for resharper.
I tried clearing the cache for the solution I'm working.
I tried creating a new project to see if it was yet something else related to my project.
I tried looking at the VS startup log, resharper starts with no errors.
I tried uninstalling 6.0 and installing 5.0 again, 5.0 is still working with code analysis and has fonts and colors configuration.
New ideas are welcome.
Could you run Visual Studio with the following command line: 'devenv /ReSharper.LogFile C:\resharper_log.txt /ReSharper.LogLevel Verbose'.
After that, please create a new Class Library solution, verify the issue and send me a corresponding 'resharper_log.txt' file to "support[at]jetbrains.com".
Thanks.
Alex Berezoutsky,
Support Engineer,
JetBrains Inc.
"Develop with pleasure!"

Resources