The "GetReferenceNearestTargetFrameworkTask" task was not found in visual studio code [duplicate] - c#

I have a problem with autocompletion in VS 2017 Community.
Previously I had VS 2017 Enterprise from school, but the key expired so I moved to Community.
Before, everything works great, but now it doesn't work at all.
I found a solution on Stack Overflow here but it doesn't work, so found another solution at GitHub here.
And I got this:
Build FAILED.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1601,5): error MSB4036:
The "GetReferenceNearestTargetFrameworkTask" task was not found. Check the following:
1.) The name of the task in the project file is the same as the name of the task class.
2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface.
3.) The task is correctly declared with in the project file, or in the *.tasks files located in the
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin" directory.
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.11
Do you know what to do next?

I had the same error message but for a different problem.
So, I'm using MSBuild to automate build/deploy process for Azure Functions. Everything was working fine until I updated both Visual Studio 2017 and Visual Studio Build Tools 2017 at which point I started getting this error. To be precise I got this error only when using MSBuild, building project manually from VS was working fine.
In my case I already had everything set as per #Programmer's answer.
But as I was using MSBuild it turned out that I also had to install NuGet targets and build tasks which are part of Visual Studio Build Tools.

Follow these to fix that error. This applies to VS 2017:
Fix 1:
1.Install Nuget PackageManager from here.
2.Restart Visual Studio.
If the problem is still there, continue below
Fix 2:
1.Download and start/run the Visual Studio Installer again.
2.While the Visual Studio Installer is still running, go to the "Individual Components" tab
3.Tick the "NuGet package manager" check-box that is under "Code tools" option.
4.Click Install to install it.
Screenshot of where this is located:
That should fix the error you see in this question. Restart Visual Studio and test the auto-completion function. If it's not working, see the answers from this question as that is a whole different issue.

I was seeing this issue with msbuild 15.6.82 on a build environment that does not have VisualStudio 2017, only VS Build Tools.
Here's a PowerShell script that resolves this issue, it pretty much does the equivalent of previous answers in the VS Installer, but silently and waiting for completion.
Start-Process "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList 'modify --installPath "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools" --quiet --add Microsoft.VisualStudio.Component.NuGet.BuildTools --add Microsoft.Net.Component.4.5.TargetingPack --norestart --force' -Wait -PassThru

I'm working with a headless build server on server core, resolved by installing chocolatey package choco install visualstudio2017-workload-webbuildtools from here:
https://chocolatey.org/packages?q=msbuild

I'm reporting an answer from a Microsoft techician
This usually indicates one of two things:
A failed VS installation. If that's the case, I would recommend running a repair on your VS install.
You have msbuild assemblies in the GAC. If that's the case, please ungac them.
Livar Cunha [MSFT]

I got the same problem in Visual Studio 2019, I solved it by simply install unity package

Related

Set toolpath to MSBuild 2019 in a TFS 2013 using (XALM) build process templates

