Documentation
¶
Index ¶
- Constants
- Variables
- type Cli
- func (cli *Cli) Build(ctx context.Context, project string, configuration string, output string, ...) error
- func (cli *Cli) BuildContainerLocal(ctx context.Context, project, configuration, imageName string) (int, string, error)
- func (cli *Cli) CheckInstalled(ctx context.Context) error
- func (cli *Cli) GetMsBuildProperty(ctx context.Context, project string, propertyName string) (string, error)
- func (cli *Cli) GitIgnore(ctx context.Context, projectPath string, options *GitIgnoreOptions) error
- func (cli *Cli) InitializeSecret(ctx context.Context, project string) error
- func (cli *Cli) InstallUrl() string
- func (cli *Cli) IsAspireHostProject(ctx context.Context, projectPath string) (bool, error)
- func (cli *Cli) IsSingleFileAspireHost(filePath string) (bool, error)
- func (cli *Cli) Name() string
- func (cli *Cli) Publish(ctx context.Context, project string, configuration string, output string, ...) error
- func (cli *Cli) PublishAppHostManifest(ctx context.Context, hostProject string, manifestPath string, dotnetEnv string) error
- func (cli *Cli) PublishContainer(ctx context.Context, ...) (int, error)
- func (cli *Cli) Restore(ctx context.Context, project string, env []string) error
- func (cli *Cli) SetSecrets(ctx context.Context, secrets map[string]string, project string) error
- type GitIgnoreIfExistsStrategy
- type GitIgnoreOptions
Constants ¶
const ( // SingleFileAspireHostName is the required filename for single-file Aspire AppHosts SingleFileAspireHostName = "apphost.cs" // AspireSdkDirective is the SDK directive that must be present in single-file Aspire AppHosts AspireSdkDirective = "#:sdk Aspire.AppHost.Sdk" )
Constants for Aspire AppHost detection
Variables ¶
var DotNetProjectExtensions = []string{".csproj", ".fsproj", ".vbproj"}
DotNetProjectExtensions lists all valid .NET project file extensions
Functions ¶
This section is empty.
Types ¶
type Cli ¶
type Cli struct {
// contains filtered or unexported fields
}
func NewCli ¶
func NewCli(commandRunner exec.CommandRunner) *Cli
func (*Cli) BuildContainerLocal ¶
func (cli *Cli) BuildContainerLocal( ctx context.Context, project, configuration, imageName string, ) (int, string, error)
PublishContainer runs a `dotnet publish" with `/t:PublishContainer`to build and publish the container. It also gets port number by using `--getProperty:GeneratedContainerConfiguration`. For single-file apps (.cs files), it runs from the file's directory to properly resolve relative references. BuildContainerLocal runs `dotnet publish` with `/t:PublishContainer` to build a container image locally without pushing to a registry. Returns the port number and image name.
func (*Cli) GetMsBuildProperty ¶
func (cli *Cli) GetMsBuildProperty(ctx context.Context, project string, propertyName string) (string, error)
GetMsBuildProperty uses -getProperty to fetch a property after evaluation, without executing the build.
This only works for versions dotnet >= 8, MSBuild >= 17.8. On older tool versions, this will return an error.
func (*Cli) InitializeSecret ¶
func (*Cli) InstallUrl ¶
func (*Cli) IsAspireHostProject ¶
IsAspireHostProject returns true if the project at the given path has an MS Build Property named "IsAspireHost" which is set to true or has a ProjectCapability named "Aspire". For single-file apphost (apphost.cs), it validates them without running msbuild.
func (*Cli) IsSingleFileAspireHost ¶
IsSingleFileAspireHost checks if the given file is a single-file Aspire AppHost. The caller should verify the filename matches SingleFileAspireHostName before calling this function. A file-based Aspire AppHost must meet all of these conditions: 1. File name: Must be named apphost.cs (case-insensitive) - verified by caller 2. No sibling .NET project files: The directory must NOT contain .csproj, .fsproj, or .vbproj files 3. SDK Directive: Must contain the AspireSdkDirective in the file content
func (*Cli) PublishAppHostManifest ¶
func (*Cli) PublishContainer ¶
type GitIgnoreIfExistsStrategy ¶
type GitIgnoreIfExistsStrategy string
const ( // GitIgnoreIfExistsStrategySkip skips creating the .gitignore file if it already exists. This is the default behavior. GitIgnoreIfExistsStrategySkip GitIgnoreIfExistsStrategy = "skip" // GitIgnoreIfExistsStrategyOverwrite overwrites the existing .gitignore file. GitIgnoreIfExistsStrategyOverwrite GitIgnoreIfExistsStrategy = "overwrite" )
type GitIgnoreOptions ¶
type GitIgnoreOptions struct {
// IfExistsStrategy determines what to do if the .gitignore file already exists. Default is Skip.
IfExistsStrategy GitIgnoreIfExistsStrategy
}