Visual Studio setup for C++: .NET Framework warning - c++

I have a native C++ application developed in Visual Studio 2010. There's also a setup project as a part of the solution. When the setup is being build, the warning pops up:
WARNING: The target version of the .NET Framework in the project does
not match the .NET Framework launch condition version '.NET Framework
4 Client Profile'. Update the version of the .NET Framework launch
condition to match the target version of the.NET Framework in the
Advanced Compile Options Dialog Box (VB) or the Application Page (C#,
F#).
In (c++ app) properties, there's a field in Common Properties that says:
Targeted framework: .NETFramework, Version=v4.0
which can't be edited.
Now the questions is: Why do I need .NETFramework for C++ application at all???

You can add (using a text editor) <TargetFrameworkVersion>v2.0</TargetFrameworkVersion> to the <PropertyGroup Label="Globals"> section in all of your solution's .vcxproj files, then reload the modified projects. This change causes VS to stop adding the bogus launch condition.

Related

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

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.

WiX Toolset: Creating a simple WiX project breaks in VS2017: The "CreateProjectReferenceDefineConstants" task was not found

I'm new to using Wix, and tried to make a simple installation for my App. I did the following:
Downloaded and installed the Extension for Visual Studio 2017 from here.
Download and installed WiX Toolset v3.11.1
Created a Setup Project for WiX v3
Added a reference to my App in the project, and added the block in Product.wxs:
<Component Id="ProductComponent">
<File Source="$(var.MyApplication.TargetPath)" />
</Component>
When I compile the Wix setup project, I get the following error:
The "CreateProjectReferenceDefineConstants" task was not found. Check
the following: 1.) The name of the task in the project file is the
same as the name of the task class. 2.) The task class is "public" and
implements the Microsoft.Build.Framework.ITask interface. 3.) The task
is correctly declared with in the project file, or in the
*.tasks files located in the "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin" directory.
Any ideas what went wrong? I can't find any mention of this error online. Whatis a task and what is a task class? I was expecting that doing this quick guide would be enough for a simple installer.
.NET Framework 3.5: After some debugging the solution was to install the .NET Framework 3.5.
WiX 3.x has a build-dependency requiring this version.
WiX 4.x requires .NET Core and Framework 4+.
Procedure:
Hold Windows Key and Tap R. Type: appwiz.cpl and press Enter.
Left pane, click "Turn Windows Features On / Off".
Tick / enable: ".NET Framework 3.5".
Run Windows Update (!) . If you can. To check for security updates.
On Windows 10:
Hold Windows Key and Tap R.
Type: ms-settings:windowsupdate and press Enter.
Click "Check for updates".
Now you should be able to build your WiX projects.
Or talk to tech support if you are in a managed environment. They should have a ready-made package for this .NET runtime, unless the runtime itself is prohibited from use.
Links:
Cannot build WIX project on windows 10
Hello WiX - minimal step-by-step example for writing a WiX installer in Visual Studio.
Chris Painter's samples: https://github.com/iswix-llc/iswix-tutorials
WiX Quick Start. Further links to more samples.

Unity Universal Windows App Development

I am trying to create windows store build using Visual studio 17 with Universal Windows App Development tool.
When I create a build from unity, it creates a visual studio solution but finishes with a lot of errors.
When I try to build the resulting visual studio solution, it fails to generate a build.
I am attaching related settings and build outputs screenshot in sequence that I encounter them.
My unity build settings
Unity console errors on Build complete
Vs error on opening/building VS solution output
Can anybody help with this UWA tool. I am trying this for the first time.
It is because Unity .Net version and UWP .NET are not the same. They have much in common and also some differences.
For instance, you can build and import in VS. Then you have async/await available which are not in Unity.
For your case, here's an excerpt from there : https://msdn.microsoft.com/en-us/library/mt185488.aspx
"This topic displays the types in the System.Security and
System.Security.Principal namespaces that are included in .NET for UWP
apps. Note that .NET for UWP apps does not include all the members of
each type. For information about individual types, see the linked
topics. The documentation for a type indicates which members are
included in .NET for UWP apps."

Debugging a Windows Phone 8.1 Unit test (Visual C++)

The issue is that I have created an Universal App for Windows 8.1 and Windows Phone 8.1 choosing in the wizard Visual C++ -> Store Apps -> Universal Apps -> Windows Runtime Component.
So to test its behaviour we have created a Windows Phone 8.1 Unit test project (also Visual C++) where we add as reference the Universal App project, and also in the project properties in the tab Configuration properties -> C/C++ -> General, in Additional include directories I referenced the Universal App (specifically the folder .Shared of the Universal App). Then we add also some .lib to this Unit test project through Configuration properties -> Link -> Input.
So this ok, the Unit test project find the references, and we can call methods from the Universal App even test them with assertions, and so on.
The issue is when I try to debug the Unit test code in the ARM platform (I have Nokia Lumia 920 plugged in the computer) it starts to load the microsoft symbols, etc. but finish the test without stopping or just terminate the test with an exception message (even passing the test or not).
I'm using Visual Studio Ultimate 2013 Update 2.
PS. In case of not being able to debug it due to any Microsoft and/or version issue or whatever, could I show in the console some values? Cause I also tried with std::cout, or OutputDebugString, without success.
PS2. My case reminds me to this issue descripted in this ticket but with a different version of Visual Studio and working with Windows 8.1 and WP 8.1 instead of 8 version ---> Cannot debug Windows Phone Runtime Components with Visual Studio 2012 Update 4
I fixed this issue by adding and selecting the .runsettings file as shown in this article. You can select the .runsettings file by using the guide on this page under "Customizing tests with a .runsettings file". The app I used this technique on was also a WP 8.1 RT app.
I fixed this by changing Default Processor Architecture to x64 under Test > Test Settings

How to create a C++ MSI Custom Action DLL using Visual Studio 2010?

If I want to abort an installation in a C# custom action, it will have to display an unwanted "1001 Error" message box.
To avoid this I once used a C++ project which can abort the installation without the message box.
I'm trying to create this C++ project again but the only tutorial I found on the internet
http://www.codeproject.com/Articles/1747/MSI-Custom-Action-DLL
isn't updated since 2002. How can I do the same on VS 2010?
That example is outdated. The easiest way today is to download and install Windows Installer XML (http://wix.codeplex.com). Then say File | New Project | Windows Installer | C++ Custom Action
Also of note is the C# custom action project. Your 1001 error message tells me that you are using InstallUtil / Installer Class custom actions. The C# project type in WiX is called Deployment Tools Foundation (DTF) and is far superior. Checkout the following for an explanation of how it works and appears to MSI as a C++ custom action.
Deployment Tools Foundation (DTF) Managed Custom Actions