#681 Fails when target net-3.5 with NET SDK 3.5 installed (No VS)

0.86
closed-fixed
5
2009-01-10
2008-06-06
tomthorne
No

0.86-beta1

If you try and target the net-3.5 framework on a PC with _ONLY_
- Net Framework 3.5
- Windows Server 2008 and Net Framework 3.5 SDK
installed, you get an exception here:

System.NullReferenceException: Object reference not set to an instance of an object.

NAnt.Core.dll!NAnt.Core.FrameworkInfo.Version.get() Line 177 + 0x25 bytes C#
NAnt.Core.dll!NAnt.Core.Project.UpdateTargetFrameworkProperties() Line 1442 + 0x22 bytes C#
NAnt.Core.dll!NAnt.Core.Project.TargetFramework.set(NAnt.Core.FrameworkInfo value = {NAnt.Core.FrameworkInfo}) Line 470 + 0x7 bytes C#
NAnt.Core.dll!NAnt.Core.Tasks.PropertyTask.ExecuteTask() Line 189 + 0x38 bytes C#
NAnt.Core.dll!NAnt.Core.Task.Execute() Line 178 + 0xb bytes C#
NAnt.Core.dll!NAnt.Core.Project.InitializeProjectDocument(System.Xml.XmlDocument doc = {Document}) Line 1344 + 0xa bytes C#
NAnt.Core.dll!NAnt.Core.Project.Execute() Line 853 + 0x16 bytes C#
NAnt.Core.dll!NAnt.Core.Project.Run() Line 947 + 0x8 bytes C#
NAnt.Core.dll!NAnt.Core.ConsoleDriver.Main(string[] args = {Dimensions:[0]}) Line 194 + 0xa bytes C#

and Nant exits.

This is because the 3.5 SDK registry key has changed.

To fix, amend the Nant config file 3.5 framework configuration project node to try 2 locations for sdkInstallRoot:

<readregistry
property="sdkInstallRoot"
key="SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.1\WinSDKNetFxTools\InstallationFolder"
hive="LocalMachine"
failonerror="false" />
<readregistry
property="sdkInstallRoot"
key="SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0A\WinSDKNetFxTools\InstallationFolder"
hive="LocalMachine"
failonerror="false"
unless="${property::exists('sdkInstallRoot')}" />

Discussion

  • Gert Driesen

    Gert Driesen - 2008-06-06

    Logged In: YES
    user_id=707851
    Originator: NO

    This is gonna become impossible to manage, if MS changes the key with each release.

    I'll look into this later. Can you try using the latest nightly build to see if you still get the NullReferenceException?

    Thx!

    Gert

     
  • Paul Nasrat

    Paul Nasrat - 2008-07-28

    Logged In: YES
    user_id=105347
    Originator: NO

    Also hit this and came up with a similar patch to Nant.Console\App.config.

    Any chance this could be checked in to HEAD.

     
  • skolima

    skolima - 2008-12-18

    Had the same problem. The changed registry path seems to come from 3.5 SP1. Using the latest beta (2008-08-18) the error is not a null reference, but simply "SDK is not installed".

     
  • Gert Driesen

    Gert Driesen - 2009-01-10
    • labels: 361162 --> Framework support
    • assigned_to: nobody --> drieseng
    • status: open --> closed-fixed
     
  • Gert Driesen

    Gert Driesen - 2009-01-10

    Fixed in CVS.

     
  • Steve Wagner

    Steve Wagner - 2009-01-10

    You have to also add

    <readregistry
    property="sdkInstallRoot"
    key="SOFTWARE\Wow6432Node\Microsoft\Microsoft
    SDKs\Windows\v6.1\WinSDKNetFxTools\InstallationFolder"
    hive="LocalMachine"
    failonerror="false" />
    <readregistry
    property="sdkInstallRoot"
    key="SOFTWARE\Wow6432Node\Microsoft\Microsoft
    SDKs\Windows\v6.0A\WinSDKNetFxTools\InstallationFolder"
    hive="LocalMachine"
    failonerror="false" />

    Otherwise it will not work in 64 Bit windows.

     
  • zxed

    zxed - 2009-01-28

    Just a FYI.
    in addition to 3.5....

    "Fails when target net-2.0 with NET SDK 3.5 installed (No VS)
    0.86-beta1 "

    I am guessing this will fail for all versions since the SDK is in
    SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.1\WinSDKNetFxTools\InstallationFolder

     
  • zxed

    zxed - 2009-01-28

    Just a FYI.
    in addition to 3.5....

    "Fails when target net-2.0 with NET SDK 3.5 installed (No VS)
    0.86-beta1 "

    I am guessing this will fail for all versions since the SDK is in
    SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.1\WinSDKNetFxTools\InstallationFolder

     
  • zxed

    zxed - 2009-01-28

    and... on my reg ... for somereason its

    SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.1\WinSDKNetFxTools\InstallationFolder

    note the Windows after Microsoft SDKs and before v6.1

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks