Generate clang compilation database for a Visual Studio project - visual-studio

Visual Studio was added a lot of support for Clang.
I want to use clang-tidy.exe for a Visual-Studio project. In order to do that I need the JSON "compilation database".
Is there some way to export this database from a visual studio (2015) project?

To export the JSON compilation Database you can use the Clang Power Tools VS extension.
All you need to do is to select your VS project from Solution Explorer, open the context menu by pressing right-click on it, and then search for Clang Power Tools. In the submenu search for the Export Compilation Database option. The JSON compilation database will be automatically generated for you.
More details about this feature can be found in this article.
The extension is compatible with Visual Studio 2015, 2017 and 2019.

I've bumped into your question whilst searching for an answer to this very problem. This is what I have found so far:
SourceTrail provides a Visual Studio extension which is able to create a compilation database. See also this discussion. I have no experience with the extension, but it seems to tackle this problem.
compdb is a python script with all sorts of utilities for compilation databases. AFAIK it does not yet support visual studio, but it would be a great place to add support for this functionality.
HTH.

Related

What is background build in Qt VS tools

Relates to Error while using Qt in Visual Studio 2019
I have the same error. Unfortunately I cannot still fix it, as Qt VS Tools for VS 2015 aren't updated. But my question is not how to avoid background build.
My question: what is background build?
Oh, I believe you are running into the 32767 names for this.
Let me preface this by stating that 2015 may have been the last time I used Visual Studio or developed anything for a Microsoft platform.
Part of your answer is in this discussion.
I believe the latest (or more current) name for "background build" is "live code compilation."
This is a resource robbing, highly annoying, syntax checking thing Microsoft thought would be great. It ranks right up there with Microsoft Clippy as far as tragic ideas go.
Basically, as you type, visual studio tries to build your stuff, puts squiggles under errors and generally consumes a whole lot of resources.
If you are using that Qt plug-in to build a QMake project this can cause all kinds of hardship, especially when you have UI files that need to MOC compile and are in the designer modifying the .UI file.
Whatever version of Visual Studio I was forced to use for that project, the first thing I did was find out how to turn that off.
Qt appears to not play well with Visual Studio it seems.
Here is a more complete description if you happen to have the plug-in.
BuildOnSave is an extension for Visual Studio 2019 and 2017 that
builds the current solution as soon a file is saved, and in
combination with the the extension SaveAllTheTime, enables a live,
background build experience while you type.

What can I scrape off the Visual Studio 2015 installation package (like SQL) and still leave it functional?

What can I uninstall from this large chunk of programs without breaking Visual Studio Community 2015. I do not use any SQL services or any .NET frameworks for any sort of development, so I don't need SQL or .NET features. Unfortunately VS forced them upon me.
In fact, I only really use Visual Studio to code C/C++ and Fortran, and have no use for its other features.
In search for a solution I came across this cool preview build which would almost exactly be the solution to my predicament, but I need Intel C/C++/Fortran compiler and Intel Visual Fortran (extension for VS) compatibility to be maintained. Intel does not support non-official releases so VS Preview won't do.
Did you install the VS 2015 through the default installation or custom default? If you chose the default installation, those installed items in your first screenshot should be required for the VS 2015, it is better to keep it to make the VS work stable.
If you chose the custom installation, please have a look at the article and it lists the custom components, then you can remove them if you do not need it anymore. To remove them, you can right click the VS 2015 item under Uninstall a program list table and choose Change-Modify, then uncheck the checkbox of those components that you selected in your original custom installation, then the VS installer will auto uninstall those components. Before you try to uninstall any components, I recommend you backup your Windows OS firstly, you can find the backup method per your OS edition search here.
The .NET Framework is required and the basic component for VS, when you try to create any project types in VS, there is a default .NET Framework version like the following:

Avoiding merge problems when sharing solution between Xamarin Studio and Visual Studio

When sharing a solution between Xamarin Studio and Visual Studio, changes to solution/projects leads to unexpected results. The source text of the .sln/.project files has unexpected modifications, e.g.
UUIDs changed from lower to upper case
Reordering of lines in the .sln file
Changed "ToolsVersion"
Changed "Visual Studio" version
Other changes, like changing line break, changed "true" to "True", ...
This e.g. happens when changing the startup project, adding referenced projects, building the solution.
These changes lead to a "commit ping pong" between Xamarin Studio and Visual Studio users, and make merging harder. We experienced this problem with Xamarin Studio 5.5.4 and Visual Studio 2013 Update 4. The https://github.com/perpetual-mobile/SharingXamarinSolution repository contains examples. The http://forums.xamarin.com/discussion/comment/95851 thread also describes this issue.
How can this problem be avoided? Is it possible to prevent this from happening when using only Xamarin Studio and Visual Studio? Or do we need an additional tool (like e.g. cmake)?
One answer is to wait for version 6 of Xamarin Studio.
According to the bug report filed by Stephan Palmer, the issues raised above have been resolved in that version.
Are you seeing the same behavior if the project starts in Xamarin for Visual Studio versus Xamarin standalone versions?
The fastest workaround that comes to mind would be to use vcproj2cmake (uses Ruby)
http://sourceforge.net/projects/vcproj2cmake/
and use CMake scripting.
I highly recommend contacting Kitware and asking them for cross-compiling assistance - - they may already have a CMake script to resolve this issue since Xamarin is so popular.
kitware#kitware.com
Hope that helps,
ClaireW

