Debugging a Windows Phone 8.1 Unit test (Visual C++) - 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

Related

Win32 Console Application missing in VS2017. How to create C++ Empty Project?

I installed the VS2017 community and I am lost: the Win32 Console Application in missing.
I don't even have template when I go to New Project and also I cannot create C++ Empty Project in VS2017.
How I can solve it?
Install all the optional tools for c++ development
then follow these steps ( Microsoft has updated its visual studio and there are some minor changes)
The new updated changed some things. Win32 Console Application is gone in the new update. Go to File -> New Project -> Visual C++ -> Windows Desktop -> Windows Desktop Wizard -> Application type: Console Application (.exe), Additional Options: Empty Project
Then have fun!
You just need to install "Visual Studio C++ core features". Don't install everything about C++. It consumes too much storage and possibly slow down your IDE.
Steps:
Open Visual Studio 2017 Installer.
Select "Individual Components" tab.
Select "Visual Studio C++ core features".
That's all.
If you are not interested in Game or Mobile C++ development you can remove your selections in "Workloads" tab to get free space in your hard drive :)

Error loading visual studio 2015 C++ project, how to debug

I have a VS 2015 C++ project on a remote directory that I want to share between 2 computers. On one computer it loads fine (it has Microsoft Visual Studio Community 2015 Version 14.0.25431.01 Update 3 Microsoft .NET Framework Version 4.6.01055) on the other computer it fails to load (it also has Microsoft Visual Studio Community 2015 Version 14.0.25431.01 Update 3 Microsoft .NET Framework
Version 4.6.01055). When it fails to load I get the (not very informative message)
TargetImager.vcxproj: The application which this project type is based on
was not found. Please try this link for further information
[The link is completely useless!]
I opened the project file in the solution (can't remember how I managed to do this) and it presents a number of warnings eg.
Severity Code Description Project File Line Suppression State
Warning The element 'PropertyGroup' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003' has invalid child element 'PlatformToolSet' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'. List of possible elements expected: 'Property, VisualStudioVersion, MinimumVisualStudioVersion, AdditionalFileItemNames, AllowUnsafeBlocks, AppConfigForCompiler, ApplicationIcon, ApplicationRevision, ApplicationVersion, AppDesignerFolder, AspNetConfiguration, AssemblyKeyContainerName, AssemblyKeyProviderName, AssemblyName, AssemblyOriginatorKeyFile, AssemblyOriginatorKeyFileType, AssemblyOriginatorKeyMode, AssemblyType, AutoGenerateBindingRedirects, AutorunEnabled, BaseAddress, BootstrapperComponentsLocation, BootstrapperComponentsUrl, BootstrapperEnabled, CharacterSet, CheckForOverflowUnderflow, CLRSupport, UseDebugLibraries, CodePage, Configuration, ConfigurationName, ConfigurationOverrideFile, CreateDesktopShortcut, CreateWebPageOnPublish, CurrentSolutionConfigurationContents, DebugSecurityZoneURL, DebugSymbols, DebugType, DefaultClientScript, DefaultHTMLPageLayout, DefaultTargetSchema, DefineConstants, DefineDebug, DefineTrace, DelaySign, DisableLangXtns, DisallowUrlActivation, CodeAnalysisAdditionalOptions, CodeAnalysisApplyLogFileXsl, .... Miscellaneous Files H:\CodeProjects\QTProjects\TargetImager\TargetImager.vcxproj 20
Here is the section of the project file XML
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<PlatformToolSet>v140</PlatformToolSet>
It doesn't like this PlatformToolSet setting for instance. I don't get it because it is a setting in the property pages on VS2015 that can be selected. I anyway changed this property clicked apply then changed it back clicked apply. It is still there in the project file as before with same error message, I also changed the setting to v140_xp just to verify that it was seeing the new property which it was.
The story is that I was working on one computer with VS 2015, then I wanted to run something on another remote computer, however by then VS 2015 was replaced with VS 2017 and I installed VS 2017 on the remote. I built the project on VS2017 but then went back to the local PC with VS2015 to do some QT stuff (QT plugin is not yet available on VS2017). This was OK but then it refused to load on the remote VS2017 PC. So I uninstalled VS2017 and replaced it with VS2015, the project still doesn't load on the remote PC with VS2015.
Maybe somehow I have a VS 2017 project that for some reason loads on one computer with VS2015 and not the other, hence the settings that VS 2015 doesn't like.
So I try to create a new QT GUI project (I installed QtVsTools extension) on the remote machine that has problems with my project file. And now I get an error (the same error also occurs with a new win32 console application)
.../TarImager.vcxproj cannot be opened because its project type (.vcxproj) is not
supported by this version of the application.
To open it please use a version of the project that supports it.
As far as I know .vcxproj has been supported since MS VS 2010
Any idea how I can debug this?
The visual studio install had become corrupted, I repaired the installation then was able to create projects again. If you get weird project loading errors, then maybe your VS install is messed up.

Compiling VS2015 project with VS2010 Compiler

Ok so I am using VS2015 and upgraded an old VC++ 2010 project to run and compile just fine with VS2015. The project is a windows form project using CLR.
I recently discovered that the project will now not run on a vista machine which until recently was what I was doing the development on. I'm guessing the main culprit is the lack of .NET 4.5 on the vista machine. So I decided to try and compile it with VS 2010 toolset and compilers to see if it would work on this machine.
I downloaded and installed all the tool chains SDK 7.1 and the 7.1 update so now when I go into the
project properties > platform toolset
I have multiple options to compile for VS 2015 v140, VS 2013 v120, SDK7.1 etc and VS 2010 v100.
The problem I have is that when attempting to compile I get the following errors.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(297,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry. TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets(62,5): error : Required file "" is missing.
A secondary problem I came across is that I switch between managed String^ and regular std::string. To do this, I am using marshalling. When selecting the VS2010 toolset, the following code generates errors.
#include <windows.h>
#include <msclr/marshal.h>
#include <msclr/marshal_cppstd.h>
using namespace msclr::interop;
This obviously has knock on effects for parts of my code where I wish to marshal strings between managed and std.
Anyone got any suggestions on how to fix either of these problems? Thanks
Ok, so just going to go ahead an post my solution for this. There is no need to use the VS2010 V100 toolset.
First, I updated the target machine to .NET 4.6. I think the latest is 4.6.2.
I then created a Setup Project for my Solution and called it 'Prog Setup'. I included "primary output" and "resource satellite DLLs" within the setup projects' 'Detected Dependencies'. The wizard was helpful in setting this up.
Next, Right Click on the Setup Project, select 'View > Launch Conditions', Right Click on .NET Framework, select 'Properties'
Now check 'version' is set to the same version as main project. In my case 4.5.2.
Finally, right click on the setup project and select 'Properties', Now select 'Configuration dropdown > Release', Click 'Prerequisites' and select .NET 4.6, VC++ 14 Runtime Libraries (x86 / x64), Windows Installer 4.5.
Ok, now from the menu bar 'Build > configuration manager', ensure both the setup project and main project are checked under the 'Build' column to ensure both projects are built.
Run the build / re-build project. Using the standard VS2015 v140 Toolset.
In the project solution folder, locate the following
VS2015 > Projects > Project Name > Prog Setup > Release
this folder contains an application titled 'Setup' and my 'Prog Setup' Windows Installer Package.
Having done all the above, I copied both packages to a USB stick and then on the target machine, ran the Application 'Setup'.
This then went and downloaded and installed the VC++ 14 Runtime Libraries on the target machine. Following this, it then automatically ran Prog Setup which installed the actual program software and voila... it now runs on the target machine.

C++ Universal Windows app only works when VS2015 project on install drive

Steps to rep:
Create a new, blank, UWP, VC++ app project (File --> New --> Project --> Visual C++ --> Windows --> Universal --> Blank App)
Store the project on D:\ (Visual Studio is installed on C:)
Hit F5 to build and run the app (I'm running in Debug, x64)
Error:
4. Now repeat the process but this time store the project on C:.
Everything works just fine.
How do I configure Visual Studio to let me run projects stored on a drive different than the drive on which VS is installed?
Specs:
Microsoft Visual Studio Enterprise 2015
Version 14.0.24720.00 Update 1
Microsoft .NET Framework
Version 4.6.01038
Windows 10 (fully patched).
As per my comment on the question, I have the same issue. I'm not sure this counts as an answer as it's a workaround, but this at least for a C# Universal project...
Go to the project properties for the app and set the Output path to a location on C drive.
e.g. C:\dev\MyTestApp\bin\x86\Debug
(for Debug build. Likewise substitute x64 for x86 for 64bit etc)
It will build and run with the output on C drive but the project remains on the other drive.
Not an ideal solution, but avoids the error.

Deploying Gstreamer 1.0 for Win32

I have successfully compiled a project with the SDK of 1.5.2. I took that application and the dlls to another machine, and it said it was not a valid Win32 application.
I compiled on a Win64 OS. Am I supposed to install Gstreamer on the other machine to run this application, or am I missing some dlls?
I have uninstalled Gstreamer from the computer I compiled it on, and ran the application with no problems, but when I run it on another machine it said not valid Win32 application.
Application compiled on Windows 7 64-bit.
Application target to run on Windows XP 32-bit.
I found out that in visual studio 2012 update 4 I need to select a few things to make it work.
Project Properties
1. Configuration Properties -> Linker -> System -> Left Windows on top under SubSystem select Console or Windows
2. Configuration Properties -> General -> Left window under Platform Toolset select "Visual Studio 2012 - Windows XP (v110_xp)"
Use Dependency-walker to check for required but missing DLL dependencies on the machine you want to deploy to.
Typically, you are missing the required C++ redistributable runtime for your specific Visual Studio version on the target machine.