How to NOT target any .NET Framework in Visual Studio 2010 for a C++ application - c++

Is it possible to create a new Win32 C++ project in VS2010 that wouldn't target a .NET Framework? Visual Studio seems to refuse to create a project unless at least one .NET Framework version is selected as a target. It also refuses to load a project if .NET is not installed on a computer, even if SLN / VCXPROJ files do not contain any .NET references. If .NET is not installed, Visual Studio still demands to select a .NET Framework version, but since no versions are available, it refuses to create a new project. But what if I want my application to have nothing to do with .NET and to run on a computer that doesn't have .NET installed? (The operating system I'm using is Windows XP, although that shouldn't make a difference).
I took the following steps:
Uninstall .NET.
In Visual Studio 2010, go to File -> New -> Project.
In the New Project window, under Installed Templates, click "Win32 Project -- Visual C++". At this point, Visual Studio begins to demand to choose a target .NET Framework version.

[tl;dr]   Visual Studio 2010 has the .NET Framework 4.0 as a prerequisite. The VS 2010 setup installs it if necessary, and the IDE will not function correctly if the .NET components are manually uninstalled afterwards. Unmanaged C++ applications can still be built outside the IDE without any .NET installed, and the resulting binaries have no runtime dependencies on .NET. Repairing the VS 2010 installation restores the .NET components, and gets the IDE to work as expected.
The following was tried on a clean XP SP3 (virtual) machine, with a fresh install of VS 2010.
The setup lists .NET 4.0 as a prerequisite, and installs it if necessary.
Manually uninstalling the .NET 4.0 components from Add Remove Programs breaks the IDE.
Repairing the installation gets the IDE working again. The New Project dialog has a top level .NET Framework version dropdown that defaults to .NET Framework 4, which applies to all project types. including the unmanaged C++ projects. However, the selection has no bearing on unmanaged projects, which do not target, use, or otherwise require .NET.

Related

Visual Studio for Mac 2019 .NET Assemblies missing

I've been writing a .NET Standard 2.1 class library project in Visual Studio for Mac 2019. However, when I was trying to add an attribute to a class, I was expecting I would be able to use quick-fix to add the reference for me. So when I was trying to do just that, it does not have the option of referencing the correct using statement. So I tried to add the assembly myself but then when I tried adding a new reference, I could only see the projects in the solution, but no .NET Assemblies. See the screenshot below.
By the way, I am running:
OSX Catalina version 10.15.3
Visual Studio for Mac 2019 Community Edition version 8.5.4 (Build 12)
.NET Standard projects do not show assemblies in the .NET Assembly tab in the References dialog.
.NET Standard projects use NuGet packages and framework targeting packs instead of the GAC so there is nothing to list in that tab.

convert Windows Forms Application in C++ to executable file

I am using VS10 C++ and try to convert Windows Forms Application project to executable file: this what I did
select project-> properties -> configuration properties -> C/C++
-> Code Generation -> Runtime library
then I select Multi-threaded Debug(/MTd)
when I built my project I got the following error
A Windows Forms application depends on classes from the .NET Framework Base Class Library. To develop a Windows desktop application in C++ that does NOT depend on .NET, you should use the project template for a Microsoft Foundation Classes (MFC) Application instead. This type of project will compile as a native .exe, instead of a .NET assembly. (By the way, not sure why you would still be using Visual Studio 2010 for C++ development, when the free VS 2015 Community Edition fully supports C++11 and many features of C++14. I do not yet recommend VS 2017 however, since it is still very buggy for C++ development.)
EDIT: In Visual Studio 2017, there is another option (which was not available in VS 2015). If you choose the Windows Desktop Application project template, you will get a project that depends on neither .NET (aka CLR support) nor MFC. I have never tried this approach, but on the surface, it looks very similar to MFC. Again, so far I have found VS 2017 for C++ to be very buggy, so you might have a better experience using MFC in VS 2015 instead.

ATL is not working when migrating to Visual Studio 2015

