Visual Studio setup project fails due to configuration issues - c++

My source is a C++ MFC project targetting x64. To build the binaries for this project, I added a setup project to my solution choosing the active configuration (x64 and Release). However, I keep getting the following errors :
ERROR: Module 'Microsoft_VC100_MFC_x64.msm' targeting 'x64' cannot be added to a package targeting 'x86'
ERROR: Module 'Microsoft_VC100_CRT_x64.msm' targeting 'x64' cannot be added to a package targeting 'x86'
To me, this indicates that my setup project is targetting x86 whereas my source is written for x64 configuration. So, I tried to explore ways to specify the configuration for the setup project to x64. However, when I go to Build/Configuration Manager, the dialog box only allows me to specify a configuration for the source projects and not for the setup project. So, I see no way to make my setup project also x64.
P.S. Under Active Solution Platform, my platform is X64.

If you select the setup project in solution explorer and then click F4 you'll see a place to set the setup projects architecture, a properties window. That's also where you set manufacturer, productname etc.

Related

Many errors in solution build after target platform update in Visual Studio

I have a solution in Visual Studio that works with a specific target platform.
I'm trying to replace the target platform, so I installed an appropriate SDK and added the new platform through the configuration manager.
When I choose the new platform as the target platform and try to build the solution, I get a lot of errors and the build does not work.
what could be the problem?
Maybe because the SDK of the first platform was built for WINCE6 and the new SDK was built for WINCE7?
Or is it something else in terms of configuration?

Visual Studio 2017 c++ - error project output 'Primary Output targeting 'AMD64' is not compatible with the project's target platform 'x86'

I'm trying to port a current working project to other computer, both are using the latest Visual Studio version and the project uses opencv library.
I've got two projects:
The project App, builds and works fine, I'm able to test it
in debug and release modes.
Setup project, to deploy the app ( which all work fine in the other
machine).
The targeting platform is x64 and the configuration manager setup is:
When I'm trying to build the Setup Project I've got the error:
ERROR: File 'Apptest.exe' of project output 'Primary Output from Apptest(Active)' targeting 'AMD64' is not compatible with the project's target platform 'x86'
If my project is clearly setup targeting 64bits, anyone knows or have any clues why I'm getting this error?
Thanks.

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.

Configuring target platform for my Visual Studio C++ project

I have a visual studio solution with three projects. I want to configure them all for x64 (as I have a X64 machine). I have created the x64 configuration as you can see in the following image.
The x64 configuration can be applied to the first and the third project. It lists in the drop-down box like shown in the following image.
The project in the center is dependent on the project on top and below it, both. But, this project alone does not show x64 in the drop down. Here is the image:
Can anyone tell me what is the problem and how to solve it...
Click on <new> and add X64 and choose to copy its settings from Win32 then change the settings that you want by yourself.
I found out my problem. I had created the configuration X64 from one of the projects. I had to delete the configuration from the other projects and create it again in the other project and only then, it allowed me to set the configuration for that project. When this deleting and re-creating the configuration was done for each project, it worked fine. If only the properties of one project did not show the configuration created in other projects, or if showing, it had allowed to set that configuration to other projects too, then the problem would not have come. I think this is a bug in visual studio.

how to build 64 bit managed c++ dll in visual studio 2010?

I've got a managed c++ dll, and it builds fine in x86 format. However, when I change the format to x64 in configuration manager, it won't recognize .Net namespaces, like System etc.
What else should I change to be able to build the 64-bit version of the app?
I'll need to be able to build the app for x64 and for x86.
When you changed your project to target x64, the settings that tell the compiler to target the .NET Framework obviously didn't get transferred over.
Check your project's properties to ensure that all of the x64 settings match with the x86 settings.
More specifically, you're looking for the "Common Language Runtime Support" property. On recent versions of Visual Studio, this should probably be set to Common Language Runtime Support, Old Syntax (/clr:oldSyntax) for Managed C++.
You would create an 'x64' configuration there is a second drop down box for 'copy settings from'. That also has to be properly set to copy setting from your other configurations.
But since you have already done that, perhaps all your assembly referenences didn't copied over to your 'x64' configuration. Have you checked in your x64 project settings to see if they are there? Open up your project settings and select:
Common Properties -> Framework and References
Then make sure you have a reference to System (At least)