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

Add/modify functions to use the --config paramter of vs_installer #130

Open
mkr-schleupen opened this issue Jun 14, 2022 · 6 comments
Open

Comments

@mkr-schleupen
Copy link

Currently there seems no option to e.g. call vs_installer.exe modify --installPath "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional" --config "MyConfig.vsconfig".

This would be a nice addition to use the logging and error handling infrastructure of the module for applying own configurations.

@jberezanski
Copy link
Owner

How would you use this functionality in the context of Chocolatey packages? Would you install any of the existing product or workload packages (e.g. visualstudio2022enterprise or visualstudio2022-workload-manageddesktop) with the additional parameter or would you create your own package for applying your customized config?

@mkr-schleupen
Copy link
Author

We use chocolatey in combination with puppet to build developer machines. There is a base installation module for studio, and depending on the type of machine needed, we use additional modules to enrich the installation.

@jberezanski
Copy link
Owner

I think you should be able to achieve your goal by crafting a package which would call Add-VisualStudioComponent with a component id which could be applied on all of your machines, such as Microsoft.Component.MSBuild. Then you could install that package passing --installPath and --config via package parameters and they would be forwarded to the VS Installer. Or your package could overwrite the environment variable which normally holds the package parameters passed from Chocolatey ($Env:chocolateyPackageParameters) so that the package would be self-sufficient and not rely on a specific way of installing it. You could even embed the config file in the package.

@jberezanski
Copy link
Owner

A rough sketch of the install script of the hypothetical package:

if ($Env:chocolateyPackageParameters -notlike '*--config*')
{
    $configPath = Join-Path -Path $Env:ChocolateyPackageFolder -ChildPath MyConfig.vsconfig
    $Env:chocolateyPackageParameters = $Env:chocolateyPackageParameters + " --config $configPath"
}

Add-VisualStudioComponent `
    -PackageName 'mycompany-vsconfig-flavor1' `
    -Component 'Microsoft.Component.MSBuild' `
    -VisualStudioYear '2022' `
    -Preview $false `
    -ApplicableProducts @('Community', 'Professional', 'Enterprise')

@mkr-schleupen
Copy link
Author

Thank you for the ideas. I will try to go this way.

@jberezanski
Copy link
Owner

Since version 1.11.0, functions in chocolatey-visualstudio.extension support a new parameter: -DefaultParameterValues <hashtable> (example), which should provide an easier way of achieving this.

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

No branches or pull requests

2 participants