Documentation ¶
Overview ¶
The vssetup package locates installations of Microsoft Visual Studio 2017 and newer, as well as related products installed by the Visual Studio Setup engine on Microsoft Windows. You should be able to compile this package on other platforms, but using any APIs will return a "Not implemented" error.
You can enumerate launchable instances using vssetup.Instances(bool):
instances, _ := vssetup.Instances(false) for _, instance := range instances { if installationPath, err := instance.InstallationPath(); err == nil { fmt.Println("InstallationPath =", installationPath) } }
This API wraps the Setup Configuration API, which you can read more about at https://devblogs.microsoft.com/setup/documentation-available-for-the-setup-configuration-api.
These bindings for Go are *unofficial*, despite these APIs being written and maintained by the architect and one of the original developers on the Visual Studio Setup engine and Configuration APIs.
Index ¶
- func GetProperties(store PropertyStore) (map[string]interface{}, error)
- func ParseVersion(s string) (version uint64, err error)
- func ParseVersionRange(s string) (min, max uint64, err error)
- func UserPreferredLanguage() language.Tag
- type ErrorState
- type FailedPackageReference
- func (p *FailedPackageReference) Action() (string, error)
- func (p *FailedPackageReference) AffectedPackages() ([]*PackageReference, error)
- func (p *FailedPackageReference) Close() error
- func (p *FailedPackageReference) Description() (string, error)
- func (p *FailedPackageReference) Details() ([]string, error)
- func (p *FailedPackageReference) LogFilePath() (string, error)
- func (p *FailedPackageReference) ReturnCode() (string, error)
- func (p *FailedPackageReference) Signature() (string, error)
- type Instance
- func (i *Instance) CatalogInfo() (map[string]interface{}, error)
- func (i *Instance) Close() error
- func (i *Instance) Description(locale language.Tag) (string, error)
- func (i *Instance) DisplayName(locale language.Tag) (string, error)
- func (i *Instance) EnginePath() (string, error)
- func (i *Instance) ErrorState() (*ErrorState, error)
- func (i *Instance) InstallDate() (time.Time, error)
- func (i *Instance) InstallationName() (string, error)
- func (i *Instance) InstallationPath() (string, error)
- func (i *Instance) InstanceID() (string, error)
- func (i *Instance) IsComplete() (bool, error)
- func (i *Instance) IsLaunchable() (bool, error)
- func (i *Instance) IsPrerelease() (bool, error)
- func (i *Instance) IsRebootRequired() (bool, error)
- func (i *Instance) MakePath(path string) (string, error)
- func (i *Instance) Packages() ([]*PackageReference, error)
- func (i *Instance) Product() (*ProductReference, error)
- func (i *Instance) ProductPath() (string, error)
- func (i *Instance) Properties() (map[string]interface{}, error)
- func (i *Instance) State() (InstanceState, error)
- type InstanceState
- type PackageReference
- func (p *PackageReference) Branch() (string, error)
- func (p *PackageReference) Chip() (string, error)
- func (p *PackageReference) Close() error
- func (p *PackageReference) ID() (string, error)
- func (p *PackageReference) IsExtension() (bool, error)
- func (p *PackageReference) Language() (string, error)
- func (p *PackageReference) Type() (string, error)
- func (p *PackageReference) UniqueID() (string, error)
- func (p *PackageReference) Version() (string, error)
- type ProductReference
- type PropertyStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetProperties ¶ added in v0.4.0
func GetProperties(store PropertyStore) (map[string]interface{}, error)
GetProperties gets all intrinsic properties for an Instance or ErrorState.
func ParseVersion ¶ added in v0.3.0
ParseVersion parses a version string like "1.2.3.4" and returns a comparable numeric form.
func ParseVersionRange ¶ added in v0.3.0
ParseVersionRange parses a version range string like "[16.0,)" and returns comparable minimum and maximum numeric forms.
func UserPreferredLanguage ¶ added in v0.2.0
UserPreferredLanguage returns the user-preferred language name. On non-Windows system this function always returns "en".
Types ¶
type ErrorState ¶ added in v0.3.0
type ErrorState struct {
// contains filtered or unexported fields
}
ErrorState contains information about failed and skipped packages, as well as log file paths.
func (*ErrorState) Close ¶ added in v0.3.0
func (e *ErrorState) Close() error
Close releases any resources used by this Instance immediately.
func (*ErrorState) ErrorLogPath ¶ added in v0.3.0
func (e *ErrorState) ErrorLogPath() (string, error)
ErrorLogPath gets the path to the last errors log file if errors were logged.
func (*ErrorState) FailedPackages ¶ added in v0.3.0
func (e *ErrorState) FailedPackages() ([]*FailedPackageReference, error)
FailedPackages gets an array of failed package references.
func (*ErrorState) LogPath ¶ added in v0.3.0
func (e *ErrorState) LogPath() (string, error)
LogPath gets the path to the last log file.
func (*ErrorState) SkippedPackages ¶ added in v0.3.0
func (e *ErrorState) SkippedPackages() ([]*PackageReference, error)
SkippedPackages gets an array of package references that were not installed.
type FailedPackageReference ¶ added in v0.3.0
type FailedPackageReference struct { PackageReference // contains filtered or unexported fields }
FailedPackageReference describes unique attributes of a failed package.
func (*FailedPackageReference) Action ¶ added in v0.3.0
func (p *FailedPackageReference) Action() (string, error)
Action gets the attempted install action for the failed package.
func (*FailedPackageReference) AffectedPackages ¶ added in v0.3.0
func (p *FailedPackageReference) AffectedPackages() ([]*PackageReference, error)
AffectedPackages gets the list of packages that were not installed because of this package failure.
func (*FailedPackageReference) Close ¶ added in v0.3.0
func (p *FailedPackageReference) Close() error
Close releases any resources used by this FailedPackageReference immediately.
func (*FailedPackageReference) Description ¶ added in v0.3.0
func (p *FailedPackageReference) Description() (string, error)
Description gets a description of the package failure.
func (*FailedPackageReference) Details ¶ added in v0.3.0
func (p *FailedPackageReference) Details() ([]string, error)
Details gets the details of the package failure.
func (*FailedPackageReference) LogFilePath ¶ added in v0.3.0
func (p *FailedPackageReference) LogFilePath() (string, error)
LogFilePath gets the path to the failed package log file.
func (*FailedPackageReference) ReturnCode ¶ added in v0.3.0
func (p *FailedPackageReference) ReturnCode() (string, error)
ReturnCode gets the return code of the failed package.
func (*FailedPackageReference) Signature ¶ added in v0.3.0
func (p *FailedPackageReference) Signature() (string, error)
Signature gets a unique signature of the package failure for error reporting.
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
Instance contains information about a Visual Studio 2017 or newer product.
func InstanceForCurrentProcess ¶
InstanceForCurrentProcess returns an *Instance for the current process or nil if none found.
func InstanceForPath ¶
InstanceForPath returns an *Instance for the given path or nil if none found.
func Instances ¶
Instances returns an array of Instance for Visual Studio 2017 and newer products. Set parameter all to true to enumerate all instances whether launchable or not.
func (*Instance) CatalogInfo ¶ added in v0.4.0
CatalogInfo gets catalog properties for the instance.
func (*Instance) Description ¶
Description gets the localized description of the Instance. or English if the name is not localized for the given locale.
func (*Instance) DisplayName ¶
DisplayName gets the localized name of the Instance, or English if the name is not localized for the given locale.
func (*Instance) EnginePath ¶ added in v0.2.0
EnginePath gets the path to the setup engine that installed this instance.
func (*Instance) ErrorState ¶ added in v0.3.0
func (i *Instance) ErrorState() (*ErrorState, error)
ErrorState gets information about failed and skipped packages, as well as log file paths.
func (*Instance) InstallDate ¶
InstallDate gets the date the Instance was installed.
func (*Instance) InstallationName ¶
InstallationName gets the family name and version of the Instance.
func (*Instance) InstallationPath ¶
InstallationPath gets the root path where the Instance was installed.
func (*Instance) InstanceID ¶
InstanceID gets the unique, machine-specific ID for the Instance.
func (*Instance) IsComplete ¶ added in v0.2.0
IsComplete gets whether the instance has been completely installed.
func (*Instance) IsLaunchable ¶ added in v0.2.0
IsLaunchable gets whether the instance can be launched.
func (*Instance) IsPrerelease ¶ added in v0.4.0
IsPrerelease gets whether the instance is a prerelease version.
func (*Instance) IsRebootRequired ¶ added in v0.2.0
IsRebootRequired gets whether the instance requires a reboot before launching.
func (*Instance) MakePath ¶
MakePath returns the combined Instance installation path with the given child path.
func (*Instance) Packages ¶ added in v0.3.0
func (i *Instance) Packages() ([]*PackageReference, error)
func (*Instance) Product ¶ added in v0.2.0
func (i *Instance) Product() (*ProductReference, error)
Product gets a reference to the root product package.
func (*Instance) ProductPath ¶ added in v0.2.0
ProductPath gets the full path to the main executable, if defined.
func (*Instance) Properties ¶ added in v0.2.0
Properties gets a map of property names and values attached to the instance.
func (*Instance) State ¶ added in v0.2.0
func (i *Instance) State() (InstanceState, error)
State describes if the instance is complete or other combinations of InstanceState.
type InstanceState ¶ added in v0.2.0
type InstanceState uint32
const ( None InstanceState = 0 Local InstanceState = 1 Registered InstanceState = 2 NoRebootRequired InstanceState = 4 NoErrors InstanceState = 8 Complete InstanceState = 4294967295 )
type PackageReference ¶ added in v0.2.0
type PackageReference struct {
// contains filtered or unexported fields
}
PackageReference describes unique attributes of a package.
func (*PackageReference) Branch ¶ added in v0.2.0
func (p *PackageReference) Branch() (string, error)
Branch gets the package reference branch.
func (*PackageReference) Chip ¶ added in v0.2.0
func (p *PackageReference) Chip() (string, error)
Chip gets the package reference chip.
func (*PackageReference) Close ¶ added in v0.2.0
func (p *PackageReference) Close() error
Close releases any resources used by this PackageReference immediately.
func (*PackageReference) ID ¶ added in v0.2.0
func (p *PackageReference) ID() (string, error)
ID gets the package reference ID.
func (*PackageReference) IsExtension ¶ added in v0.2.0
func (p *PackageReference) IsExtension() (bool, error)
IsExtension gets whether the package reference refers to an extension package.
func (*PackageReference) Language ¶ added in v0.2.0
func (p *PackageReference) Language() (string, error)
Language gets the package reference language.
func (*PackageReference) Type ¶ added in v0.2.0
func (p *PackageReference) Type() (string, error)
Type gets the package reference type.
func (*PackageReference) UniqueID ¶ added in v0.2.0
func (p *PackageReference) UniqueID() (string, error)
UniqueID gets a unique, formatted ID for the package reference.
func (*PackageReference) Version ¶ added in v0.2.0
func (p *PackageReference) Version() (string, error)
Version gets the package reference version.
type ProductReference ¶ added in v0.4.0
type ProductReference struct { PackageReference // contains filtered or unexported fields }
ProductReference describes unique attributes of a product package.
func (*ProductReference) Close ¶ added in v0.4.0
func (p *ProductReference) Close() error
Close releases any resources used by this ProductReference immediately.
func (*ProductReference) IsInstalled ¶ added in v0.4.0
func (p *ProductReference) IsInstalled() (bool, error)
IsInstalled gets whether the product is completely installed.
func (*ProductReference) SupportsExtensions ¶ added in v0.4.0
func (p *ProductReference) SupportsExtensions() (bool, error)
SupportsExtensions gets whether the product supports custom extensions e.g., VSIX packages.
type PropertyStore ¶ added in v0.4.0
type PropertyStore interface {
// contains filtered or unexported methods
}