TL;DR: Clean Windows build server, MS Build Tools 2019 and TFS 2013 installed.
Build Logs says Exception Message: File not found: MSBuild.exe (type FileNotFoundException)
How Do I setup MSBUILD toolpath in a XAML file on TFS 2013, configured to use MSBuild 2019 with a Visual Studio 2019 Enterprise installed on my dev box.
Please provide FULL XAML file that WORKS with TFS2013 (update 3) with an explicit custom msbuild path.
A Bit more info:
We have a multi server setup for our TFS build routines running version 2013.
One controller and a few agent servers here and there, nothing fancy.
Recently I added yet another for GUI Testing - I need the agent service to be in Interactive mode.
Steps so far:
Installed TFS 2013 including two agents - linking to the main controller.
I install Build Tools version 2019
I added tags to control the build destribution.
Activated a build and the rest is history.
I'm four (frustrating) days in on this - I've read every Stack Overflow TFS set toolpath entry I can find, and a huge bunch of odd forums, yet none seems to scratch my itch here.
I even added both paths you see further down, to the Windows environment PATH variable. Im not sure that does anything anymore.
See; Everybody talks about this entry in the XAML that says toolpath (or similar) - but; I dont see it. We use a minor changed version of a TfvcTemplate.12.Xaml.
Many also talk about this GUI tool for editing XALM files, where I get to see all the different options available (I presume) - can someone help me with this too? Its certainly not working out of the box with a 2019 Enterprise????
So; I installed this Extension Process Template Editor, but of course nothing happens when I click a XAML file, just more XML :)
I now have a few added paths on the new server, where I see instances of msbuild.exe installed (MS/.NET get your act together, please)
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin
C:\Program Files (x86)\MSBuild\12.0\Bin
Please try not to write this off as a duplicate at first glance. I know its similar to other questions - however; Devil is in the details.
Set toolpath to MSBuild 2019 in a TFS 2013 using (XALM) build process templates
Just as you know, the Old Visual Studio versions installed msbuild into C:\Program Files (x86)\MSBuild\<version>\bin and apparently the RunMSBuild activity used the ToolVersion + the ToolArchitecture to calculate this path.
VS 2019 build tool instead installs it C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin and the RunMSBuild can't calculate the proper path anymore. You can not use the old DefaultTemplate12.xaml to integrate with VS2019 build tool.
To make this work, you could try to modify the TFSBuildServiceHost.exe.config and you must have a version of VS 2019 build tool or VS2019 installed on the build server in order for this to work.
More detail step please follow Jonesy2488's answer in this link:How to get VS 2017 working with TFS 2017 XAML Builds.
Besides, we could also try to use MSBuild task instead of Visual Studio Build task, then specify the location of MSBuild 16.0:
Hope this helps.
I made it work by changing ToolVersion for mtba:RunMSBuild in TfvcTemplate.12.xaml to the required version and adding MSBuildToolsPath to Windows Registry.
Registry settings for 15.0 and 16.0
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\15.0]
"MSBuildToolsPath"="C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\15.0\\Bin\\amd64"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\16.0]
"MSBuildToolsPath"="C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\MSBuild\\Current\\Bin\\amd64"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\15.0]
"MSBuildToolsPath"="C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\15.0\\Bin"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\16.0]
"MSBuildToolsPath"="C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\MSBuild\\Current\\Bin"

C# Predefined type 'System.Object' is not defined or imported

In .NET core project, I changed the all projects name than after reloading all project that time many errors were showing approx 3225. And mainly all errors are related to system namespace like
System.Object not defined or imported
System.Boolean not defined or imported
Task does not exist
namespace ArgumentNullException could not be found
How do I resolve all those errors?
close VS
delete the bin, obj and .vs (may be hidden) folders
manually run dotnet restore
reopen the project in VS
That fixes most things.
I was hitting this in VS Code. In Windows Terminal, dotnet build and dotnet run ran fine, but I was getting the errors in VS Code. The delete/restore/reopen answer did not fix it.
It seems it was an issue where I had an outdated version of Visual Studio confusing the C#/OmniSharp extension in VS Code.
The OmniSharp log included something like this:
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 2 MSBuild instance(s)
1: Visual Studio Enterprise 2019 16.8.30907.101 16.8.3 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin"
2: StandAlone 17.0.0 - "c:\Users\foo\.vscode-insiders\extensions\ms-dotnettools.csharp-1.23.16\.omnisharp\1.37.16\.msbuild\Current\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: Visual Studio Enterprise 2019 16.8.30907.101 16.8.3 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin"
That version of Visual Studio 2019 did not have the .NET 6.0 SDK installed, and I couldn't find it in the VS Installer.
So I installed Visual Studio 2022 and the .NET 6.0 SDK as part of that install. Now my log looks like this:
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 3 MSBuild instance(s)
1: Visual Studio Enterprise 2022 17.0.31912.275 17.0.0 - "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin"
2: Visual Studio Enterprise 2019 16.8.30907.101 16.8.3 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin"
3: StandAlone 17.0.0 - "c:\Users\foo\.vscode-insiders\extensions\ms-dotnettools.csharp-1.23.16\.omnisharp\1.37.16\.msbuild\Current\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: Visual Studio Enterprise 2022 17.0.31912.275 17.0.0 - "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin"
And the errors are gone!
Disclaimer: I work for Microsoft.
In my case, Error List window had hundreds of errors. But when rebuild the solution, used to get the message Rebuild All Succeeded. And even the project was able to run. But entire code was in red.
Just closing Visual Studio and deleting vs folder did the job.
Gazi's solution above solved my problem which was exactly what she/he described. I had tried updating VS, cleaning and rebuilding solution, restarting VS. Nothing helped. Removing the hidden vs folder at the solution level did the trick. Hope it helps someone!
This can also be caused by a circular dependency between projects in a solution.
error MSB4006: There is a circular dependency in the target dependency graph involving target "_GenerateRestoreProjectPathWalk"
Just like citelao I've got this issue in VS code when created new .NET 6.0 isolated AZ Function using wizard.
In OmniSharp logs I had about the same.
Just in case, in order to see the omni sharp logs, you have to open 'output' panel, and there on the right click on a drop-down:
I did not want to install VS 2022 as my target was to work in VS code for this project. I found the answer here: omnisharp-roslyn #2247
Basically the solution was to add omnisharp.json file in the project root with the following contents:
{
"msbuild": {
"useBundledOnly": true
}
}
After that I've closed VS Code, deleted bin and obj folders and started VS Code back.

