windows form CLR application in Visual studio 2012 RC? - c++

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.

Related

Possible to add a Winform to a VS solution converted from a Qt project?

I converted a project from Qt to VS (by installing the Qt extension). Now I want to replace the existing Qt GUI with Microsoft Winform. When I tried to add a new item into the solution, the Winform is not available for me to choose (I did install C++/CLR Winform extension). Wonder if it's even possible to do, or I should create a VS Winform project to start with then manually adding my source code files to the solution?
Here is what I have done so far:
Installed Qt VS tool extension and C++/CLR Winform extension from my VS IDE.
Successfully opened an existing Qt project and saved it as a VS solution.
Tried to add a new item to a project and the item to be added is Winform. No Winform is available for me to add.

CCheckListBox items get overlapped on selection if app build using 'Visual Studio 2017 (v141)' Platform Toolset

Currently trying to use CCheckListBox control into a project.
The project is a simple MFC Dialog based application.
Into the dialog added List Box control with below specific property.
Owner Draw -> Fixed
Selection -> Multiple
Has String -> True
Added below variable into header using Class Wizard
CCheckListBox mCheckListBox;
Added below item into source file.
mCheckListBox.AddString(L"Item-1");
mCheckListBox.AddString(L"Item-2");
mCheckListBox.AddString(L"Item-3");
mCheckListBox.AddString(L"Item-4");
Once the app build using Platform Toolset 'Visual Studio 2012 (v110)', the app works without issues.
But if build the app using Platform Toolset 'Visual Studio 2017 (v141)', the list item gets overlapped on selection.
If there is anyone face the same, please share the solution.
It will be highly appreciated.
Note:
If there is same question available, please share the link.
It's another MFC bug.
You can circumvent this bug by adding this somewhere in the OnInitDialog method:
mCheckListBox.SetFont(GetFont());

"Manage Client-Side Libraries" menu not appearing

I'm trying to use the new Library Manager (LibMan) feature in Visual Studio 2017 (I'm using Version 15.7.1) but it is not appearing on either the project context menu or the Project menu.
I have tried various web projects but I can't see it for any of them. The only project type I haven't tried is ASP.NET Core 2.1 (I don't have the preview installed) but I can't find any docs that say it only works with ASP.NET Core 2.1
Here is a screenshot to prove it's not there:
had the same issue. I found the answer two it on another site, but for the life of me cannot find it for reference right now. The easiest thing to do is to build it yourself and install it. Works perfectly fine, I did it and now have the Manage Client Side libraries showing up.
Clone / download the Library Manager from GitHub. (https://github.com/aspnet/LibraryManager/)
Build it in Visual Studio 2017
Run the .Vsix installer
Begin to use the Manage Client Side Libraries from the context menu or project menu.
Hope this helps.
For me, in VS 2022 the context menu option appears but the dialog doesn't show. I found out that instead of right-clicking on project item i have to right-click on wwwroot item and then the dialog is shown
Even though Visual Studio Community 15.7.5 references the "Library Manager" it looks like it is still in Preview and to be released with VS 15.8.
If you would like to use the Library Manager now it is fairly easy but there are a few work arounds right now to get it to install, probably a reason it is still in Preview.
Clone or Download the source code
Note: This requires the Visual Studio extension development Workload to be installed (Tools -> Get Tools and Features under "Other Toolsets").
According to this issue on GitHub it will not install, before compiling the Extension open the project file for the LibraryManager.Vsix project
[LibraryManagerDir]\src\LibraryManager.Vsix\Microsoft.Web.LibraryManager.Vsix.csproj
and update (line #30)
<IsProductComponent>false</IsProductComponent>
After 15.8 comes out this needs to be reset back to true to be able to install it.
Open the LibraryManager.sln and make sure to change the Configuration to Release and Build the Solution.
This will create a .vsix install file:
[LibraryManagerDir]\src\LibraryManager.Vsix\bin\Release\Microsoft.Web.LibraryManager.vsix
Open Microsoft.Web.LibraryManager.vsix to launch the Visual Studio Installer.
Then you will have the Add->Client Side Library in your Context Menu.

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.

Can't find Windows Forms Application for C++

I'm really new to visual studio and programming in general. I'm using Visual Studio Community 2015 Desktop Version (from what I know).
I can't find a Windows Forms Application from the C++ category, while there is one for C#.
Can anyone help, do I need to download another version, a plugin, or anything?
Sorry if a stupid question, I just really can't figure it out!
There are no C++ Windows Form templates in Visual Studio 2015. As I see it, you have two choices:
When creating a new project, You will see an online dropdown, click that and try to search for "C++ Windows Forms".
Create an empty C++ CLR project and add a Windows Forms to it. This link puts it like this (credit to the onContentStop, the user who posted this):
Make a "CLR Empty Project".
Press Ctrl-Shift-A and create a Windows Form (under UI).
Inside the CPP file that is created, paste this code, replacing anything in square brackets except [STAThread] with the appropriate names:
#include "[FORM NAME].h"
using namespace System;
using namespace System::Windows::Forms;
[STAThread]//leave this as is
void main(array<String^>^ args) {
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Application::Run(gcnew [PROJECT NAME]::[FORM NAME]);
}
Right click your project in the Solution Explorer and click Properties.
Under Configuration Properties > Linker > Advanced, change Entry Point to "main" (without quotation marks).
Under Configuration Properties > Linker > System, change SubSystem to "Windows (/SUBSYSTEM:WINDOWS)" (without quotation marks).
Though this has already been answered, I feel like this might help those who stumble across this in the future. While creating a new project, directly above the text field for naming your project, there is a blue link that reads "Click here to go online and find templates" If you click that link it will direct you to templates that are available for you to download & use. Simply use the hierarchy on the left hand side and navigate to Visual C++ and you should be able to simply click "C++ Windows Forms" and it will create the new project, while also downloading and installing the template for future use. So, next time you go to create a C++ Winform you wont have to search for it again.
Click File-New-Project
Click online
Click/ Expand Visual C++
Click windows form application
Click C++/CLR Windows Forms fur Visual Studio 201..
Write project Name And Click OK.
Download and enjoy!!