Cloning a GitHub repo to create a buildable Visual Studio 2017 project - c++

I know how to use Team Explorer to clone a repo from GitHub but my problem is that when I do this, I can't build and debug the resulting code (I'm using C++ and I have the C/C++ add-on for VS) the way I can if I create a project from scratch in VS (by hitting the green "play" button). This seems to be because I'm missing some of the many extra VS-specific files that are created when you I create a VS project from scratch. Can anyone help me out please?
I've searched SO and Youtube for answers but all that ever seems to be covered is clicking the cloning in Team Explorer - nobody seems to mention building and debugging once you have cloned.

A source repo is generally two things : the actual sources and their build system. You need to figure out what is the build system of the repo you're cloning (usually: GNUMake, CMake, autotools, VS project, etc.) and use it.
Some build systems (like CMake) can generate project files for various IDE like microsoft studio.

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.

Has anyone successfully modified vcvars*.bat in Visual Studio to point to a shared build tools location and been able to use MSBuild?

Our group has some simple regression machines that build different C++ code bases regularly, and they all use different versions of the Visual Studio build tools. Rather than try to install a lot of different versions of Visual Studio on the build systems, the tools are copied to a standard mounted location and used from there.
Now, the team that set this system up uses a custom build system rather than MSBuild, but I am trying to use these machines with MSBuild (which is also copied to the mounted location) to build an existing VS solution file. Does anyone know how to modify a vcvars batch file enough so that these tools being in an alternate locations will work properly without having to install anything to the build node?
Not sure what point you want to describe. And as far as I know, you can just download the msbuild open source code and then basically add your custom build tool to the msbuild code.
In this way, the generated new msbuild tool is perfectly embedded with your custom tool. This is the best solution.
Simply changing the vcvars*.bat and other related files on the msbuild folder of vs2019 is not helpful. You must start at the stage of msbuild development.
And thanks for Microsoft to open up the source code of msbuild, in fact, this is to facilitate users to embed custom tools.

"Manage Client-Side Libraries" menu not appearing

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.

Unhandled exception at 0x74E733AB (ucrtbase.dll) in OpenClaw.exe

I wanted to tinker this open source remake of the famous Claw.
Visit https://github.com/pjasicek/OpenClaw
Before I start with how I've cloned this game and tried to build it, I'm new to the open source community. I did the following things.
I cloned the repository.
Opened the project using Visual Studio 2017 Community edition and I changed the Configuration to Release and platform to Win32.
I then built the libwap solution without any errors.
Then I used CMake 3.11.0 to generate the required files for the Box2D solution and then generated it and then the Box2D build was a success.
I built the Midiproc manually and finally, I tried building the entire solution.
It threw a MSVCR120D.dll missing error and I copied all the .dlls from the game's release folder https://github.com/pjasicek/OpenClaw/releases
Now the game runs just fine when I launch it from the File explorer, but when I try to launch it from Visual Studio 2017, it throws the following error.
Check out this image:
How do I run the game from Visual Studio? Have I misconfigured the Visual Studio?
If you need any more details on what I did, please let me know.
[EDIT] I want to configure Visual Studio to be able to run the release and modify the source code so I can tinker it and try to understand how the game works internally.
I cloned the repository again and did a clean compilation of all the solutions. Turns out there was a problem when I copied/overwritten all dlls from the release build. Now, the game builds and executes fine.
Thanks for the help.

Trying to get an the pokerstove api to work

I want to mess around with pokerstove, but I'm having some issues.
"Windows
Getting boost to work under windows can be a bit of a challenge. One of the easier ways is to install precompiled librares. There is a batch of them available at sourceforge. If you're working with Visual Studio 2010, you will probably need the 32 bit libraries. boost precomplied libraries
Under windows, the cmake gui can be used to construct solution and project files for Visual Studio 2010. To do this, browse source to locate the programs directory git/pokerstove/programs. Then create a build dir for the project. At the bottom of the gui click Configure, then Generate. You may have to edit the git/pokerstove/programs/CMakeLists.txt to point cmake to your installation of boost.
Once you've done that, you should be able to select
Menu->Build->Build Solution
to build the sample program."
Those are the instructions it gives to windows users. I did most of that and tried to build solution, but I'm getting these errors. http://i.imgur.com/NknHKtk.png
I've tried moving around my boost folder with no luck.