The imported project C:\...\v4.5\Microsoft.Expression.Blend.WPF.targets" was not found

I was developing my WPF projects using Visual Studio 2013 in my old window 7. But when I installed new Windows 10 and also Visual Studio 2017 and tried to open my project; my project fail to load and got this error message:
the imported project "C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise\MSBuild\Microsoft\Expression\Blend.NETFramework\v4.5\Microsoft.Expression.Blend.WPF.targets"
was not found. Also, tried to fiend
"Microsoft\Expression\Blend.NetFramework\v.4.5\Microsoft.Expression.Blend.WPF.targets
in the fallback searchpath(s) for $(MSBuildExtensionsPath) -
"C:\Progam Files (x86)\MSBuild" . These search paths are defined in
"C:\Users\AdminPC\AppData\Local\Microsoft\VisualStudio\15.0_51bebed7\devenv.exe.config"
. Confirm that the path in the declaration is correct , and
that the file exists on the disk in one of the search paths.
C:\Users\AdminPC\Documents\Visual Studio
2013\Projects\MyCustomMessages\MyCustomMessages.csproj
I Searched for some solutions I found I have to install BlendWPFSDKv4_en.msi Version 4, but still doesn't help also there is no BlendWPFSDKv4_en.msi version 4.5. What Should I do, Shall I install VS 2013 in order to fix this issue?
The imported project C:\…\v4.5\Microsoft.Expression.Blend.WPF.targets" was not found
Found it. You should launch the Visual Studio Installer from the start menu, switch to the "Individual components" page, under the "SDKs, libraries, and frameworks" heading, find the "Blend for Visual Studio SDK for .NET" and install it:
After the installation is complete, you will find it under the path:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\Expression\Blend.NETFramework\v4.5
Certified:Visual Studio 2017 - What happened to Expression interactions?
Hope this helps.
You can remove the reference to blend;
With VS 2019 - Right click on the (unloaded/load failed) project.
Select - edit your *****.csproj file.
At the bottom of the file, remove the following line
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Expression\Blend\.NETFramework\v4.5\Microsoft.Expression.Blend.WPF.targets" />
Save, Reload the project & happiness.
I had solved the problem by installing
Install Microsoft Expression Blend Software Development Kit (SDK) for .NET 4,
without install an older version of VS
I had solved the problem by installing VS2015 in the same machine that has VS2017 and now the project works fine in VS2017.

vs_buildtools.exe missing from Visual Studio Build Tools 2017

I installed the Visual Studio Build Tools 2017 using the link (at bottom under Other Tools and Frameworks) installing both workloads: Visual C++ build tools and Web development build tools. I kept the default folder.
Based on quite a few articles, such as Microsoft Web Application Targets is Missing, I expected to see vs_buildtools.exe in the folder: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin folder, but no. I see MSBuild.exe, as you can see from this screenshot.
Here is a screenshot of the installer.
Really, there are quite a few articles saying the exact same thing: 1, 2, to name only 2.
How do I get vs_buildtools.exe?
Apparently the only way to solve my Microsoft induced Web Application Targets missing problem, as it is no longer in 15.0 is to use this executable and run the vs_buildtools.exe --add Microsoft.VisualStudio.Workload.WebBuildTools as the answer specifies. I am also annoyed now that something that should be there is not. Did Microsoft change something in a newer revision of the Build Tools?
How do I get vs_buildtools.exe?
You have already got the vs_buildtools.exe.
I installed the Visual Studio Build Tools 2017 using the link (at bottom under Other Tools and Frameworks) installing both workloads
You will notice that the installed file name is vs_buildtools__339506979.1501125082.exe, which include the version info in the name. You can rename it to vs_buildtools.exe, that is what you want.
Update for vs_buildtools.exe:
After use the command:
vs_buildtools.exe --add Microsoft.VisualStudio.Workload.WebBuildTools
The WebBuildTools will be installed at:
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\WebApplications
Besides, be aware that the comment under the answer:
If you already have downloaded the "Build Tools for Visual Studio
2017" installer
(visualstudio.com/thank-you-downloading-visual-studio/…), then you can
launch that installer, hit Modify and tick the "Web development build
tasks" workload module checkbox. Then click the Modify button and let
the installer finish.

