WRL Project Template not found for Visual Studio 2013 - c++

I am trying to follow these steps on MSDN for building a WRL-based C++ WinRT component. However in step #3, I am unable to find anything related to WRL in the results:
In the Search online templates box in the upper right corner, type
WRL Class Library. When the template appears in the search results,
choose the OK button)
How can I get the WRL Project Template for Visual Studio 2013?

Update: The template on the VS Gallery has now been updated and is now available for Visual Studio 2013 as well.
It seems the WRL Project Template for Visual Studio has not yet been updated for Visual Studio 2013. There is a workaround however:
Instead of acquiring the project template from VS2013, download it through the website. WRL Class Library.
The downloaded file would be called WRLVSIXProject.vsix.
Change the file extension. Rename it to WRLVSIXProject.zip
Unzip the zip file.
Open the file extension.vsixmanifest in a text editor
In the section, insert the following line after the first line:
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="12.0" />
Save the file and close it
Zip all the contents of this folder back to a file called WRLVSIXProject.zip
Rename the file back to WRLVSIXProject.vsix
Double click on the file. It will now provide an option to install this project template for Visual Studio 2013
Install and proceed
Now when you do "File -> New Project" in VS2013, you will see an option called "WRLClassLibrary" under Visual C++ > Windows Store

Related

UWP Optional package in C++/WinRT

Visual Studio 2017 includes a project template for creating optional packages in C#. However, there is no corresponding project template for C++/WinRT. Is there any way to create the same kind of optional package using C++/WinRT in Visual Studio?
There's no separate 'Optional Code Package' visual studio template for C++\WinRT. Please see the OptionalPackageSample repository on GitHub. It creates a OptionalPackageDLL
to show how to create a project with code that can be executed from the main package. The MyMainApp project demonstrates how to load code from the OptionalPackageDLL.dll file.

Unable to add app.config file in Visual Studio 2017?

Working in Visual Studio 2017; I have added a class library in my project. Now I want to add an app.config file.
When I try to add by "Add new Item" but config file is missing from item list.
How can I do it?
You probably forgot to install workload .NET desktop development.
Go to installation, click to modify and include the workload .NET desktop development.
Check image of installation screen
Just right click your class library. Click on Add -> New Item and you should find Application Configuration file
Note:
If you have a solution without any project or all project are unloaded, you would not find the Application Configuration File
If you are missing visual studio templates,then Close all instance of Visual Studio and Open visual studio command prompt and type,
devenv /installvstemplates
Press Enter. Let the process be complete and now open visual studio. You will get all missing templates under Visual Studio installed templates.
I couldn't add app.config using the GUI tools for my web project. However, I have added the app.config file manually and the build process picked it up and used it.

How to set the default Windows kit (SDK) version?

I used to use Windows 8.1 SDK for my C++ application, and everything's working fine. Today I installed the Windows 10 SDK and I can't find a way to make it the default one.
I can hard-code the new SDK path in the Visual Studio project settings, but that is highly undesirable. I want the new kit to be used by default for every new project.
There's no environment variable for the SDK, and I can't find anything in the registry, either.
More precisely, there are Windows SDK entries in the registry, but what I need - the C++ includes and libraries - is called the Windows Kit (located in C:\Program Files (x86)\Windows Kits).
Ok, it seems not a lot of people face thist problem, but i'll still post a workaround to set default sdk version. It worked with Visual Studio 2017 Communtity.
Consider the following situation:
You've got a solution with projects you must not retarget
You had older VS installed earlier on your PC
When you open the solution, VS sets SDK version as 8.1 for some reason, while you use Windows SDK 10
When you try to build you have the following:
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".
because SDK 8.1 is not installed properly on your PC, and reinstalling it somewhy does not solve the problem.
Others on your team don't have such a problem as the projects don't have Windows SDK version explicitly defined inside *.vcxproj files.
So, obviusly, MS build system with multiple SDKs installed has some kind of confusion, and the worst part is that it results in defining corruptly installed SDK as your default.
I used the following workaround to set default windows SDK explicitly:
Go to [VS installment path]\Common7\IDE\VC\VCTargets
,example:
C:\Program Files (x86)\Microsoft Visual
Studio\2017\WDExpress\Common7\IDE\VC\VCTargets\Microsoft.Cpp.WindowsSDK.props)
Open file Microsoft.Cpp.WindowsSDK.props as an administrator
Find line
<DefaultWindowsSDKVersion Condition="'$(DefaultWindowsSDKVersion)' == ''
and '$(AppContainerApplication)' != 'true'">8.1</DefaultWindowsSDKVersion>
change 8.1 to the SDK version you're sure you have properly installed, then save the file.
In my case it was 10.0.17763.0, so the final line was
<DefaultWindowsSDKVersion Condition="'$(DefaultWindowsSDKVersion)' == ''
and '$(AppContainerApplication)' != 'true'">10.0.17763.0</DefaultWindowsSDKVersion>
Now reopen your solution and try to build it. Should work fine.
My first troubleshooting tips would be to uninstall all the Visual Studio stuff you have, then reboot. Then install the latest version of Visual Studio. Then install any other SDKs that you need via the Visual Studio installer wizard. If you require to have Visual Studio 2015 and 2019 installed, go ahead and install 2015 before you install 2019.
If you want to change the project templates, you can in fact do that. The folder for the default templates is here:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ProjectTemplates\VC\WindowsDesktop\
Let's say you want to modify the ConsoleApplication template. Create a new project, in this new project edit the Project Property "SDK version" to be 8.1. Save the project and then go to Project->Export Template. Export the template. It will be a zip file in Documents\Visual Studio 2019\My Exported Templates. Unzip it.
You will notice the .vstemplate file in this folder which is similar to the found in the directory above. You will see in the node it will reference a .vcxproj file. In this .vcxproj file you will find the property:
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
Therefore in order to modify the default templates to match the template you just exported you will need to add the necessary files and lines XML from the My Exported Templates files and overwrite the defaults in Program Files. These will probably be overwritten each time you update VS tho.
Alternatively just extract the zip file of template you exported to the folder:
ProjectTemplates\VC\WindowsDesktop\
And you will find it in your templates after you reload visual studio

Add an existing (GitHub) C++ project in Visual Studio 2013 (without solution file)

I would like to add an existing C++ GitHub project to Visual Studio. I already know how to how do I add an existing Solution to GitHub from Visual Studio 2013. Here is my procedure
In Visual Studio 2013
I go to Team explorer tab / Connect to team project / Clone
In the clone dialog I enter my https GitHub link and my local repository path
I click on Clone button
After that I don't know what to do. The problem is I don't have a solution file. I have my idea: I need to to create a new solution file, then project, then add manually each cpp file in my new solution and project. This sound so heavy I'm asking if there is a better and faster procedure. Perhaps I don't need a solution file.
Note: I already did C++ coding but I never used Visual Studio as my main C++ editor. The project I try to integrate to my Visual Studio 2013 is https://github.com/Ryochan7/antimicro
I recommend using CMake to create the solution file. A lot of C++ projects on the web will mention this in their Readme files. Alternatively, you can create a new project (which will create a solution) and copy the code into it.

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.