How to set Visual Studio C++ "default default" project settings - c++

How do I change the default settings (property pages) that new "Solutions" and projects start with? When I create a new project using the Application Wizard, it always has the same settings, but they are not the ones I want.
Surely the question must have been asked and answered, but I cannot find it. Maybe I do not know the right jargon.

Visual Studio allows you to generate a custom project template, allowing you to set the defaults to what makes the most sense for any given environment.
The procedure involves 2 steps:
Create a new project, and adjust the settings.
Export a template using the Export Template Wizard. Up until Visual Studio 2015, the Export Template... command was under the File menu. Starting with Visual Studio 2017, it was moved to the Project menu.
On the first page, select Project template, and continue on to the next (final) page, filling in the information as appropriate. Choose Automatically import the template into Visual Studio to have it instantly available.
Official documentation is available at How to: Create project templates.

Related

Where is the project wizard in VS 2017?

I want to create a static library which I want to use in other projects in VS2017 Community but I can't find the right way.
I tried to follow the instructions from here which is for VS2015 but when I want to create a new project I can just provide the name, solution name, location of solution and whether I want to create a directory for the solution or not and with git repository or not.
I remember a project wizard where I could deselect precompiled headers and set the output to a static library.
Did something change or am I missing a component?
Updated answer:
Create new project and under Visual C++ -> Windows Desktop there is a project template called Windows Desktop Wizard which will open the project wizard.
From VS 2017 15.3 Release notes (credits to user VTT from another question)
The Windows Console and Desktop Application templates now create the projects without displaying a wizard. There's a new Windows Desktop Wizard under the same category that displays the same options as before.

Why visual studio doesn't come with Resources template by default?

Hello I am trying to create a “.resx” file and when I went to the menu add “new item” it doesn't show me the template for create resources file as it shows in the following image. But if I go to Visual Studio 2015 it actually shows that option available. So why if it is visual studio 2017 it doesn't come with that template by default ? And I want to know what are the steps that I have to take in order to install this template.
Note: If my question is incorrectly please AND YOU ARE GOING TO GIVE ME A DISLIKE make sure to GIVE ME A FEEDBACK Thank you for reading this.
click here to see the picture
After having the same issue (I think). I found that you have to choose ".NET desktop develpment" when you install VS 2017 to get the resource template.
Search for visual studio installer in your menu and then choose modify.
Check ".NET desktop develpment" and click modify. After that you should be able to see the templates in VS 2017.
what about this one?
ResX Manager

Incorrect main method running in visual studio

I'm trying to do some tutorial C++ programs to familiarize myself with the language. I'm using Visual Studio 2010. I have a Visual Studio solution with two projects - I'll just call them projectA and projectB. Each project has a source file with its own main method. However, when I try to run the program in projectB, the program in projectA runs instead. I'm coming from an Eclipse IDE where projects separate the programs. I've some msdn articles on solutions and projects, but I haven't seen anything about being unable to have multiple source files with main methods in them. Can someone help to clarify the Visual Studio Solution/Project structure for me, please.
Right click on the project you want to run, and select Set as StartUp Project
You have to right click on the project and "Set as Startup Project" to tell Visual Studio which project you want to actually run.
I hope this is a nice simple fix: if you look at your solution and have both projects open, you should be able to right click one of them and set it as default (Set as Startup Project), (which sounds like at the moment is set to projectA).
I have highlighted the relevant option in the menu picture:
Either you can right click on the project in the Project Explorer and select Set As StartUp Project or you can use meny item Project and also select Set StartUp Project.

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.

windows form CLR application in Visual studio 2012 RC?

quick question, im just trying out VS2012 and trying to make a c++.net app but for the life of me i cant find the option anymore when making a new project.
In vs2008 it used to be under new project>visual c++> CLR>windwos form application.
Have they removed the option to make c++/CLR application in .net from vs2012? Or is it something i must download?
Although Microsoft removed the option to create a C++/CLI Windows Forms application, the template files are still installed. The only thing missing seems to be the .vsz files and a registration in the vcNET.vcdir file. I have recreated these files and put them up for download here.
Install the files and you should be able to create WinForm apps in C++/CLI again.
Well, many people have faced this problem. Here is what I follow:
Create a Visual C++ --> CLR --> CLR Empty Project (Obviously you specify the Name and the Directory).
Once it gets created, right-click on the project and select "Add --> New Item".
Under the UI tab, select "Windows Form". Name your form and click OK. This form would get added to the project.
After the form gets added, copy the following code inside the YourFormName.cpp:
using namespace System;
using namespace System::Windows::Forms;
[STAThread]
void Main(array<String^>^ args)
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Project1::MyForm myForm; //NameOfProject::NameOfForm instanceOfForm;
Application::Run(%myForm);
}
We're almost done...
Now under the Project Properties, expand the Linker section and select "System". Under the subsystem option, choose Windows(/SUBSYSTEM/WINDOWS)
Now add an entry point. Under the "Linker-->Advanced", choose "Main" as the "Entry Point"
Build and Run..Voila!!
P.S.: This is only an empty form ;)
Yes, microsoft has removed the option, here is the response from microsoft (reference):
C++/CLI is a great solution for interop, but we do not recommend
creating brand new UI applications using C++/CLI.
The workaround provided by the link is:
Create an empty C++ solution with both 2012RC and MSVC2010 Express.
Using 2010 Express, create a new WinForm App project inside the folder of the 2012RC empty solution. Close all saving.
Using 2012RC and the "add existing project", add the 2010 Express-WinForm App project into the empty 2012RC solution.
Right click on the project to convert it to 2012RC "format"
It works and it is simple! But I don’t know all the consequences.
Creating the template by yours self:
Create an empty C++ solution with both 2012RC (New Project -> Other Project Types -> Visual Studio Solutions -> Blank Solution) and MSVC2010 Express (New Project -> Visual C++ -> Empty Project).
Using 2010 Express, create a new Windows Form App project (name it “myWForm11” or so) inside the folder of the 2012RC empty solution. Close 2010 Express saving all.
Using 2012RC and the "add existing project", add the 2010 Express-WinForm App project into the empty 2012RC solution.
Right click on the solution to upgrade VC++ projects to 2012RC "format"
FILE -> Export Template ... -> Next> Type in Template name: "Windows Form App, C++ 2012RC" or so and some description too.
Finish
Close solution
Now you can create WF App in 2012RC “as always” (New Project -> Installed -> Templates -> Visual C++ -> Windows Form App, C++ 2012RC).
It works and it is simple! But I don’t know all the consequences.
I just created a new project in VS2010.
Then import it into VS2013.
You will find the form designer doesn't always work with this.
Change the source file slightly and save it.
The form designer will then wok ok until you load in the project again.