Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DotNetPublishSettings is missing a way to set the --os option #4107

Closed
2 tasks done
sfwester opened this issue Jan 16, 2023 · 3 comments · Fixed by #4111
Closed
2 tasks done

DotNetPublishSettings is missing a way to set the --os option #4107

sfwester opened this issue Jan 16, 2023 · 3 comments · Fixed by #4111
Milestone

Comments

@sfwester
Copy link

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

Cake runner

Cake Frosting

Cake version

3.0.0

Operating system

Windows

Operating system architecture

64-Bit

CI Server

No response

What are you seeing?

Using dotnet version:

$ dotnet --version
6.0.404

when I run

$ dotnet publish --help
Description:
  Publisher for the .NET Platform

Usage:
  dotnet publish [<PROJECT | SOLUTION>...] [options]

Arguments:
  <PROJECT | SOLUTION>  The project or solution file to operate on. If a file is not specified, the command will search the current directory for one.

Options:
...
  --os <os>                            The target operating system.
...

I get an option to set the the target operating system.

However, DotNetPublishSettings.cs does not provide access to the option. (DotnetMSBuildSettings.cs does not either).

What is expected?

I should be able to set the target OS using the DotNetPublishSettings. e.g,

var publishSettings = new DotNetPublishSettings
{
    Os = "win"
};

Steps to Reproduce

var publishSettings = new DotNetPublishSettings
{
    Os = "win"
};

does not compile.

Output log

'DotNetPublishSettings' does not contain a definition for 'Os'
@Kuldeep-kd
Copy link

My question is, why is it relevant to add --os in the settings? And what are your expectations from this setting?
If you need to use particular target os for the build, you might as well run build.ps1 or build.sh accordingly.

@sfwester
Copy link
Author

Just to be sure we are are on the same page I am advocating adding the option to the DotNetPublishSettings class. The dotnet CLI already supports this option.

Specifies the target operating system (OS). This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --os linux sets the RID to linux-x64. If you use this option, don't use the -r|--runtime option. Available since .NET 6.

We use this option to output a windows executable even though we build on a unix box so I don't think calling build.ps1 will help me in this case.

However, reading the docs quoted above, it looks like I can get away with using the Runtime option in DotNetPublishSettings. May still be worth adding Os to get feature parity with the CLI.

@cake-build-bot
Copy link

🎉 This issue has been resolved in version v3.1.0 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants