Based on your screenshot of the script, the highlighted optional component is Microsoft.Net.Component.4.5.2.TargetingPack, you can insert this line at the 56th line.
--add Microsoft.Net.Component.4.5.2.TargetingPack` ;includeOptional ` # Add this line for the optional targeting pack
Based on the Visual Studio Build Tools component list for VS 2022, you will need to add the required and recommended components to your Dockerfile script.
RUN vs_installer.exe install --quiet --norestart --wait \
--add Microsoft.VisualStudio.Wcf.BuildTools.ComponentGroup \
--add Microsoft.VisualStudio.Web.BuildTools.ComponentGroup \
--add Microsoft.Net.Component.4.8.TargetingPack \
--add Microsoft.Net.ComponentGroup.4.8.DeveloperTools \
--add Microsoft.VisualStudio.Component.WebDeploy \
--add Microsoft.Net.Component.3.5.DeveloperTools \
--add Microsoft.Net.Component.4.6.2.TargetingPack \
--add Microsoft.Net.Component.4.7.1.TargetingPack \
--add Microsoft.Net.Component.4.7.TargetingPack \
--add Microsoft.Net.Component.4.8.1.SDK \
--add Microsoft.Net.Component.4.8.1.TargetingPack \
--add Microsoft.Net.ComponentGroup.4.6.2-4.7.1.DeveloperTools \
--add Microsoft.Net.ComponentGroup.4.8.DeveloperTools \
--add Microsoft.NetCore.Component.Runtime.8.0 \
--includeRecommended
Alternatively,
To ensure Microsoft.Net.Component.4.5.2.TargetingPack component is installed correctly in your Visual Studio Build Tools setup, modify your Dockerfile as follows:
RUN vs_installer.exe install --quiet --norestart --wait \
--add Microsoft.Net.Component.4.5.2.TargetingPack \
--add Microsoft.Net.Component.4.8.TargetingPack \
--add Microsoft.Net.ComponentGroup.4.8.DeveloperTools \
--add Microsoft.VisualStudio.Component.WebDeploy \
--add Microsoft.Net.Component.3.5.DeveloperTools \
--includeRecommended
Hope this helps!
Please Let me know if you have any queries. If you found the information helpful, please click "Upvote" on the post to let us know and consider accepting the answer as the token of appreciation. Thank You.