0
votes

I have a project file that should build another solution. I tried using the MSBuild task for this, like this:

<MSBuild Projects="MySolution.sln" Properties="Configuration=$(Configuration)"/>

I tried a lot of variants, like supplying hardcoded configuration, target Rebuild and so on. Building reports an error when I pass a wrong solution name, non-existing configuration or target and so on, so it definitely loads the solution and the project files. It exits relatively fast though and produces no output. According to documentation and examples, this should work though. I also tried passing an ItemGroup for the project, including project-specific properties as suggested by examples or in MSBuild - How to build a .NET solution file (in an XML task script) from pre-written command line commands , but that does not work either. It runs without error but no output.

When passing a list of project files instead (or a single project file), it builds correctly, but the problem is that dependencies between the projects are not properly resolved. At the end, I have to supply all project files in the solution and add them to the list, which is what I want to avoid.

So, why does solution building not work, even though it should? What is wrong here?

1

1 Answers

1
votes

Is this a .net project? If so you probably need to pass in a platform as well as a configuration.

<MSBuild
  Projects="MySolution.sln"
  Targets="build"
  Properties="Configuration=$(Configuration);Platform=$(Platform)" />

If the project just contains web sites and libraries then the platform should be Any CPU if your solution just contains executables then x86 or x64 or if it's a mixture of different types of platform then you can use mixed platforms

To check what are available open the solution in Visual Studio, right click on the solution in solution explorer and select "Configuration Manager" you'll then have a drop down for "Active Solution Platforms" Active Solution Platforms