Error: SetSite failed for package [ApacheCordovaToolsPackage] - visual-studio

I just installed both Visual studio 2015 and visual studio cordova tools.
It wrked fine and i was able to create a project with it.
I then installed ionic cli, and suddenly i am getting the error
SetSite failed for package [ApacheCordovaToolsPackage]
I have tried repairing Visual studio and cordova tools to no avail.
Any help?

The steps in this MSDN forum post worked for me. Reproducing for Googleability:
Find the installer for Visual Studio 2015 in your installer cache.
cd /d "%ProgramData%\Package Cache"
dir vs*exe /s /b
Find the path to vs_community.exe, vs_professional.exe, or vs_enterprise.exe, and copy that path.
(I found my vs_enterprise.exe at C:\ProgramData\Package Cache\{a60a492e-b5eb-4218-a9e6-f38d18a7dbaf}\vs_enterprise.exe)
CD into that path, e.g.,
cd {a60a492e-b5eb-4218-a9e6-f38d18a7dbaf}
Execute the installer with the options /modify /installselectableitems Javascript, e.g.,
vs_enterprise.exe /modify /installselectableitems Javascript
In Visual Studio setup, select Modify then Update, without changing any feature selections.
Then:
cd C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
devenv /updateconfiguration
devenv /clearcache

The solution in Error adb.exe when running Visual Studio 2015 RC worked for me.
In short:
Delete this folder: C:\Users[username]\appdata\local\microsoft\VisualStudio\14.0\ComponentModelCache
Then open a new project get the folder rebuild by VS.

Related

The "GetReferenceNearestTargetFrameworkTask" task was not found

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

microsoft.service.hub error after installing Visual Studio Community edition

After re-installing Visual Studio Community edition I've been getting this error.
I get the error right after the splashscreen shows
Could not load file or assembly 'Microsoft.ServiceHub.Client'
Please open File Explorer and search this file name to verify this file is existing on your computer or not.
Meanwhile, you can have a try with the following to troubleshoot this issue:
Clear all folders and files under the folder: %LocalAppData%\Microsoft\VisualStudio\15.0_xxx\ and restart the VS 2017 to check it again.
Open cmd and navigate to the VS 2017 installation folder like C:\Program Files(x86)\Microsoft Visual Studio\2017\xxx\Common7\IDE and run the command: devenv /safemode to run it as safe mode, then check if the installed extensions caused this issue.
Re-run the VS 2017 installer as administrator and choose Repair to repair it

Visual Studio 2017 RC installation failure "product ... cannot be found"

I am trying to install Visual Studio Professional 2017 RC on Windows 10 but the installer reports:
A product matching the following parameters cannot be found:
channelId: VisualStudio.15.Release
productId: Microsoft.VisualStudio.Product.Professional
Is this fixable?
I had the same issue and the following has helped me. A clean-up and removal of vs and installation folder was not enough in my case.
Here are the steps I've taken:
uninstalled Visual Studio (and other Visual Studio installations)
run C:\Program Files (x86)\Microsoft Visual Studio\Installer\InstallCleanup.exe -full"
removed all the "C:\Program Files (x86)\Microsoft Visual Studio" folders
removed "C:\Program Data\Microsoft\Visual Studio\ folder
restarted system
In the end I think removing of Program Data location did the final trick. I had to run a repair after the successful installation to make VS Extensions work.
I previously installed VS 15 Release and removed it. I had the same issue and fixed it by removing installer folder from here: C:\Program Files (x86)\Microsoft Visual Studio\ Installer
Please follow the cleanup steps and retry your VS install
See if you have this file on your machine: "%programfiles(x86)%\Microsoft Visual Studio\Installer\resources\app\layout\InstallCleanup.exe"
If so, please launch it from an admin command prompt with a -full param:
InstallCleanup.exe -full
If not, please manually delete the "%programfiles(x86)%\Microsoft Visual Studio\Installer” folder
Relaunch the newly downloaded vs_enterprise.exe (or vs_professional.exe or vs_community.exe…)
Allow the first step to install the installer
Once the installer comes up and you can see workload choices (.net desktop and the like), close it
Go launch the same InstallCleanup.exe to clean up old build of VS
Then relaunch vs_enterprise.exe and install VS.
The problem that I had was because I had a Visual Studio 2017 layout and I wanted to make a Visual Studio 2019 layout in the same directory.
If you are creating a new offline installation layout on top of an old offline installation layout, you need to delete every file inside the layout folder (And only the layout folder not sub-directories).
This way the new (channel) information will be replaced and installation goes without errors.

Installation of the Multi-Device-Hybrid CTP failed to add anything to VS

I installed the CTP of the multi-device-hybrid apps and the new app templates didn't show up in VS. The add-in also didn't show up in the Extensions & Updates list in VS. Trying to Uninstall it claimed to work instantly, but didn't uninstall anything.
This is an odd situation and should generally not occur. It seems the VSIX file got copied over but was not installed correctly.
Here's the work around (run using an administrative command prompt):
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common \IDE\VSIXInstaller.exe" /admin /uninstall:MultiDeviceHybridApps..db151788-9b27-49db-a5e2-d25a2653eb83
This removed the broken entries for the VSIX from the previous failed attempt to install. Following this, issue another command:
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\VSIXInstaller.exe" "%localappdata\Microsoft\MultiDeviceHybridApps\Microsoft.VisualStudio.MultiDeviceHybridApps.vsix" /admin
At this point, the VSIX should be installed successfully and the templates will become available in Visual Studio.

visual studio cannot open new project

Whenever I try to create a new project in VS 2010 I get the error:
New project/item dialog could not be initialized due to error:
Exception of type 'Microsoft.VisualStudio.Dialogs.DialogInitializationException' was thrown.
And when try to open existing project visual studio 2010 restarts.
I had the same problem on my computer. After a long time searching I solved it by the following steps:
Close all instances of Visual Studio
Go to "C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE" (or whatever is your VS installation directory)
Run command devenv.exe /resetuserdata and wait until finished
Run Visual Studio
I can't find the former case. As you met an exception
Microsoft.VisualStudio.Dialogs.DialogInitializationException
I am suggesting you try the way below:
Run devenv /resetuserdata.
Delete the file:
%LOCALAPPDATA%\Microsoft\VisualStudio\11.0\ComponentModelCache
and restart Visual Studio.
Close all VS instances and try the solution mentioned here:
Launch Developer Command Prompt for VS 2017 as Administrator
Go to VS 2017 installation folder, for example: pushd C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise
gacutil -if Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.Shell.Interop.8.0.dll
Open your control panel
Change
Regional -> Formats tab -> Format: English(United States)
https://connect.microsoft.com/VisualStudio/feedback/details/727578/vs-do-not-work-with-finnish-number-format-on-w8-64-bit
It works for me :)
This problem can cause when you install an older version of Visual Studio nearby the current version. For example VS 2017 is installed on your system and you do force install of VS 2008.
I faced this problem many years ago by installing VS 2008 after VS 2010;
and today again I had this problem. Because I installed SolidWorks 2015 after VS 2017. SolidWorks had a Visual Studio 2008 inside its package that interferes my installation.
Just uninstalled VS 2008 and I'm done.
I found this to still be an issue in Visual Studio Community 2017, Microsoft released a work around that fixed my problem:
The work-around for this issue would be:
-Launch “Developer Command Prompt for VS 2017” as Administrator
-Go to VS 2017 installation folder, for example: pushd C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise
-gacutil -if Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.Shell.Interop.8.0.dll

Resources