Why nested file extension does not work in tmLnaguage file types match in Visual Studio? - ansible

As you can see in Visual Studio Ansible Extension Project we have tmLanguage for Ansible grammar that file type match with below
<key>fileTypes</key>
<array>
<string>ansible.yaml</string>
<string>ansible</string>
</array>
But all files with ansible extension (for example Test.ansible) work correctly, but all files with ansible.yaml extension (for example Test.ansbile.yaml) do not work correctly
How can I resovle this?
I request sample in https://github.com/microsoft/VSSDK-Extensibility-Samples/issues/280#issue-1589679735

Related

Typescript Type Definition References

I have a project with multiple typescript files.
If I add a new typescript file I have to reference typings in order to compile it, VS couldn't resolve them itself. Also I have empty .ts file that doesn't require referencing typings, so I put code into it and it works.
When I found out it I kept the file and now when I need to create new .ts file, I copy that file and everything works like a charm.
So suppose in a folder I have two .ts files side by side: a copy of a magic file and a newly created one.
If I put this code in the magic file
class Test {
test: KnockoutObservable<string>;
}
it compiles. If I put the same code into another file it says
Cannot find name KnockoutObservable
What is so special about the first file?
I'm using Visual Studio 2015.
I have installed Knockout typings.
I have empty tsconfig.json file in the solution.
I don't want to reference typings using /// reference comment.
Thanks.
You need to use TSD and install appropriate ".d.ts" file, e.g. for knockout:
tsd install knockout
It downloads "knockout.d.ts" into your project and places definition into typings folder:
typings/knockout/knockout.d.ts
Then you can add corresponding reference to the top or your "ts" file. e.g.:
/// <reference path="../../typings/knockout/knockout.d.ts" />

Using $(Configuration) macro in visual studio 2012 output path

In Visual Studio 2012 I would like to direct output files according to the used configuration ether to ..\Debug\Output or to ..\Release\Output.
In Build section of the project properties I've specified
Output path: ..\$(Configuration)\Output for all configuration.
Expected result:
..\Debug\Output for Debug configuration
..\Release\Output for Release configuration
Instead:
..\$(Configuration)\Output
The macro $(Configuration) has been used verbally.
I also tried to use$(ConfigurationName) macro
Output path: ..\$(ConfigurationName)\Output
and got:
..\$(ConfigurationName)\Output
Are macros not supported for output path definition in Visual Studio 2012?

Visual Studio does not find include files, but paths are correct

For my project, I am using Visual Studio 2015. I have added to my include path the folder $(ProjectDir)Source. In details view of Include Directories, in the list below with Evaluated value, the correct path is listed. When I copy this path using #include "path/file", it finds the file. Or via Start > Run, it opens the path.
In my project I have a .cpp file which includes the file like usual:
#include <file>.
Still, I am receiving the error: Cannot open include file 'file.h' No such file or directory. Error C1083.
I copied an existing solution which had similar includes and adjusted them accordingly. It works now.

How do I compile a single source file within an MSVC project from the command line?

I'm about to start doing some benchmarking/testing of our builds, and I'd like to drive the whole thing from a command line. I am aware of DevEnv but am not convinced it can do what I want.
If I could have a single file built within a single project, I'd be happy.
Can this be done?
The magical incantation is as follows. Note that this has only been tested with VS 2010 - I have heard this is the first version of Visual Studio with this capability:
The Incantation
<msbuild> <project> <settings> <file>
Where
msbuild is a path to MSBuild.exe. Usually this should be set up for you by the VS2010 bat file so the right one will end up in your PATH, but if not I found one at C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe
project is the path to the vcxproj file within which your source file resides.
settings include the following:
/p:Configuration="Debug" // or whatever your Configuration is
/p:Platform=x64 // or x86
/t:ClCompile // to specify specifically you're looking to compile the file
file is actually another setting:
/p:SelectedFiles="path_to_file"
Notes
For <project> I had to specify a project (vcxproj) file instead of a solution (sln) file. The sln I would have used has multiple projects within it, so there would have been extra work to go that route anyhow (if it can even be done).
For the /p:Platform=x64 setting, there are several environment variables that pivot on what platform you are targeting (x64 v. x86) so make sure you set those up properly via Visual Studio's vcvarsall.bat.
Regarding path_to_file in the SelectedFiles parameter, this path must be the path as specified in the project file. If the path does not match the path used in the project file to reference the source, it doesn't seem to work.

Is there a way to extract info from vs project, eg cl.exe command line

Since I write a command line program to check cpp files, and it need lib path and include path of those cpp files.
How can I get the include and lib path info from visual studio project? Our project uses property sheets to make up those information.
It is made up from 3 distinct sources:
Tools + Options, Projects and Solutions, VC++ Directories. In turn built up from several registry keys
the settings in your .vsprops project property sheets
the settings in your .vcproj project
The first part is the hardest, you can get it by running vc\vsvarsall.bat. The .vsprops and .vcproj files are XML, easy to parse.
If you just want to find out what the command line should look like then you can get it from the buildlog.htm file, produced when building from the IDE. Or you could use vcbuild.exe on the command line to build your project from the .vcproj file. Or you could build using devenv.exe /build.
Check out the Visual Studio project files - they're typically only XML files, so you should be able to extract out whatever you need from those, really. Just a matter of understanding and parsing your XML contents in the project file, really.

Resources