visual-studiopowershelldsc

Installing VS 2019 with PowerShell DSC


I'm working on creating a DSC Configuration to create a template to help with configuring and setting up machines used in our build process. I'm running into a problem with installing Visual Studio 2019 where DSC thinks the installation has finished before it actually has, and goes to check for the package only to discoverer that it isn't installed. It seems like this is because the installer quits after downloading the packages and uses another process to actually install all the stuff. If I wait until all the installer processes end on the machine and then rerun the configuration everything goes well.

I was wondering if anyone had suggestions for solving this problem. One idea I had was to write a custom resource which is the same as the Package one, but it waits to check if Set is successful until all the installer processes are done. Would there be a way to call the existing Package Get/Set/Test commands in my definition so I don't have to rewrite them all?

I have seen the Chocolatey package, but can't install it on these machines.

Current Package Resource:

        Package VS2019Install
        {
            DependsOn = '[File]VS2019Copy'
            Name = 'Visual Studio Enterprise 2019'
            Path = 'D:\Install\vs_enterprise__path_name.exe'
            Arguments = '-q --norestart --add Microsoft.VisualStudio.Workload.ManagedDesktop --includeRecommended'
            ProductId = ''
            Ensure = 'Present'
        } 

Thanks everyone.


Solution

  • Silly mistake on my part, no need to write a new resource, just use the --wait flag when installing and it won't exit until complete. Once you do that it behaves like any other install.