Reputation: 5858
I am using nuke build for the first time.
Working through the getting started guide, I have ran the following:
dotnet tool install Nuke.GlobalTool --global
nuke :setup
This ran through a wizard which generated:
The .nuke file seems to contain a solution I selected during the build. Now I have a few solutions located under a folder that I want to build.
So I was assuming I could put them in the .nuke
file.
code/solution1/solution1.sln
code/solution2/solution2.sln
code/solution3/solution3.sln
To no avail. When I run the build.ps1, it only builds the first solution in the list.
And the only help I see about the .nuke file states "Root directory marker file; references default solution file"
Question is, using the nuke build, how can I build multiple solutions under a folder hierarchy?
Upvotes: 4
Views: 3558
Reputation: 29
This is also my usecase and I'll eagerly await the global.json file :) Since I was also wondering about multiple solution targets/etc, this is roughly what I have gathered:
The .nuke file is there for finding the injected RootDirectory (which is used by other internals afaik), and also can contain the default solution if you use the [Solution] attribute with no parameters. You can set up the combinatorial invocations as talked about by Matthias by either:
//inside of build.cs
[Solution("Test1/example1.csproj")]
readonly Solution ExampleSolution1;
[Solution("Test2/example2.csproj")]
readonly Solution ExampleSolution2;
//anywhere in any task or function -- if moved, just pass in RootDirectory
IEnumerable<Solution> solutions = new[]{
ProjectModelTasks.ParseSolution(RootDirectory / "Test1/example1.csproj"),
ProjectModelTasks.ParseSolution(RootDirectory / "Test2/example2.csproj"),
};
Upvotes: 2
Reputation: 16209
The .nuke
file is currently mainly used for the SolutionAttribute
. Eventually, it will be replaced by using global.json
. If you're building multiple solutions, I suggest creating an IEnumerable<Solution>
property and using combinatorial invocations via MSBuild or dotnet CLI.
Upvotes: 3
Reputation: 2362
I don't believe it's designed for this - instead you need to have one nuke build per solution.
Upvotes: 1