Wix installer project build skipped in Any CPU solution - visual-studio

I'm trying to build a solution that is configured as Release | Any CPU that contains a Wix installer project which is configured for x86. Everything in the solution is built fine but Wix installer is always skipped.
It works fine building in visual studio but from the command line there are issues.
I'm calling it like so:
"C:/Program Files (x86)//Microsoft Visual Studio 10.0/Common7/IDE/devenv.com" /Rebuild "Release|Any CPU" "MySolution.sln"
And this is the error
Skipped Rebuild All: Project: Service.WixInstall, Configuration: Release x86 ----- Project not selected to build for this solution configuration

This isn't an error; It's just for your information.
Project not selected to build for this solution configuration
Open the configuration manager, select the solution configuration and solution platform. Then in the row for the project, select the project configuration and the project platform that you want built with the solution.
How to: Create and Edit Configurations
IIRC, Visual Studio Express has reduced configuration functionality. If that's a problem for you, you can edit the solution file with a text editor.

Check if the wix project build is selected with in the Configuration Manager -> Active Solution Platform -> "Any CPU".

Check this SO answer. In particular:
"WiX projects will not be built when building the 'Any CPU' platform
because Windows Installer packages are CPU-specific."
The nabble link in the SO answer is a reference to this wix-users mailing list entry and contains some useful links.

Related

Is there a way to force msbuild to only build x64?

In all of the component projects of my C# solution, "Platform target" is set x64 in Project>Properties>Build. However, the Platform property is still "Active (Any CPU") and that is the only option. In the build log, I can see that it is copying both x64 and x86 versions of some nuget packages. Two questions:
If I've specified why x64, why is it still copying x86 packages?
Is there way to eliminate "Any CPU" as a platform option and ONLY build x64?
The Platform target under Project>Properties>Build is not the right option for your build process. That option is to tell which platform the project assembly is compiled for rather than your nuget package. So, the option cannot change the build platform and your nuget package still uses the build platform to judge which version of the dll is copied into the main project output folder.
More info you can refer to this document.
Suggestion
You can use Configuration Manager under Build
You should locate your Project and then choose x64 to build your Project Platform. And if you did not have x64, you have to click New to create it.
Update 1
Your Build Configuration is in a mess. So please first enter each project Properties-->Build--> change Platform target to Any CPU to do a restore operation.
Then, enter your Configuration Manager, delete any x64 and x86 platform under Active Solution Platform and Project Platform if you have. Then, click Active Solution Platform and then create a new x64 platform.
This will set uniform platform settings for each project.
You can refer to this similar issue.

How to build projects to a common directory in a Visual Studio solution?

I have C# and C++ projects in Visual Studio's solution.
How to make them build into one common folder?
In C++ projects Output Directory is set to $(SolutionDir)$(Platform)\$(Configuration)\:
But in C# projects it just says bin\release\:
And outputs into $(ProjectDir)bin\release as it usually does in C# projects.
When in C# projects I set Output path to $(SolutionDir)$(Platform)\$(Configuration)\:
It creates folder named $(SolutionDir)$(Platform) inside its project folder:
I would like files from all of my projects to be output to $(SolutionDir)bin\$(Platform)\$(Configuration)\. So on a Debug x86 Build configuration it will be $(SolutionDir)bin\x86\Debug and on a Release x64 Configuration build it will be $(SolutionDir)bin\x64\Release.
I googled it and searched it here on Stackoverflow but I can't find a solution.
The closest thing I found is to use Build Events in C# projects and set output to $(SolutionDir)bin\$(Platform)\$(Configuration)\.
But the problem with this approach is that in C# projects the Platform is always set to Any CPU:
And appropriate target platform is set in another field called Target platform:

Does MSBuild resolve project to project references when building a solution?

MSDN docs Visual Studio Integration (MSBuild) state:
Building Solutions
Within Visual Studio, the solution file and project build ordering are
controlled by Visual Studio itself. When building a solution with
msbuild.exe on the command line, MSBuild parses the solution file and
orders the project builds. In both cases the projects are built
individually in dependency order, and project to project references
are not traversed. In contrast, when individual projects are built
with msbuild.exe, project to project references are traversed.
With my Visual Studio 2010, when building a .sln file with MSBuild from the command line, project to project references are all built, regardless whether they occur in the solution.
What did I miss here? Or are the docs plain wrong?
You are correct that msbuild.exe will sort out all project references whether or not they are part of the solution in contrast to building within Visual Studio 2010/2012/2013/2015 (and possibly later versions) where you will get a build failure if a referenced project is not part of the solution or built beforehand.
In short, yes, the documentation seems a bit off.
You can ignore the build of project to project reference by running msbuild Solution.sln /t:ProjectName /p:BuildProjectReferences=false this explain the sentence in msdn.

VS 2010: Set a conditional build option on dependant libraries based on custom solution configuration

I am using Visual Studio 2010. Let`s say I have three projects in a solution:
MainProject
DependentA
DependentB
MainProject is my start up project and DependentA and DependentB are referenced to it. The build mode is set to Debug. Then I create a custom solution configuration Test and select it.
Now Visual studio sets the build option for DependentA and DependentB to Release automatically.
What I want to accomplish is to set some condidions. For example if Test configuration is selected build the DependentA and DependentB in Debug mode. I am quite new in this area but I suppose I can set some condition in the csproj file as it is done in this question:
Visual Studio 2010 Compiling with the Debug or Release version of third party library depending on if my project is being compiled Build or Release?
Any help with some example will be greatly appreciated. Thanks!
Have you used the Build Configuration Manager to select the desired project build configurations for the Test solution configuration? It's not clear from your question whether you're looking for anything more complicated than that.

StyleCop specific config / MSBuild & Visual Studio various behaviours

Here is a problem with specific StyleCop configuration.
I've got a total of two Settings.StyleCop files in my Visual Studio .Net solution folders.
The first is placed at the folder root with chosen rules for the team.
As I want to disable some rules for a specific project, I've put another Settings.StyleCop file in the corresponding project folder.
The results are:
when launching analysis from Visual Studio IDE (Run StyleCop), the project specific file is considered and no violation occurs.
when launching analysis from StyleCopCmd (command tool) the project specific file seems to be ignored and some violations occur.
when launching analysis from MSBuild target the project specific file seems also to be ignored and some violations occur.
Did I miss something with StyleCop configuration to have different results from ?
I'm using: Windows XP StyleCop 4.3 MSBuild 3.5 SP1 MSBuild Extension Pack 3.5.0.0 StyleCopCmd 0.2.1.0
The problem seems to be the same with StyleCop 4.3.1.3 and MSBuild Extension Pack 3.5.3.0
Regards,
Olivier.

Resources