"Manage Client-Side Libraries" menu not appearing - visual-studio-2017

I'm trying to use the new Library Manager (LibMan) feature in Visual Studio 2017 (I'm using Version 15.7.1) but it is not appearing on either the project context menu or the Project menu.
I have tried various web projects but I can't see it for any of them. The only project type I haven't tried is ASP.NET Core 2.1 (I don't have the preview installed) but I can't find any docs that say it only works with ASP.NET Core 2.1
Here is a screenshot to prove it's not there:

had the same issue. I found the answer two it on another site, but for the life of me cannot find it for reference right now. The easiest thing to do is to build it yourself and install it. Works perfectly fine, I did it and now have the Manage Client Side libraries showing up.
Clone / download the Library Manager from GitHub. (https://github.com/aspnet/LibraryManager/)
Build it in Visual Studio 2017
Run the .Vsix installer
Begin to use the Manage Client Side Libraries from the context menu or project menu.
Hope this helps.

For me, in VS 2022 the context menu option appears but the dialog doesn't show. I found out that instead of right-clicking on project item i have to right-click on wwwroot item and then the dialog is shown

Even though Visual Studio Community 15.7.5 references the "Library Manager" it looks like it is still in Preview and to be released with VS 15.8.
If you would like to use the Library Manager now it is fairly easy but there are a few work arounds right now to get it to install, probably a reason it is still in Preview.
Clone or Download the source code
Note: This requires the Visual Studio extension development Workload to be installed (Tools -> Get Tools and Features under "Other Toolsets").
According to this issue on GitHub it will not install, before compiling the Extension open the project file for the LibraryManager.Vsix project
[LibraryManagerDir]\src\LibraryManager.Vsix\Microsoft.Web.LibraryManager.Vsix.csproj
and update (line #30)
<IsProductComponent>false</IsProductComponent>
After 15.8 comes out this needs to be reset back to true to be able to install it.
Open the LibraryManager.sln and make sure to change the Configuration to Release and Build the Solution.
This will create a .vsix install file:
[LibraryManagerDir]\src\LibraryManager.Vsix\bin\Release\Microsoft.Web.LibraryManager.vsix
Open Microsoft.Web.LibraryManager.vsix to launch the Visual Studio Installer.
Then you will have the Add->Client Side Library in your Context Menu.

Related

How do I fix Visual Studio 2022 Error E1696 for WinRT

When I generate a new WinRT project in Visual Studio 2022 I get Error E1696 cannot open source file "winrt/Windows.Foundation.h" yet when I look at the Include directories the files do exist at the correct location.
This is an artifact of the way C++/WinRT works. While the header files do exist in the Windows SDK, that's not where the project goes looking for them. Instead, they are generated on the fly into the source tree under the Generated Files directory.
So to fix the issue you will have to compile a newly created project at least once. This by itself isn't sufficient for IntelliSense to pick up the changes in environment. To help IntelliSense out you're going to have to right-click into the source editor, and select Rescan -> Rescan File.
Once that is done, all the IntelliSense errors go away, including E1696.
Historic background
It's easy to get confused why the C++/WinRT header files are part of the Windows SDK, yet the C++/WinRT VSIX templates aren't using them. A look back at C++/WinRT's history helps explain how we landed in this situation:
Initially, the code generator responsible for producing the language projection header files (modern.exe, later renamed to cppwinrt.exe) wasn't published. Instead, the header files were generated by Kenny Kerr, and published through his modern repo.
Publishing the language projection header files through a GitHub repository carried over into the cppwinrt repo owned by Microsoft, and continued to be the deployment channel for several versions of Windows.
This wasn't exactly convenient for developers, so with the release of the Windows SDK for Windows 10, version 1803 (10.0.17134.0) the headers got added to the SDK (including the code generator). This worked, but wasn't an ideal situation either, as the release cycle of C++/WinRT was now tied to that of the Windows SDK, roughly 6 months.
Decoupling the release cycles was crucial in allowing C++/WinRT to progress at its own pace, shipping frequent updates with improvements and bug fixes. This was enabled by deploying the code generator as part of a NuGet package that the C++/WinRT project templates reference. The MSBuild project drives generation of the language projection headers, and clients can freely decide, which version of the C++/WinRT library they wish to use, controlled through the NuGet package reference.
This is how things work today, but the language projection headers can no longer be yanked from the Windows SDK. They were published, with clients relying on finding them there, and expecting an SDK update to not break their builds. And this is why the Windows SDK contains header files you aren't meant to be using.
Often a Build --> Clean Solution followed by a Build --> Build Solution is enough to resolve the issue. Give Visual Studio a few seconds to complete any background work.
If that fails try reinstalling the Microsoft.Windows.CppWinRT NuGet package.
Go to Tools --> NuGet Package Manager --> Manage NuGet Packages For Solution...
In the NuGet Solution pane choose the Installed option.
Tick the CheckBox next to your Project name in the Window to the right.
Click the Uninstall button
And click Ok in the Change Preview dialog box.
The CPPWinRT package will now be removed.
Change to the Browse option in the NuGet Solution pane.
Type "cppwinrt" into the Search text box of the pane.
Select the Microsoft.Windows.CppWinRt package and install it.
Finally choose the Build --> Build Solution option.
After the Build has been completed give Visual Studio a few more seconds to complete any background work and the errors should be gone.

How to properly install StyleCop for Visual Studio 2017 Community?

Well i downloaded the newest version, then installed, checked to instal entire files on local drive. I restarted Visual Studio 2017 Community and rerun it. Unfortunatelly i can't find in menu > tools anything with should be connected with stylecop ( as in tutorial "how to use stylecop"). I am using x64 Windows7. I really really don't know how to to use it.
Go to extensions and updates and search for stylecop in the online area.
Choose the one by Chris Dahlberg.
Close VS and it will install.
open your project up and make sure you have a settings.stylecop file in there.
right click on the project in the solution explorer and you will see a run stylecop option
After reading a comment from the extension creator, it appears that future development is targeted for the SytleCopAnalyzers NuGet package. Using VS 2017, this was easy to get running. Instructions here -> https://github.com/DotNetAnalyzers/StyleCopAnalyzers.

How to fix the error "Windows SDK version 8.1" was not found?

I recently updated visual studio 2015 and now, when i try to build any project it always fails and i get the error
Severity Code Description Project File Line Suppression State
Error MSB8036 The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the
project property pages or by right-clicking the solution and selecting
"Retarget solution". Proj D:\Program Files (x86)\visual studio
2017\Common7\IDE\VC\VCTargets\Platforms\Win32\PlatformToolsets\v141\Toolset.targets 34
I retargeted the solution as it said, and the problem persisted, even though the retargetting was completed.I decided to install visual studio 2017 because of this, and, lo and behold, it did the exact same thing.I'm also using windows 7.
What is the problem and how can i fix it?
I faced this problem too. Re-ran the Visual Studio 2017 Installer, go to 'Individual Components' and select Windows 8.1 SDK. Go back to to the project > Right click and Re-target to match the SDK required as shown below:
I installed the 8.1 SDK's version:
https://developer.microsoft.com/en-us/windows/downloads/sdk-archive
It used 1GB (a little more) in the installation.
Update October, 9 (2020). There's a https error: the sdksetup link is https://go.microsoft.com/fwlink/p/?LinkId=323507
"Save link as" should help.
Another way (worked for 2015) is open "Install/remove programs" (Apps & features), find Visual Studio, select Modify. In opened window, press Modify, check
Languages -> Visual C++ -> Common tools for Visual C++
Windows and web development -> Tools for universal windows apps -> Tools (1.4.1)
and Windows 10 SDK ([version])
Windows and web development -> Tools for universal windows apps -> Windows 10 SDK ([version])
and install. Then right click on solution -> Re-target and it will compile
I had win10 SDK and I only had to do retarget and then I stopped getting this error. The idea was that the project needs to upgrade its target Windows SDK.
I realize this post is a few years old, but I just wanted to extend this to anyone still struggling through this issue.
The company I work for still uses VS2015 so in turn I still use VS2015. I recently started working on a RPC application using C++ and found the need to download the Win32 Templates. Like many others I was having this "SDK 8.1 was not found" issue. i took the following corrective actions with no luck.
I found the SDK through Micrsoft at the following link
https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/ as referenced
above and downloaded it.
I located my VS2015 install in Apps & Features and ran the repair.
I completely uninstalled my VS2015 and reinstalled it.
I attempted to manually point my console app "Executable" and "Include" directories to the C:\Program Files (x86)\Microsoft SDKs\Windows Kits\8.1 and C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools.
None of the attempts above corrected the issue for me...
I then found this article on social MSDN https://social.msdn.microsoft.com/Forums/office/en-US/5287c51b-46d0-4a79-baad-ddde36af4885/visual-studio-cant-find-windows-81-sdk-when-trying-to-build-vs2015?forum=visualstudiogeneral
Finally what resolved the issue for me was:
Uninstalling and reinstalling VS2015.
Locating my installed "Windows Software Development Kit for Windows 8.1" and running the repair.
Checked my "C:\Program Files (x86)\Microsoft SDKs\Windows Kits\8.1" to verify the "DesignTime" folder was in fact there.
Opened VS created a Win32 Console application and comiled with no errors or issues
I hope this saves anyone else from almost 3 full days of frustration and loss of productivity.
Grep the folder tree's *.vcxproj files. Replace <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> with <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> or whatever SDK version you get when you update one of the projects.
For me in the Project Properties Settings General->Target Platform -> Change Windows 8.1 to Windows 10 solved the issue
Install the required version of Windows SDK or change the SDK version
in the project property pages
or
by right-clicking the solution and selecting "Retarget solution"
If you do visual studio guide, you will resolve the problem.
I encountered this issue while trying to build an npm project. It was failing to install a node-sass package and this was the error it was printing. I solved it by setting my npm proxy correctly so that it could reach the npm repo
PROBLEM: I ONLY get this compile-time "Windows SDK version 8.1 not found" error ( and a few other very-hard-to-resolve-nuisance errors -- cannot list them all ) when I export a project from an old version of MS Visual Studio (VS) to the new MS VS (2017), using the new MS VS export/"One-way Upgrade" feature.
SOLUTION: I have since learned to not use this export/upgrade feature and instead just create the new project from scratch -- using all my old source files, of course. Only my project settings have to be rebuilt, to be clear.
This is a bit of a pain, and a shame the export/upgrade feature won't work properly like it used to, but this is is actually easier and faster in the long run. MUCH better than working through a list of spurious errors that really should not have arisen in the first place.
Hope this helps...

MFC development in vs2017

When I installed vs2017, I did select Windows development with C++ option. After installation, however, I don't see the MFC has been added. Sure enough, I get errors when I compile my application,
fatal error C1083: Cannot open include file: 'afxwin.h': No such file or directory
I cannot find the Change/Modify option with my vs2017 installation in Control Panel. How can I add "Microsoft Foundation Classes for C++" package?
If you look near the top of the VS Installer window, you'll see Workloads, Individual Components and Language Packs.
At least as far as I can see, none of the "Workloads" will include MFC in your installation. To get it, you first have to click on "Individual Components", then scroll quite a ways down to get to the "SDKs, libraries and frameworks" section. In there, you'll find a list of components for ATL and MFC support:
In the VS 2019 installer, the list of possibilities has gotten even longer. There are versions for ARM, ARM64, and x86/x64 both with and without Spectre mitigations, for each of the 141 and 142 build sets:
That's not necessarily the end of the story though: by default, even when you install that, it only installs the version Unicode build of MFC. If you want the narrow-character version, you have to install that separately. I don't think there's any entry in the installer to do this at all--but if you try to build a project that uses narrow-character MFC, you'll get an error message that includes a link to download it.
In Windows 10 with Visual Studio 2017 Community Edition to modify the Visual Studio 2017 installation, I had to go into Settings from the Windows Start menu then in the search box enter "Apps & Features" to bring up the list of installed applications (just typing in "apps" was enough to bring it up in the list).
I then looked for Microsoft Visual Studio 2017 in the list of apps, clicked on that entry which then displayed the Modify button. Clicking on the Modify button will bring up the installer to allow you to modify the various components.
I have seen cases where the installer wants to do an Update of Visual Studio 2017 before allowing you to do the Modify action. Depends on the last time you used it and the last time you did an update.
So instead of a Modify button there may instead be an Update button.
Note: see also How to install (v142) Build tools in Visual studio which describes issues seen with install order when installing both VS 2017 and VS 2019.
The VS 2017 Modify dialog has three tabs, "Workloads", "Individual components", and "Language packs". Click on the "Individual components" then scroll down to the section titled "SDKs, libraries, and frameworks" which is the last section in my install. There should be an entry for "MFC and ATL support (x86 and x64)" with a checkbox near the end.
There is a lot of stuff available from this "Individual components" view of the "Modify installation" dialog.
Just to add a tip for VS 2019:
#Jerry Coffin's answer does a good job of laying out the explosion of MFC/ATL options in VS 2019. Since there are many options and each MFC pack is 1.1+GB, here is how to pick the right one.
Platform: Hopefully you know this :) but it is in project properties.
Version: For an existing project, it is found in the project properties under "Configuration Properties -> General -> Platform Toolset"
Below is a screenshot showing both (Win32=x86 in this case). In this case I needed "C++ MFC for v141 build tools (x86 & x64)":
You should use Visual Studio Installer to make changes.
To create an MFC project, you just need to select Win32 project/Win32 Console Application for your application type, and then click OK. In Application Wizard, click next, in Application Settings, check MFC under Add common header files for:.

Using Visual Studio 2012 IDE, but compile with Visual Studio 2008

Where I work, we are stuck on VS2008 and will be for quite some time as converting the projects/solutions and integrating them back into our build process would take significant time; we're planning on moving to 2013 at some point though. However, I use VS2012 at home and love a lot of the features in the IDE that are missing in 2008.
I've read that you can use 2012 as an IDE and build with the 2008 compiler, but I can't find details on how this is accomplished. Any ideas? If I open one of the masterbuild files in 2012, it inevitably asks to convert them to the 2012 format, which I really don't want to do.
Thoughts? Thanks!
Yes it is possible as can be found on the Visual Studio site. However, I believe it will only give you options of the versions you have currently installed on the machine in question.
Here are the steps as laid out in the link, provided here to ensure the information link does not get broken:
(authored and published by Microsoft)
To change the target Framework
In Visual Studio, in Solution Explorer, open the shortcut menu for your project and then choose Unload project. This unloads the project (.vcxproj) file for your project.
Note: A C++ project cannot be loaded while the project file is being modified in Visual Studio. However, you can use another editor such as Notepad to modify the project file while the project is loaded in Visual Studio. Visual Studio will detect that the project file has changed and prompt you to reload the project.
On the menu bar, select File, Open, File. In the Open File dialog box, navigate to your project folder, and then open the project (.vcxproj) file.
In the project file, locate the entry for the target Framework version. For example, if your project is designed to use the .NET Framework 4.5, locate v4.5 in the element of the element. If the element isn't present, your project doesn't use the .NET Framework and no change is required.
Change the value to the Framework version you want.
Save the changes and close the editor.
In Solution Explorer, open the shortcut menu for your project and then choose Reload Project.
In Solution Explorer, open the shortcut menu for your project and then choose Properties. In the Property Pages dialog box, in the left pane, expand Common Properties and then select Framework and References. Verify that Targeted framework shows the new Framework version.
To change the project toolset
In Visual Studio, in Solution Explorer, open the shortcut menu for your project and then choose Properties.
In the Property Pages dialog box, open the Configuration drop-down list and then select All Configurations.
In the left pane of the dialog box, expand Configuration Properties and then select General.
In the right pane, select Platform Toolset and then select the toolset you want from the drop-down list. For example, if you want to compile with the Visual Studio 2010 toolset, select Visual Studio 2010 (v100).
Choose the OK button.
Try to use CMake. It could manage out of source build. You could create a VS2012 for edit and another VS2008 based for compiling. The source will be common.
From Visual Studio 2012 Compatibility page on MSDN
Some solutions, projects, files, and other assets that you created in
Visual Studio 2010 Service Pack 1 (SP1) will run without modification
in Visual Studio 2012, but others have to be upgraded.
If your original project is 2008 then you won't be able to use it in 2012, sorry.