Unity referances not working Visual Studio 2022 - c#

As seen in the image bellow, references are not showing up in visual studio.
I was just using visual studio and i closed the project opened some other project and opened the unity project again in visual studio.
But then none of the references shows up and i cant really fix it.
Any ideas on how to fix this?

In Unity Editor try:
Edit -> Preferences... -> External Tools -> Regenerate project files

This problem happened to me, I couldn't solve it, I reinstalled visual again and downloaded c# plugins and module so it worked

The code pair may not be able to compile due to not referencing the relevant library files and namespaces

Related

Not getting autcomplete for Unity in Visual Studio 2019

I know this has already been addressed many times, but really I have tried everything that I found and I just can't get the autocomplete to work. I first tried VS Code but I could not get it to work, then I opened Visual Studio and tried everything I found in different forums but nothing.
I have already tried:
Downloading Unity tools for Visual Studio
Regenerating project files
Setting Visual Studio as preference in Unity.
Redownloading Visual Studio.
I think I may have missed something in the External tools window, but I am not sure about what.
External Tools Window
My editor with the file structure

The Unity Scripts edited in Visual studio don't provide autocomplete...2020

just like the title Unity Scripts edited in Visual studio don't provide autocomplete. i am trying to make a rigid body and as you can see it doesn't recognize it, some help? By the way i can't change the "External script editor" to something else but "open file by extension:
Your installation of Visual Studio is probably missing the Visual Studio Tools for Unity extension.
Try this installation guide: Get started with Visual Studio Tools for Unity
There is a previous forum that provides guidance on this issue which is still relevant in 2021:
Unity Scripts edited in Visual studio don't provide autocomplete
One solution that worked for me that was not in that forum was going to the Solution Explorer tab in Visual Studios. Right click the solution and hit resolve errors. This may fix the issue.

Unity solution not compatible with visual studio

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).

“This project requires a Visual Studio update to load” error when creating a Xamarin.Forms Cross-Platform Application

When I create a Xamarin.Forms application using Visual Studio Community 2015 Community on Windows 8.1 it shows me this error on load:
A problem was encountered creating the sub project 'App1.WinPhone'. This project requires a Visual Studio update to load. Right-click on the project and choose 'Download Update'
I've installed all updates available and trying on a newly installed Windows.
Note: I had this error in Forms.
How can I fix this error?
Note: There isn't a Download Update option in Solution Explorer.
Navigate to where you saved the project files that you created in Visual Studio. Default location is C:\Users\PSDan\Documents\Visual Studio 2015\Projects.
Open the project folder that you are experiencing problems with and navigate to C:\Users\PSDan\Documents\Visual Studio 2015\Projects\test\test\test.Windows folder. Inside this folder is a file called test.Windows.csproj.
Right click on that file and open with... using Visual Studio, by doing this it should detect the missing package and in my case automatically prompted to install the missing package.
I've been seeing similar errors for .Window or .WindowPhone and what I've observed is that it is due to missing SDK. Same might be the case with you.
Do you see App1.Droid appearing in the solution? (I guess NO)
Go to file explorer and locate App1.Droid.csproj (..\App1\App1.Droid\App1.Droid.csproj) and open this in a new instance. There it will pop up "Install Missing Feature" dialog and you can follow the steps to install missing components.
If your issue is the same as here:
Project required a Visual Studio update
then you may try and see if this solution works:
[Cause is] a mismatch of the target framework version and profile in the .csproj file. Despite the target framework being correct in the project Properties, they were not being correctly saved for whatever reason. Thus, when trying to install a utility library from nuGet, it left my project in the state you described.
The solution was to go by this site:
Framework Profiles in .NET
and find the correct combination, then manually edit the .csproj file to adjust <TargetFrameworkProfile> and <TargetFrameworkVersion>.
Installing Visual Studio Update 3 with selected features "Windows 8.1 and Windows Phone 8.0/8.1" and "Cross Platform Mobile Development" solved the problem for me.
Uninstall Xamarin completely, and reinstall it. That happened to me as well. I would uninstall Visual studio too. Install that first, then install Xamarin.
Edit: I know this sucks to do, but it was what the Xamarin team had me do to resolve it. As far as I know this is the official fix as of last week.

Visual Studio Cannot open cshtml Files

I have a problem, which I cannot solve. I can't open every cshtml-File in a Visual Studio c# mvc project (whatever which project i tried).
I get the following error Msg (I try to translate to English):
Object reference not set to an instance to an object
Google says, it may be a NullReferenceExeception. But it has nothing to do with my code, because first I can execute the project successfully and second the error occurs in every project (since today).
I just experienced the same issue. It just came out of nowhere, as you described. I even went through a 2 hour repair. That didn't fix it.
However, a coworker suggested this fix.
Visual Studio 2015 not syntax highlighting razor nor Intellisense
I had the same problem, the only fix so far is by resetting all user data (C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe /ResetUserData).
Now I am able to use the real default editing and I get good syntax highlighting again.
The solution that worked for me was from here
Close VS
Delete the content of
%LocalAppData%\Microsoft\VisualStudio\15.0\ComponentModelCache
Open VS
As suggested by #jamez14, if your are using a different version of Visual Studio, just change 15.0 in the path to the version you have.
I faced the following issue.
ISSUE: All .cshtml were not opening in visual studio 17 community.
REASON: Accendently shutdown laptop by power off button while files were open in visual studio.
I tried all the above solutions but none worked.
Following solution worked for me.
Repaired Visual Studio using Visual Studio Installer.
I had the same problem and the issue turned out that I had disabled Razor Language Service Pack.
To re-enable go to :
Tools > Extensions and Updates > search for Razor Language Package and enable. Close VS and reopen.
Running the in console the command: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe /ResetUserData should fix your problem as it resets all user data
This worked for me: Visual Studio 2015 Broken Razor Intellisense
Didn't reset my preferences or caused other side-effects.
It is caused by the version of Razor when updates by NuGet and clean the solution. re-build the project and will open without problems.
I had this same thing recently, resetting profiles and the like didn't work, it turned out that I had some dodgy web.config settings:-
Removing these lines and re-building the project appeared to solve the issue and I could open cshtml files normally:
<add key="webpages:Version" value="4.0.0.0" />
<add key="webpages:Enabled" value="false" />
I found this solution in a github bug thread that mentions many other potential fixes. It seems to be related to updating your version of ASP.Net on an existing project.

Categories

Resources