Friday, January 25, 2013

Rolling my own .NET 4.5 SDK

All I wanted to do was get my TFS 2012 Build Server going. (Getting the core components running was quite a struggle.) I expected some initial failed builds so wasn't surprised when I was informed of the following:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets (983): The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.

Finding the .NET 4.5 SDK didn't sound too hard to do. It wasn't, and I learned that it was part of the Windows Software Development Kit (SDK) for Windows 8. I downloaded the indicated file, which was named sdksetup.exe. Its size hinted that unfortunately it wasn't a standalone installer but (ugh) a web installer. I gave the sdksetup.exe a go on the server but wasn't surprised that it failed due to lack of internet connectivity through our proxy server. My next idea was to either extract the files that I needed locally or install and then copy the files to the server, which has worked before.

I missed it the first time around, but the Windows 8 SDK had an option to download the required files for installation to a separate computer see ('.NET Framework 4.5 SDK Tools on Windows Vista and Windows Server 2008' after the jump). This is important because- and I missed this initially as well- "The installer for the Windows SDK for Windows 8 is not supported on Windows Vista and Windows 2008 Server." Well, that's pretty cool that I can create my own installer, I thought, and away I went.

Nothing too exciting initially.
I appreciated being able to deselect all of the stuff I wasn't going to need on a build server.
Ugh. More proxy issues, even locally. Shades of Mordac! I could easily download the .NET 4 redistributable though, so I was still undaunted.
Now things started to get silly. Where was I supposed to find sdk_tools4.msi? Searched Google, other folks were wondering the same thing.
Maybe I already possessed sdk_tools4.msi and didn't know it. Everything proved that theory valid. Hoorah! Now I could build my SDK installer, get the builds rolling, and move on.

It wasn't to be. After browsing to my local copy of sdk_tools4.msi and clicking Retry, the SDK builder process gracefully prematurely ended, mentioning something about 'bad payload' or the like. Sdksetup.exe revealed an important secret at this point: a log file! Mine was located at 'C:\Users\[Username]\AppData\Local\Temp\standalonesdk'. The file was thankfully extremely verbose, and I could see all of the failed web requests for various resources.


For example, when I was prompted to specify the location of netfx45_dtp.cab...
...I searched the contents of the log file for these entries:

[1F08:1CA8][2013-01-24T15:05:16]: Error 0x80070005: Failed to send request to URL: http://download.microsoft.com/download/F/1/3/[long alphanumeric string]/standalonesdk/Redistributable/4.5.50710/netfx45_dtp.cab
[1F08:1CA8][2013-01-24T15:05:16]: Error 0x80070005: Failed to connect to URL: http://download.microsoft.com/download/F/1/3/[long alphanumeric string]/standalonesdk/Redistributable/4.5.50710/netfx45_dtp.cab
[1F08:1CA8][2013-01-24T15:05:16]: Error 0x80070005: Failed to get size and time for URL: http://download.microsoft.com/download/F/1/3/[long alphanumeric string]/standalonesdk/Redistributable/4.5.50710/netfx45_dtp.cab
I then plugged the URL into a browser which then prompted me to download the file. After downloading, I then specified the location of the file in sdksetup.exe and clicked Retry. It took about 10 minutes or so to get all of the files. Not the most elegant of solutions but hopefully this wasn't something that I was going to have to do often.


Finally I was finished. But would it work?
I copied my new .NET 4.5 SDK installer- and supporting files- to my Windows Server 2008 R2 build machine.
So far so good.
Looking promising.
Done!
I then queued a build, which subsequently completed successfully.

2 comments:

  1. Thanks for the hints! I couldn't get what I needed out of the logs easily, mine was a bit interesting in that some files worked and some didn't - we do have a proxy so maybe only some were blocked for whatever reason.

    Anyhow, what I ended up doing was I opened Fiddler (http://fiddler2.com/) and whenever it got to a file it couldn't download, I would get the URL out of fiddler, download it and in the prompt that the installer shows you can specify a file location - just point it where you manually downloaded the file!

    That did the trick for me.

    ReplyDelete
    Replies
    1. How did you create your own installer, or was it just a manual process that you scripted?
      Thanks,

      Mel

      Delete