I've used the Nuget Package Manager in Visual Studio 2017 to install StyleCop.Analyzers, which I'm very happy with. However, every time I close and re-open Visual Studio, StyleCop is no longer listed in the analyzers.
The only way I can get it back to analyzing my code is to uninstall it from Nuget, then reinstall it, and go through the process of enabling/disabling rules per that project. After that, it will work properly. How do I keep StyleCop.Analyzers working when I restart Visual Studio?
It looks like the issue was Unity, so this is a very niche problem. There are a couple attempts at solving it listed here:
https://forum.unity.com/threads/unity-and-stylecop-analyzers.639784/
Related
Probably a simple question but I'm just coming back to using visual studio after years of intellij.
Visual studio recognizes none of the classes from the system namespace. Something is clearly wrong with my dependencies, but I have no idea what or where to find what's wrong. This is in Visual Studio Community 2019 if that helps.
If I have to reinstall .net or something like that please instruct me well, made mistakes there before and I find it really hard to know what I'm doing in that department.
The solution to solve the problem is opening a command prompt at the root of the project, execute dotnet restore.
The dotnet restore command uses NuGet to restore dependencies as well as project-specific tools that are specified in the project file.
Every time I try to open a C# Script inside Unity, it immediately hangs and doesn't even open Visual Studio, this started happening after I updated Visual Studio 2017 twice, the first one was an incomplete installation since my computer restarted then the second one was completed version.
Unity still works normally for all things except opening a C# script. I tried changing the External Tools Preferences in the Edit between Visual Studio 2017 and Visual Studio 2017 (Community) but both did nothing.
When Unity hangs, I can only use Task Manager to close it and MonoDevelop isn't one of the options in the External Tools Preferences
Can you open Visual Studio when Unity is not open? Which version of Unity are you using for your project? Are you using Unity Hub to manage your versions?
Steps to try:
Reinstall VS (update to 2019 optional)
Close all background services related to VS and Unity.
If all else fails, you can clean the registry before reinstalling.
Uninstall both Unity, VS and any dependency that you have installed. Then go to Hub and download your required version with all the required dependencies.
Doing this will remove any inconsistency and also you will not have to do the external tool reference yourself.
I don't know why but after upgrading Microsoft to the insider preview version. I know, it's always a bad idea to update anything but had to do it to get the new MR Headsets to work...
I downgraded again after visual studio was unable to create any app packages. And it still doesn't work.... tried to repair visual studio and still nothing. I know it's a VS issue because i can't even build older projects which always worked and which i haven't touched.
And now after reinstalling it tells me that the package is unavailable and that i should install windows10 sdk even tho i installed it 100x already.
Edit: I'm also constantly getting this error:
And even after installing the file suggested below nothing works.
I don't get my Microsoft keeps building shit that never works..
Sounds like you should try the last resort:
https://learn.microsoft.com/en-us/visualstudio/install/remove-visual-studio
Use the InstallCleanup.exe to remove all things
There are known issues with using visual studio 2017, when doing hololens development, my stable environment is visual studio 2015 Update 3.0.0 and Unity 5.5 0f1. These I know will work together. Also, if you are trying to use the hololens toolkit, you will also have issues with the new versions of Visual Studio. So you will want to take the Dev branch and not master.
Since updating to the most recent version of Unity 5.4.0f3, whenever I doubleclick on a script, it launches both Visual Studio and Monodevelop, but I get an error saying that the this version of VS (Community 2015) is unable to open my project. Monodevelop displays it's own, somewhat less clear error message. Please see the screen shots below.
I can still manually open my script using Visual Studio's file menu, but the intellisense code completion no longer works. Anyone know how to fix this? I have Visual Studio's Tools for Unity installed.
I was having similar issues when doing a clean download of an existing Unity project onto a fresh install of Visual Studio Community 2019.
In the end the issue for me was that, although the correct version of VS Tools for Unity was installed, it was 'Disabled' by default in VS's Manage Extensions dialog (Extensions -> Manage Extensions). Just had to click 'Enable', restart Visual Studio, and all worked as expected again.
Turns out it was an issue with my existing install of Visual Studio Tools for Unity (VSTU).
I found a thread where users had experienced similar problems due to an unsupported version of VSTU running on Unity5.2 and beyond. Unity 5.2+ requires VSTU 2.1 or later for VS to work correctly with Unity, more information for anyone interested is available in the documentation here.
I had VSTU 2.3 installed, but removing and reinstalling VSTU resolved the issue, so there must have been a problem with my install. If anyone else has this or a similar issue you can download the latest installer for VSTU here. Thanks to all who chimed in your responses helped me look in the right place!
Please try following steps:
Delete old *.csproj and *.sln files on project's root folder
Check "Edit > Preferences > External Tools" and make sure you've selected "Visual Studio"
Re-open solution by "Assets > Open C# Project" menu
For me it was enough to right click the solution in Solution Explorer and run "Resolve errors".
I will complete what is said above. I experienced this issue today and it took me a while. In my case it was relative to a new install of the Unity Editor.
For some unknown reason the unity tool used on VS (intellisense) was uninstalled. I had to reinstall this : open Visual Studio Installer, select your project and reach the Gaming section where reside the tool for Unity.
The extension "Visual Studio 2019 Tools for Unity" seems no longer available for download via the extension manager. Luckily I recalled that I saw some game development features in the Visual Studio installer, so I picked that one:
It works for VS 2019 (16.11.11) and VS 2022 (17.2.0 Preview 1).
I'm trying to create my own VSIX package using the Project template. But when I actually launch it, it doesn't appear to be loading anything. That is, when running the project, it opens up another copy of visual studio, but it doesn't actually load up my plugin. I've compared my plugin to the other sample templates, and I just don't see anything wrong. It seems like it should be pretty straightforward. Are there any other steps besides creating the project that I have to do?
Are you using the visual studio experimental instance for debugging? You can enable this in the Project properties (right click your project and choose properties). Go to the 'Debug' tab and add the following line to 'Command line arguments': /rootsuffix Exp
More information about the experimental instance can be found on msdn.
I spent an entire day trying to reset Visual Studio (2015 Community Edition) by unloading features, deleting the cache directory, using the install to repair -- all with no success.
I finally uninstalled Visual Studio with success. When I initially installed Visual Studio, I had packages errors, like Python, that failed to load, but my Test Explorer worked beautifully. The test Explorer package stopped working in time. After re-installation, everything worked without any package load errors. Also, pay attention to the xml error files, because mine produced exceptions thrown by the package. (The xml error file is reported in the error dialog when Visual Studio informs the package failed to load.