Generating build files for different visual studio versions - visual-studio

I recently moved to VS2022 and uninstalled VS2019. However, I need to generate some build files in VS2019. When I try to do so, I get this error
CMake Error at CMakeLists.txt:2 (project):
Generator
Visual Studio 16 2019
could not find any instance of Visual Studio.
So my question is since I currently have VS2022, can I generate VS2019 build files?
Thanks

So my question is since I currently have VS2022, can I generate VS2019 build files?
No. The generator relies on finding the VS2019 MSBuild in order to work. In general, you can't generate project files for a backend that isn't installed.

Related

.netstandard2.1, AndroidQ and TFS build

I have updated my Android app target from Android 9 to Android 10 (in accordance with Google Play requirements) recently, and now solution doesn't build on TFS with error:
C:\Program Files\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5): Error NETSDK1005: Assets file '...\obj\project.assets.json' doesn't have a target for 'netstandard2.1'. Ensure that restore has run and that you have included 'netstandard2.1' in the TargetFrameworks for your project.
There is the library in the solution that really targets to netstandard2.1, but:
I can build the solution on my desktop with Visual Studio Community 2019 16.4.6.
I can build the solution on TFS server remotely with Visual Studio Community 2019 16.5.1 and 16.8.2.
I cannot build the solution on TFS server via TFS interface. In the build pipeline there is an item Build Xamarin.Android Project which uses MSBuild from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin location (I presume VS should use this MSBuild file too during manual build). The MSBuild file has version 16.8.2.56705.
With the target Android 9 there was no issues with solution building.
What could be a reason? Thank you in advance.
I followed this recommendation to update nuget.exe to the latest version and it helps. But I'm still wondering why simple target's updating without VS update broke a build.

How to add an existing cmake project to the Visual Studio Solution

I am using Visual Studio 2017 and I have a solution consisting of several projects mainly in C++. Now I want to add an existing C++ project which using CMake for building to my solution in visual studio and build it along with other projects in solution. Is it possible to do that? FYI, I can build the cmake project separately in Visual Studio.

Visual Studio 2015: How to automate cmake operations?

I'm using Visual Studio 2015 Enterprise Edition. I followed this tutorial
https://www.youtube.com/watch?v=IgvbhyDh8r0
Like Visual Studio creates a .sln file when any new project is saved and then on building it executes it to build the project, in the case of this VTK tutorial, it uses CMake to create the build file .sln for Visual studio to execute. Is there any way I can automate/replace the process of CMake using Visual Studio only?
PS- Just ignore if I have any misunderstanding of the concepts as I'm totally new to this and was not able to find proper documentation on it.
After you've generated a .sln file once, you don't need to run CMake manually again. It hooks itself into ZERO_CHECK project, so it would regenerate the solution every time you change CMakeLists.txt.
But you can't do with VS only, as you have to generate .sln for the first time.

Using the Node version of tsc with Visual Studio 2015 TypeScript Extension

I've a collection of .ts files that compile without error on Windows when running tsc v1.7.5 under node. When compiling the same files using tsc.exe v1.7.5, the compiler shows a bunch of errors in the source where there clearly are none. I think this may be a compiler bug and I am currently working to get the minimal reproduction.
But for the meantime, I'd like to see if I can get the TypeScript 1.7.6.0 Visual Studio 2015 extension to run tsc under node instead of using the tsc.exe version.
Is this possible?
I know this question is quite old and it's not really answer to your question but I had the same issue with TypeScript for VS2015 recently and found a solution. I've tried installing different versions of the TypeScript plugin from offical website: https://www.microsoft.com/en-us/download/details.aspx?id=48593 but it appears that the problem is withing the compiler, which is "bundled" with Visual Studio 2015:
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.8\tsc.exe
Updating the extension itself is not updating the compiler which is always 1.8.34 for me. It throws "tsc.exe Exited" errors when compiling in Visual Studio
I resolved the issue by running "Repair" option on the "Programs and Features -> Microsoft Visual Studio 2015". It just reinstalled Microsoft SDKs and problem went away. Hope it helps somebody

Can I use qt5 in visual studio without the add-in?

I understand I can use Qt5 in Visual Studio by using the Visual Studio Add-in for Qt as mentioned in Building Qt5 with Visual Studio 2012 / Visual Studio 2013, and integrating with the IDE.
Is it possible to use Qt5 in Visual Studio without using the Add-in?
Also, I would like to use CMake to generate the Visual Studio Project.
Yup.
I have it working for a pretty complex subdirs template.
Qmake can generate the visual studio solution file and vcxproj, look here:
http://doc.qt.io/qt-5/qmake-platform-notes.html#creating-visual-studio-project-files
What I do is use the Qmake project as the master project, and generate the VS stuff out of folder as temporaries. This prevents Visual studio from tangling up in your source files as well as in the qmake stuff. And you can also port it to other OSs without any hassle. Using this approach, if you want to add files to your project, don't do it through VS, but add it to the .PRO file and re-run qmake.
The only thing (that I've found) is if you change anything that needs to be MOC'd, then re-run qmake.
If you want CMake exclusively then this is a nice guide
http://www.kdab.com/using-cmake-with-qt-5/.
The qmake way is a little cleaner as you don't get all the extra noise of finding Qt libraries as you need in CMake.

Resources