Can't open a TFS build process template with Community Build Extensions in VS2012 using the dummy-project-with-refrences trick

I'm trying to open a TFS Build Process Template (DefaultTemplate.11.1.xaml) file, incorporating an activity from Community TFS Build Extensions. I'm following instractions from here, section Get the custom activities into Visual Studio. I had no problems with that back in the RC version of Visual Studio 2012 but now, after upgrading to the release version, an attempt to open the file ends up in an error:
System.Xaml.XamlException: 'The type ‘InArgument(mtbwa:BuildSettings)’ of property ‘BuildSettings’ could not be resolved.'
TFS itself doesn't seem to have any problems running builds based on this template.
I am able to open the file without the trick, but then of course the custom activities are not displayed properly.
Check this out:
http://blogs.blackmarble.co.uk/blogs/rfennell/post/2012/08/30/Type-InArgument(mtbwaBuildSettings)-of-property-BuildSettings-errors-in-TFS-2012-RTM-builds.aspx
Quote:
"if the Visual Studio class library project you were using to manage the process template editing was targeting .NET 4.5, it needed to be 4.0. Well with Visual Studio 2012 RTM this is no longer the case, in fact it is the other way around."
I don't really think this is a great answer but I don't have enough rep to comment...
Build action on the xaml file is set to None?
I had a similar issue when opening build templates in VS 2012 RTM, but I was able to open the xaml "a little," meaning that I could open it in the workflow designer, but a lot of it was just the error activity. I found some errors to the effect that I should add references which I had not needed before (neither in VS 2010 or VS 11), such as PresentationCore and PresentationFramework. I wish I remembered more detail to pass on to you on this point.

No IntelliSense for C++/CLI in Visual Studio 2010?

I just moved from Visual Studio 2008 to Visual Studio 2010 (final) and noticed one major flaw:
When I try to use AutoComplete in a C++ source file for managed C++, a small note in the footer appears:
IntelliSense for C++/CLI is not available
Uh, has IntelliSense for C++/CLI been dropped from Visual Studio 2010? Is there any way to get this back? It is rather useful...
You are correct. Unfortunately it has been dropped. You can check this opened issue on Microsoft's Connect website.
I'll just quote them for the sake of the answer:
Unfortunately in this release we had to cut the intellisense support for C++/CLI due to time constraints. If you want to get some intellisense like quick info and memberlist on the native classes you can get it by choosing no /clr support in the project properties.
About getting back intellisense, your best chances for now are using third-party tools like VA Assist for example. I've tried it with Visual Studio 2008 and its IntelliSense is a whole lot better than the default one.
It is available again in Visual Studio 2012.
If you want to get IntelliSense back, install Visual Assist X from Whole Tomato Software. Here you can get a 30-days trial to check the intellisense.
According to the Visual C++ Team Blog, C++/CLI Intellisense will be in the next version of Visual Studio, but not in a service pack for VS2010. That blog post also gives some detail as to what went wrong and led to this sad state.
I don't know if you can use this settings but it work for me. I only check the Common Language RunTime Support for the cpp files that use it. I do not check it for the whole project and I've got intellisense for all the files that don't use the CLI.
Yes! you can enable the IntelliSence, but in a tricky way. Follow these instructions:
Go to your project properties. (Right click on your project name in
Project Explorer, and select Properties. or simply Alt + Enter)
From Configuration Properties, select General
In the right-hand section, find "Common Language Runtime Support"
and change it to "No Common Language Runtime Support".
Click the OK Button.
Now the IntelliSence is working. But a problem is an error when you compile your code! (The error is: error LNK1123: failure during conversion to COFF: file invalid or corrupt)
You can simply go back to Project Properties an change Common Language Runtime Support to "Common Language Runtime Support, Old Syntax (/clr:oldSyntax)".
Good luck.
This solution is only if you don't want Common Language Runtime
It worked for me in VS2010
Go to Project Propreties > Configuration Properties > General > Common Language Runtime Support and set it to No Common Language Runtime Support.
This will work fine just after hitting Apply button.
As mentioned you could install some paid software such as "Visual Assist X from Whole Tomato Software".
or
You could use open source tools that contain intellisense*, one such tool is Qt Creator 3.3.1 (opensource). You have two options, either setup your entire project with Qt to compile using VS2010 compiler, or use Qt to link to your source files and compile with VS2010. You write your code in Qt, save, flip windows to vs2010 and compile and debug.
When changes are saved in Qt, vs2010 will automatically reload the source file in the project and you can compile.

Resources