How can I fix the Microsoft Visual Studio error: "package did not load correctly"?

I installed Visual Studio 2012 and DevExpress 13.1. As Visual Studio started, it generated an error shown by this attached image,
The 'Microsoft.VisualStudio.Editor.Implementation.EditorPackage' package did not load correctly.
The problem may have been caused by a configuration change or by the installation of another extension. You can get more information by examining the file 'C:\Users\must\AppData\Roaming\Microsoft\VisualStudio\11.0\ActivityLog.xml'.
Continue to show this error message?
This error also appears in Visual Studio 2017.
I started to see this on a fresh Windows and Visual Studio 2013 Ultimate with Update 2 installation (although others have also reported it on Updates 3 and 4, as well as the Professional version).
To resolve the problem, close all Visual Studio instances, then delete all files in the following folder:
Visual Studio 2013
%localappdata%\Microsoft\VisualStudio\12.0\ComponentModelCache
It worked fine for me. Thanks to this article.
Visual Studio 2015
%localappdata%\Microsoft\VisualStudio\14.0\ComponentModelCache
Visual Studio 2017
%localappdata%\Microsoft\VisualStudio\15.0_xxxx\ComponentModelCache
Visual Studio 2019
%localappdata%\Microsoft\VisualStudio\16_xxxx\ComponentModelCache
Visual Studio 2022
%localappdata%\Microsoft\VisualStudio\17_xxxx\ComponentModelCache
I encountered this problem in Visual Studio 2017 (15.7.4). After trying various solutions, eventually this worked for me: close all Visual Studio instances, and run this from the command line (possibly with administrator rights):
devenv.exe /clearcache
devenv /updateconfiguration
Close Visual Studio.
Backup and delete the following path:
C:\Users\{your_username}\AppData\Roaming\Microsoft\VisualStudio\11.0
Restart Visual Studio as Admin. Otherwise, the Roaming folder can't be repaired by Visual Studio.
Try devenv /setup on the Visual Studio Command Prompt with administrative rights.
I had the same problem with Visual Studio 2013 Ultimate. I tried the solution by Reza posted here, but it didn't work.
Eventually I couldn't close Visual Studio. It was showing a similar dialog when I tried to close, and it wasn't closing. I tried this: Error message "No exports were found that match the constraint contract name". Neither.
I noticed a message in the Team Explorer window saying "Page 'somenumber' cannot be found". I tried that way, and I found this answer: Page '312e8a59-2712-48a1-863e-0ef4e67961fc' not found using Visual Studio 2012. So I run devenv /setup on the Visual Studio Command Prompt with administrative rights.
It did the job, and everything is fine now.
Solution for Visual Studio 2017:
Step 1: open Visual Studio cmd in administrator mode (see start menu item: Developer Command Prompt for VS 2017 - Be sure to use: Run as administrator)
Step 2: change directory to the folder where Visual Studio 2017 is installed, for example:
cd C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise
(You can copy/paste this command to your cmd prompt. For Visual Studio Professional, the folder will be called "Professional" instead of "Enterprise", etc.)
Step 3: copy/paste the below command
gacutil -if Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.Shell.Interop.8.0.dll
Hit Enter...
It will resolve the issue...
Otherwise, you can also add the following to the GAC as above:
Microsoft.VisualStudio.Shell.Interop.9.0.dll
Microsoft.VisualStudio.Shell.Interop.10.0.dll
Microsoft.VisualStudio.Shell.Interop.11.0.dll
I had a similar problem, and I went to Control Panel → Programs and repaired the Visual Studio installation. It worked for me.
I had the same problem. Try to remember the latest extension that you installed. I delete the latest extension from extensions and updates and restart Visual Studio. and the problem is solved. For me, the extension name is Productivity Power Tools
I had a similar issue (Tizen Project type package did not load correctly) with Visual Studio 2017.
After trying all the answers above, and spending a few hours searching for a solution for the errors inside ActivityLog.XML, nothing worked for me.
Eventually, the solution was a Visual Studio Repair.
I assume that the repair process overrides some configurations that caused the problem.
Repair Visual Studio 2017
Repair Visual Studio 2019
I also experienced this issue after installing Telerik Reporting. I was not able to launch any solution in Visual Studio 2013, nor could I close Visual Studio 2013.
After uninstalling the reporting package and deleting Local / Roaming AppData for Visual Studio 2012, the problem was fixed.
In my case the error message is "The 'IntelliCodeCppPackage' package did not load correctly" (Visual Studio 2019):
I solved this is issue with these steps;
Disable the Visual Studio IntelliCode extension
Restart Visual Studio
Enable that extension again
I tried everything except the repair. I even did an update. This is what fixed it for me:
Open "Developer Command Prompt for VS 2017" as Admin
CD into (your path may vary) CD C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\PublicAssemblies
Run command gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll
Restart Visual Studio
Based on this Connect feedback I fixed it by closing all opened documents and restarting Visual Studio. I use Visual Studio 2015.
You need to find file devenv.exe.config in C:\Users\{user_name}\AppData\Local\Microsoft\VisualStudio\14.0\ and update it. (Or C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\, depending on the location of your devenv.exe file.)
For this particular case, you should find rows that setup redirects for System.Collections.Immutable and change newVersion from 1.1.36.0 to 1.1.37.0.
The original article is How to restore Visual Studio 2015 after the Update 1 (dependency dance).
I had this problem, and projects were not loading correctly or stating that they needed migration. The ActivityLog.xml showed an error with a particular extension. I uninstalled the extension and restarted Visual Studio. That resolved the issue.
I also experienced the same error, "NPM package not installed correctly",
while creating a Node.js project in Visual Studio 2015.
I resolved my issue by performing two steps:
Delete all files present in this location:
C:\Users\<Your User Name>\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache
Restart Visual Studio.
Open Visual Studio and go to menu Tools → NuGet Package Manager → Package Manager Settings →
On the left side: You will see a drop down list: select Node.js, Tools → Npm → ClearCache → *OK
Then again try to create the project. It resolved my issue.
I had the pleasure of experiencing this random problem in Visual Studio 2017 Enterprise.
I tried every solution here, and it didn't work, including the Visual Studio repair (which takes a while). Several hours in, I thought maybe I should actually check the ActivityLog.xml file.
I uninstalled the offending extension from the 'Developer Command Prompt for VS2017' as an administrator since Visual Studio just freezed after open and nothing could be clicked.
Steps to uninstall - courtesy of jessehouwing.net
Find the vsix file you used to install the extension.
Open it in your favorite archiver (mine is 7-Zip).
Grab the extension's Id from the Identity node from the extension.vsixmanifest.
Run (in my case) vsixinstaller /u:Microsoft.VisualStudio.LiveShare to remove the extension.
Find the ComponentModelCache folder
Delete Microsoft.VisualStudio.Default.cache
Restart Visual Studio
Enjoy using Visual Studio.
I had a similar problem.
After checking ActivityLog.xml and it said that it could not create an instance for the Extension/package name from a specific folder. I traced that path and I didn't find that folder it is looking for.
So I installed the extension again, I looked for the dll, and copied the containing folder contents to the folder Visual Studio is looking for.
So to recap:
Check if the folder in the error exists
If not, create a new folder with the same name
Look for the dll in the error in the Visual Studio folder, if not found, install the extension again
If the error resists, search inside the Visual Studio folder in Program Files (x86) for the dll and open the containing folder
Copy all the contents
Paste inside the new folder you have created with the name mentioned inside the ActivityLog.xml
Firstable, you need to be sure have the last Microsoft .NET Framework version, in my case, I had the 4.6 version and I have downloaded and updated the .NET Framework 4.8.03761 Developer Pack, from the official site:
https://dotnet.microsoft.com/download/dotnet-framework/net48
Once I restarted my PC, to continue fixing that, I solved this problem by clearing Visual Studio Component Model Cache.
Just delete or rename this folder:
%LocalAppData%\Microsoft\VisualStudio\11.0\ComponentModelCache
or
%LocalAppData%\Microsoft\VPDExpress\11.0\ComponentModelCache
and restart Visual Studio.
Since this is the top SO result in google for this issue, I'm going to leave my fix here for VS 2022 when experiencing this issue. I found it is commonly caused by an extension issue. In my particular case TypeScript Definition Generator was causing the issue and removing the extension solved it. To find which extension could be causing the issue, run VS with the /Log command line switch.
i.e.: "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.exe" /Log
After the error occurs, close VS and locate ActivityLog.xml found at %AppData%\Microsoft\VisualStudio\<version>\ActivityLog.xml. Search the log for any extensions reporting an error and uninstall it.
I just wanted to mention that I got a similar error in SQL Server Management Studio 2016, where I basically ignored it. Later, I launched Visual Studio (2015), and this error occurred there as well.
I searched and found the answer here recommending that files be deleted from the
%localappdata%\Microsoft\VisualStudio\14.0\ComponentModelCache
folder. However, in my case, this folder was empty.
Since I remembered that I saw the error in Management Studio first, I checked, and there was a similar folder at
%localappdata%\Microsoft\SQL Server Management Studio\13.0\ComponentModelCache
This folder was not empty. I closed both Visual Studio and Management Studio, and deleted the files from this folder.
Afterwards, both Management Studio and Visual Studio launched without error.
I had this problem after installing Crystal Reports for Visual Studio. I solved it by closing all Visual Studio instances and reinstalling Crystal Reports.
I solved it:
Go to install
Modify
Go to "Installation location" tab
Check "keep download cache after the installation"
Modify
My issue was Mysql connector net 6.4.4, Nuget, xamarin, VSPackage, EditorPackage and etc.. package did not load correctly.
My solution is below for vs2015
Open AppData location // all the configurations are updating on it.
Backup and Remove the folder in which configuration error is thrown in the visual studio.
forex. If you have Nuget package did not load correctly error - Remove Nuget folder in Local and Roaming directories.
And also clear the data on AppData/Microsoft/visual Studio/14.0 for vs2015
that's it and it worked for me!...
For Visual Studio 2019: I have done the following things to solve the problem
Backup the following Folder. After Taking backup and Delete This Folder C:\Users\munirul2537\AppData\Roaming\Microsoft\VisualStudio\16.0_add0ca51
Go to the installation panel of visual studio and do the following things
1.Go to install
2.Modify
3.Go to "Installation location" tab
4. Check "keep download cache after the installation"
5. Modify
For Visual Studio 2017, 2019. I got this error and able to fix it just by enable the Live Share extension from extensions.
see the VS community page for detail.
For others that have a similar problem but with live share.
In the visual studio installer there was a warning that live share was not installed correctly and a modification was pending, that would download live share again.
After completion of the modification the error was resolved.
I had the same problem for Visual Studio 2019 v16.8.6. It was fixed after repair Visual Studio from Visual Studio Installer.
After trying lots of options this worked for me (VS 2019):
Launch Developer Command Prompt for VS 2019 (Run as Administrator)
cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\PublicAssemblies" Replace Community with your specific distribution.
Execute the next line: gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll
One more solution that worked for my colleague after trying all the others that did not work (for Visual Studio 2022).
Try this:
Close all instances of Visual Studio
Go to: C:\Program Files (x86)\Microsoft SDKs\Windows
You should see a number of vX.0-like directories (e.g. v10.0A for Visual Studio 2022 Enterprise). Back-up and remove all those directories except the one matching your Visual Studio (in my case I'd remove everything except v10.0A).
Start Visual Studio. The "package did not load correctly" warning will be gone.
Rationale:
If you had older versions of Visual Studio installed previously, they will come with their own NETFX Tools which might not uninstall correctly together with those older instances of Visual Studio. The new Visual Studio will for some reason pick the old Tools and fail using them. Removing the redundant directories fixes it.

Categories