I have two projects: StdLib
which is NETStandard 2.0
class library and Console.Framework
which is .NET Framework 4.6.1
project.
Console application references the class library.
I try to build the solution using Cake build.
I use DotNetBuild
method (link) and I get this output:
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 9/12/2017 2:35:55 PM.
Project "C:\Projects\NetStdExample\NetStdExample.sln" on node 1 (Build target(s)).
ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
Project "C:\Projects\NetStdExample\NetStdExample.sln" (1) is building "C:\Projects\NetStdExample\NetStdExample.StdLib\NetStdExample.StdLib.csproj" (2) on node 1 (default targets).
C:\Projects\NetStdExample\NetStdExample.StdLib\NetStdExample.StdLib.csproj(1,1): error MSB4041: The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the
MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the <Project> element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MS
Build 2003 format.
Done Building Project "C:\Projects\NetStdExample\NetStdExample.StdLib\NetStdExample.StdLib.csproj" (default targets) -- FAILED.
Is there a way how to build this kind of project using Cake
?
The DotNetBuild
alias is an older alias, which makes an informed decision about whether to build:
the specified solution using MSBuild or XBuild.
i.e. it will look at what type of machine the build is currently running on, and either run MSBuild
or XBuild
.
From the sounds of your question, this doesn't sound like what you want. Instead, I think you are after the DotNetCore Aliases:
https://www.cakebuild.net/api/Cake.Common.Tools.DotNetCore/DotNetCoreAliases/
i.e. you can do something like:
DotNetCoreBuild(BuildParameters.SolutionFilePath.FullPath);
To build the specified solution using the dotnet
cli.
It is likely that the DotNetBuild
alias will be obsoleted at some point.