3

Working on some DSC configurations and some of the applications that I am installing require a specific version of .NET to be installed as a prerequisite. I was wondering if there was a DSC Resource for .NET version installed on the system?

Jim
  • 692
  • 7
  • 15

2 Answers2

2

No, but there is a general application resource, which could be used to install any msi (and\or test if its installed).

You could also use cchoco dsc module to use chocolatey to install specific .NET framework versión:

    cChocoInstaller installChoco {
        InstallDir = "c:\choco"
    }
    cChocoPackageInstallerSet installSomeStuff {
        Ensure    = 'Present'
        Name      = @( "dotnet4.6.2" )
        DependsOn = "[cChocoInstaller]installChoco"
    }
4c74356b41
  • 69,186
  • 6
  • 100
  • 141
  • What I am seeing is that I will be doing a number of DSC configurations in our enterprise. Instead of having a one off every time I need to specify a .NET version it would be nice to have a single resource I provide the version number and it does all the heavy lifting instead recreating the wheel each and every time. Does that make sense? Would rather avoid adding yet another tool in our environment that I will have to maintain. I admit I have not spent any time playing with Chocolatey as of yet. – Jim Jan 04 '18 at 21:36
2

Doing some searching I found someone has actually done this. Not 100% to where I want to be but most of the heavy lifting is already done. Nice work, it is written using the PowerShell v4.0 approach.

https://github.com/guitarrapc/GraniResource/tree/master/DSCResources/Grani_DotNetFramework

There is also a resource for downloading via http: https://github.com/guitarrapc/GraniResource/tree/master/DSCResources/Grani_Download

Jim
  • 692
  • 7
  • 15
  • this is more or less the same approach as the one i was advocating (msi path) and on top of that its a custom lib with last change 2 years ago. best of luck – 4c74356b41 Jan 05 '18 at 07:02
  • I also used Grani to do offline installs of .NET after unsuccessfully trying to use the built-in Package resource. The issue I ran into was that newer versions of .NET are installed as KBs aka "Updates for Microsoft Windows" (on certain OS variants at least). As far as I could tell, these updates don't have a "ProductId" which is required by the Package resource. It should be easier to automate offline .NET installs. More information here: https://stackoverflow.com/questions/40616238/unattended-install-of-net-framework-4-6-2-using-dsc – Rob Davis Jan 09 '18 at 00:48
  • @Rob I read that same article as well, missed the mention of Grani (didn't expand the comment on the chosen solution). Thanks for the link for others. I did build custom Resource (class based) referencing the work Grani did. I simplified mine by disregarding the Ensure attribute since I was only interested in ensuring the .NET version was present. I also limited behavior to 4.0 and later. Not a perfect install, but works for what I needed. – Jim Jan 09 '18 at 18:30