I have a project which uses an ATL component to create pie charts. It's working fine in Visual Studio 2010 but when I migrate it to Visual Studio 2015, its not working or not instantiated. It's crashing at runtime
I have installed VS 2015 with the C++ support on Windows 7.
I have set the platform toolset to v140.
I have installed the VS 2015 x86 redistributable package .
Target platform version 8.1.
Tried adding ATL support in existing MFC project by ATL wizard. This causes crash in ATL (_pModule == 0) and some Dlls also not registered due to this change so I had to revert the changes.
Why do you add ATL again support?
As far as I understand your question this is an existing project and has ATL support! The ASSERT simply tells you that you have two ATL modules.

Can't change Windows SDK version in Visual Studio C++ project

I have a Visual Studio C++ console application that I created with Visual Studio 2015 and now I can't compile it (with Visual Studio 2017) because it is targeting the Windows 8.1 SDK, which is not installed. The problem is that I can't retarget the project to the Windows 10 SDK.
What happens is that when I open the project properties page and go to General - Target Platform I see the Windows 10 SDK in the dropdown, and I am able to select it... but as soon as I press Apply, it reverts back to 8.1 by itself. No error message is provided.
Visual Studio installer says that, indeed, the listed SDK version is installed:
So what's going on here? Is there a way to retarget my project without having to install the Windows 8.1 SDK?
Not sure if that matters but: this project is actually just a "wrapper" around an existing bare project consisting of just a bunch of .cpp and .h files, which was developed by another person. I'm really not familiar with C++ development.
After hours of struggling with this problem, I coincidentally discovered that selecting Project Properties/General, changing "Platform Toolset" to v141_xp (instead of v141) forcibly drops the Windows SDK Version to 8.1 or 7.0. I'm not sure how Visual Studio chooses which SDK to use.
EDIT: You must edit .vcxproj and change both:
<TargetPlatformVersion>10.0.17134.0</TargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>

VS.Net 2005 required on Build box with .Net 2.0 C++ Projects?

We have a build box that uses CruiseControl.Net and has been building VB.Net and C# projects using msbuild. All I have installed on the box as far as .Net is concerned is .Net 2.0 SDK (I'm trying to keep the box as clean as possible). We are now trying to get a C++ app building on this box. The problem we are running into is that the header files (e.g. windows.h) are not installed with the SDK.
Do I have to install VS 2005 to get this to work?
Edit:
As a couple people have answered, I had actually downloaded the 3.5 Platform SDK, but the applications built on this box MUST run on boxes that do not have 3.5 installed. By installing the 3.5 SDK on my 2.0 build box, am I compromising my build box?
Edit:
I'm going to leave this as unanswered, but thought I would add that I went ahead and installed Visual Studio on the box and all is well. I hate having to do that, but didn't want to run the risk of having a 3.5 SDK on my 2.0 build box. I would still love to hear a better solution.
Visual Studio is not needed, but for C++ you need the Platform SDK as well:
http://www.microsoft.com/downloads/details.aspx?familyid=484269E2-3B89-47E3-8EB7-1F2BE6D7123A&displaylang=en
Edit: There is also one for Windows 2008/Vista, not sure which is the correct one:
http://www.microsoft.com/downloads/details.aspx?familyid=E6E1C3DF-A74F-4207-8586-711EBE331CDC&displaylang=en
No, you have to install the windows platform SDK.
You'll need to download this:
http://www.microsoft.com/downloads/details.aspx?FamilyId=E6E1C3DF-A74F-4207-8586-711EBE331CDC&displaylang=en
Edit: #Michael Stum
You need the Server 2008 / Vista / .NET 3.5 SDK version.
Depending on what you are using in C++ (MFC, ATL, etc) you are probably going to have to install Visual Studio Professional (not express) as a lot of the libraries and headers are part of Visual Studio and not included in the SDK or Visual Studio Express (if you are doing managed C++ using .Net as the main framework then installing the SDK will be enough). We run our build boxes on VM's and so like to have as little installed as possible, so I spent a fair bit of time trying to get things working by installing as little as possible and for our C++ I ended up having to install Visual Studio.
I don't see why having .NET 3.5 would comprimise the build box - 2.0 and 3.5 co-exist without a problem. The only concern I could see would be a developer upgrading a solution to VS2008 without your "permission" and the build not failing...
In general, you need some set of SDKs (Software Development Kits) to be able to build, and some set of redistributable packages to run.
In case it's not obvious, you should be testing your product on an otherwise clean machine before you ship, so you know you got the dependencies right.