"Fossies" - the Fresh Open Source Software Archive

Member "fsharp-4.5/src/utils/reshapedmsbuild.fs" (5 Sep 2018, 46811 Bytes) of package /linux/misc/mono-sources/fsharp/fsharp-4.5.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) F# source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "reshapedmsbuild.fs": 4.1.33_vs_4.5.

    1 // Copyright (c) Microsoft Corporation.  All Rights Reserved.  See License.txt in the project root for license information.
    2 
    3 namespace Microsoft.Build.Tasks
    4 namespace Microsoft.Build.Utilities
    5 namespace Microsoft.Build.Framework
    6 namespace Microsoft.Build.BuildEngine
    7 
    8 #if FX_RESHAPED_MSBUILD
    9 
   10 namespace Microsoft.Build.Framework
   11 open System.Collections
   12 
   13 type ITaskItem =
   14     abstract member ItemSpec : string with get, set
   15     abstract member MetadataNames : ICollection with get
   16     abstract member MetadataCount : int with get
   17 
   18     abstract member GetMetadata : string -> string
   19     abstract member SetMetadata : string*string -> unit
   20     abstract member RemoveMetadata : string -> unit
   21     abstract member CopyMetadataTo : ITaskItem -> unit
   22     abstract member CloneCustomMetadata : IDictionary
   23 
   24 namespace Microsoft.Build.Utilities
   25 open Microsoft.Build.Framework
   26 open Microsoft.FSharp.Core.ReflectionAdapters
   27 open System
   28 open System.Collections
   29 open System.Reflection
   30 
   31 type TaskItem (itemSpec:string) =
   32     let assembly = Assembly.Load(new AssemblyName("Microsoft.Build.Utilities.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"))
   33     let buildUtilitiesTaskType = assembly.GetType("Microsoft.Build.Utilities.Task")
   34     let instance = Activator.CreateInstance(buildUtilitiesTaskType, [|itemSpec|])
   35 
   36     interface ITaskItem with
   37         member this.ItemSpec
   38             with get () :string = (instance.GetPropertyValue("ItemSpec") :?> string)
   39             and set (value:string) =  (instance.SetPropertyValue("ItemSpec", value)); ()
   40         member this.MetadataNames
   41             with get () :ICollection = (instance.GetPropertyValue("MetadataNames") :?> ICollection)
   42         member this.MetadataCount
   43             with get () :int = (instance.GetPropertyValue("MetadataCount") :?> int)
   44         member this.CopyMetadataTo(iTaskItem) =
   45             let m = buildUtilitiesTaskType.GetMethod("CopyMetadataTo", [| typeof<ITaskItem> |])
   46             m.Invoke(instance, [|iTaskItem :>obj|]) |> ignore
   47         member this.CloneCustomMetadata =
   48             let m = buildUtilitiesTaskType.GetMethod("CloneCustomMetadata", [||])
   49             (m.Invoke(instance,[||])) :?>IDictionary
   50         member this.GetMetadata(metadataName) =
   51             let m = buildUtilitiesTaskType.GetMethod("GetMetadata", [|typeof<string>|])
   52             (m.Invoke(instance,[|metadataName|])) :?>string
   53         member this.RemoveMetadata(metadataName) =
   54             let m = buildUtilitiesTaskType.GetMethod("RemoveMetadata", [|typeof<string>|])
   55             (m.Invoke(instance,[|metadataName|])) :?>string |>ignore
   56         member this.SetMetadata(metadataName, metadataValue) =
   57             let m = buildUtilitiesTaskType.GetMethod("SetMetadata", [|typeof<string>;typeof<string>|])
   58             (m.Invoke(instance,[|metadataName; metadataValue|])) |>ignore
   59 
   60 namespace Microsoft.FSharp.Compiler
   61 open System
   62 open System.Collections
   63 open System.Collections.Concurrent
   64 open System.IO
   65 open System.Linq
   66 open System.Runtime.Versioning
   67 open FSComp
   68 open Microsoft.Win32
   69 
   70 module internal MsBuildAdapters = 
   71 
   72     open Microsoft.FSharp.Core.ReflectionAdapters
   73 
   74     /// <summary>
   75     /// Used to specify the targeted version of the .NET Framework for some methods of ToolLocationHelper.
   76     /// </summary>
   77     type public TargetDotNetFrameworkVersion =
   78     | Version11 = 0
   79     | Version20 = 1
   80     | Version30 = 2
   81     | Version35 = 3
   82     | Version40 = 4
   83     | Version45 = 5
   84     | Version451 = 6
   85     | Version46 = 7
   86     | Version461 = 8
   87     | Version452 = 9
   88     | VersionLatest = 8  //TargetDotNetFrameworkVersion.Version461
   89 
   90     /// <summary>
   91     /// Used to specify the targeted bitness of the .NET Framework for some methods of ToolLocationHelper
   92     /// </summary>
   93     type DotNetFrameworkArchitecture =
   94     | Current = 0                                   // Indicates the .NET Framework that is currently being run under
   95     | Bitness32 = 1                                 // Indicates the 32-bit .NET Framework
   96     | Bitness64 = 2                                 // Indicates the 64-bit .NET Framework
   97 
   98 module internal ToolLocationHelper =
   99     open Microsoft.Build.Framework
  100     open Microsoft.FSharp.Core.ReflectionAdapters
  101     open System.Linq
  102     open System.Reflection
  103     open MsBuildAdapters
  104 
  105     let dotNetFrameworkIdentifier = ".NETFramework"
  106 
  107     // .net versions.
  108     let dotNetFrameworkVersion11  = Version(1, 1)
  109     let dotNetFrameworkVersion20  = Version(2, 0)
  110     let dotNetFrameworkVersion30  = Version(3, 0)
  111     let dotNetFrameworkVersion35  = Version(3, 5)
  112     let dotNetFrameworkVersion40  = Version(4, 0)
  113     let dotNetFrameworkVersion45  = Version(4, 5)
  114     let dotNetFrameworkVersion451 = Version(4, 5, 1)
  115     let dotNetFrameworkVersion452 = Version(4, 5, 2)
  116     let dotNetFrameworkVersion46  = Version(4, 6)
  117     let dotNetFrameworkVersion461  = Version(4, 6, 1)
  118 
  119     // visual studio versions.
  120     let visualStudioVersion100 = new Version(10, 0);
  121     let visualStudioVersion110 = new Version(11, 0);
  122     let visualStudioVersion120 = new Version(12, 0);
  123     let visualStudioVersion140 = new Version(14, 0);
  124     let visualStudioVersion150 = new Version(15, 0);
  125 
  126     // keep this up-to-date; always point to the latest visual studio version.
  127     let visualStudioVersionLatest = visualStudioVersion150;
  128 
  129     let dotNetFrameworkRegistryPath = "SOFTWARE\\Microsoft\\.NETFramework";
  130     let dotNetFrameworkSetupRegistryPath = "SOFTWARE\\Microsoft\\NET Framework Setup\\NDP";
  131     let dotNetFrameworkSetupRegistryInstalledName = "Install";
  132 
  133     let fullDotNetFrameworkRegistryKey = "HKEY_LOCAL_MACHINE\\" + dotNetFrameworkRegistryPath;
  134     let dotNetFrameworkAssemblyFoldersRegistryPath = dotNetFrameworkRegistryPath + "\\AssemblyFolders";
  135     let referenceAssembliesRegistryValueName = "All Assemblies In";
  136 
  137     let dotNetFrameworkSdkInstallKeyValueV11 = "SDKInstallRootv1.1";
  138     let dotNetFrameworkVersionFolderPrefixV11 = "v1.1"; // v1.1 is for Everett.
  139     let dotNetFrameworkVersionV11 = "v1.1.4322";       // full Everett version to pass to NativeMethodsShared.GetRequestedRuntimeInfo().
  140     let dotNetFrameworkRegistryKeyV11 = dotNetFrameworkSetupRegistryPath + "\\" + dotNetFrameworkVersionV11;
  141 
  142     let dotNetFrameworkSdkInstallKeyValueV20 = "SDKInstallRootv2.0";
  143     let dotNetFrameworkVersionFolderPrefixV20 = "v2.0"; // v2.0 is for Whidbey.
  144     let dotNetFrameworkVersionV20 = "v2.0.50727"; // full Whidbey version to pass to NativeMethodsShared.GetRequestedRuntimeInfo().
  145     let dotNetFrameworkRegistryKeyV20 = dotNetFrameworkSetupRegistryPath + "\\" + dotNetFrameworkVersionV20;
  146 
  147     let dotNetFrameworkVersionFolderPrefixV30 = "v3.0"; // v3.0 is for WinFx.
  148     let dotNetFrameworkVersionV30 = "v3.0"; // full WinFx version to pass to NativeMethodsShared.GetRequestedRuntimeInfo().
  149     let dotNetFrameworkAssemblyFoldersRegistryKeyV30 = dotNetFrameworkAssemblyFoldersRegistryPath + "\\" + dotNetFrameworkVersionFolderPrefixV30;
  150     let dotNetFrameworkRegistryKeyV30 = dotNetFrameworkSetupRegistryPath + "\\" + dotNetFrameworkVersionFolderPrefixV30 + "\\Setup";
  151 
  152     let fallbackDotNetFrameworkSdkRegistryInstallPath = "SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows";
  153     let fallbackDotNetFrameworkSdkInstallKeyValue = "CurrentInstallFolder";
  154 
  155     let dotNetFrameworkSdkRegistryPathForV35ToolsOnWinSDK70A = @"SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFx35Tools-x86";
  156     let fullDotNetFrameworkSdkRegistryPathForV35ToolsOnWinSDK70A = "HKEY_LOCAL_MACHINE\\" + dotNetFrameworkSdkRegistryPathForV35ToolsOnWinSDK70A;
  157 
  158     let dotNetFrameworkSdkRegistryPathForV35ToolsOnManagedToolsSDK80A = @"SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx35Tools-x86";
  159     let fullDotNetFrameworkSdkRegistryPathForV35ToolsOnManagedToolsSDK80A = "HKEY_LOCAL_MACHINE\\" + dotNetFrameworkSdkRegistryPathForV35ToolsOnManagedToolsSDK80A;
  160 
  161     let dotNetFrameworkVersionFolderPrefixV35 = "v3.5"; // v3.5 is for Orcas.
  162     let dotNetFrameworkRegistryKeyV35 = dotNetFrameworkSetupRegistryPath + "\\" + dotNetFrameworkVersionFolderPrefixV35;
  163 
  164     let fullDotNetFrameworkSdkRegistryKeyV35OnVS10 = fullDotNetFrameworkSdkRegistryPathForV35ToolsOnWinSDK70A;
  165     let fullDotNetFrameworkSdkRegistryKeyV35OnVS11 = fullDotNetFrameworkSdkRegistryPathForV35ToolsOnManagedToolsSDK80A;
  166 
  167     let dotNetFrameworkVersionFolderPrefixV40 = "v4.0";
  168     let ToolsVersionsRegistryPath = @"SOFTWARE\Microsoft\MSBuild\ToolsVersions";       // Path to the ToolsVersion definitions in the registry
  169 
  170 
  171     let programFiles = Environment.GetEnvironmentVariable("ProgramFiles")
  172 
  173     let programFiles32 =
  174         // On a 64 bit machine we always want to use the program files x86.  If we are running as a 64 bit process then this variable will be set correctly
  175         // If we are on a 32 bit machine or running as a 32 bit process then this variable will be null and the programFiles variable will be correct.
  176         let programFilesX86 = Environment.GetEnvironmentVariable("ProgramFiles(x86)")
  177         if programFilesX86 = null then 
  178             programFiles 
  179         else 
  180             programFilesX86
  181 
  182     let programFilesX64 =
  183         if String.Equals(programFiles, programFiles32) then
  184             // either we're in a 32-bit window, or we're on a 32-bit machine.  
  185             // if we're on a 32-bit machine, ProgramW6432 won't exist
  186             // if we're on a 64-bit machine, ProgramW6432 will point to the correct Program Files. 
  187             Environment.GetEnvironmentVariable("ProgramW6432");
  188         else
  189             // 64-bit window on a 64-bit machine; %ProgramFiles% points to the 64-bit 
  190             // Program Files already. 
  191             programFiles;
  192 
  193     let getArgumentException version =
  194         let _, msg = SR.toolLocationHelperUnsupportedFrameworkVersion(version.ToString())
  195         new ArgumentException(msg)
  196 
  197     let TargetDotNetFrameworkVersionToSystemVersion version =
  198         match version with
  199         | TargetDotNetFrameworkVersion.Version11 -> dotNetFrameworkVersion11
  200         | TargetDotNetFrameworkVersion.Version20 -> dotNetFrameworkVersion20
  201         | TargetDotNetFrameworkVersion.Version30 -> dotNetFrameworkVersion30
  202         | TargetDotNetFrameworkVersion.Version35 -> dotNetFrameworkVersion35
  203         | TargetDotNetFrameworkVersion.Version40 -> dotNetFrameworkVersion40
  204         | TargetDotNetFrameworkVersion.Version45 -> dotNetFrameworkVersion45
  205         | TargetDotNetFrameworkVersion.Version451 -> dotNetFrameworkVersion451
  206         | TargetDotNetFrameworkVersion.Version452 -> dotNetFrameworkVersion452
  207         | TargetDotNetFrameworkVersion.Version46 -> dotNetFrameworkVersion46
  208         | TargetDotNetFrameworkVersion.Version461 -> dotNetFrameworkVersion461
  209         | _ -> raise (getArgumentException version)
  210 
  211     let complusInstallRoot = Environment.GetEnvironmentVariable("COMPLUS_INSTALLROOT")
  212     let complusVersion = Environment.GetEnvironmentVariable("COMPLUS_VERSION")
  213 
  214     type DotNetFrameworkSpec (version, dotNetFrameworkRegistryKey, dotNetFrameworkSetupRegistryInstalledName, dotNetFrameworkVersionFolderPrefix, dotNetFrameworkSdkRegistryToolsKey, dotNetFrameworkSdkRegistryInstallationFolderName, hasMSBuild, _vsVersion) =
  215 
  216         let _HKLM = "HKEY_LOCAL_MACHINE"
  217         let _microsoftSDKsRegistryKey = @"SOFTWARE\Microsoft\Microsoft SDKs"
  218         let dotNetFrameworkFolderPrefix = dotNetFrameworkVersionFolderPrefix
  219         let frameworkName = FrameworkName(dotNetFrameworkIdentifier, version)
  220 
  221 #if !FX_NO_WIN_REGISTRY
  222         let findRegistryValueUnderKey registryBaseKeyName registryKeyName registryView =
  223          try
  224             use baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, registryView)
  225             use subKey = baseKey.OpenSubKey(registryBaseKeyName)
  226             match subKey with
  227             | null -> None
  228             | _ as x -> 
  229                 let keyValue = x.GetValue(registryKeyName)
  230                 match keyValue with
  231                 | null -> None
  232                 | _ as x -> Some (x.ToString())
  233          with _ -> None
  234 #endif
  235 
  236         let findRegistryValueUnderKey registryBaseKeyName registryKeyName =
  237 #if FX_NO_WIN_REGISTRY
  238             ignore registryBaseKeyName 
  239             ignore registryKeyName 
  240             None
  241 #else
  242             findRegistryValueUnderKey registryBaseKeyName registryKeyName RegistryView.Default
  243 #endif
  244         let CheckForFrameworkInstallation registryEntryToCheckInstall registryValueToCheckInstall =
  245             // Complus is not set we need to make sure the framework we are targeting is installed. Check the registry key before trying to find the directory.
  246             // If complus is set then we will return that directory as the framework directory, there is no need to check the registry value for the framework and it may not even be installed.
  247 
  248             if (String.IsNullOrEmpty(complusInstallRoot) && String.IsNullOrEmpty(complusVersion)) then
  249 
  250                 // If the registry entry is 1 then the framework is installed. Go ahead and find the directory. If it is not 1 then the framework is not installed, return null
  251 
  252                 match findRegistryValueUnderKey registryEntryToCheckInstall registryValueToCheckInstall with
  253                 | None -> false
  254                 | Some x -> if String.Compare("1", x, StringComparison.OrdinalIgnoreCase) = 0 then true else false
  255 
  256             else true
  257 
  258         let PickDirectoryFromInstallRoot prefix (installRoot:string)  arch =
  259             let searchPattern = prefix + "*"
  260             let calculatePath =
  261                 let bitness s = if arch = DotNetFrameworkArchitecture.Bitness64 then s + @"64\" else s + @"\"
  262                 let trim = if installRoot.EndsWith(@"\") then installRoot.Substring(0, installRoot.Length - 1) else installRoot
  263                 let i64 = trim.IndexOf("Framework64", StringComparison.OrdinalIgnoreCase)
  264                 if i64 = -1 then bitness trim else bitness (trim.Substring(0, i64 + 9))
  265 
  266             if Directory.Exists(calculatePath) then
  267                 let directories = Directory.GetDirectories(calculatePath, searchPattern) |> Array.sort
  268                 if directories.Length = 0 then None
  269                 else
  270                     // We don't care which one we choose, but we want to be predictible.
  271                     // The intention here is to choose the alphabetical maximum.
  272                     let mutable max = directories |> Array.last
  273                     Some max
  274             else
  275                 None
  276 
  277         let FindDotNetFrameworkPath prefix registryEntryToCheckInstall registryValueToCheckInstall arch =
  278             // If the COMPLUS variables are set, they override everything -- that's the directory we want.
  279             if String.IsNullOrEmpty(complusInstallRoot) || String.IsNullOrEmpty(complusVersion) then
  280                 // We haven't managed to use exact methods to locate the FX, Since we run on coreclr 
  281                 // we can't guess where by using the currently executing runtime
  282                 let installRootFromReg = findRegistryValueUnderKey registryEntryToCheckInstall registryValueToCheckInstall
  283                 match installRootFromReg with
  284                 | None -> None
  285                 | Some x -> PickDirectoryFromInstallRoot prefix x arch
  286             else 
  287                 Some (Path.Combine(complusInstallRoot, complusVersion))
  288 
  289 
  290         /// <summary>
  291         /// Take the parts of the Target framework moniker and formulate the reference assembly path based on the the following pattern:
  292         /// For a framework and version:
  293         ///     $(TargetFrameworkRootPath)\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)
  294         /// For a subtype:
  295         ///     $(TargetFrameworkRootPath)\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\SubType\$(TargetFrameworkSubType)
  296         /// e.g.NET Framework v4.0 would locate its reference assemblies in:
  297         ///     \Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0
  298         /// e.g.Silverlight v2.0 would locate its reference assemblies in:
  299         ///     \Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v2.0
  300         /// e.g.NET Compact Framework v3.5, subtype PocketPC would locate its reference assemblies in:
  301         ///     \Program Files\Reference Assemblies\Microsoft\Framework\.NETCompactFramework\v3.5\SubType\PocketPC
  302         /// </summary>
  303         /// <returns>The path to the reference assembly location</returns>
  304         let GenerateReferenceAssemblyPath targetFrameworkRootPath (frameworkName:FrameworkName) =
  305             match targetFrameworkRootPath with
  306             | Some x ->
  307                 try
  308                     let basePath = Path.Combine(x, frameworkName.Identifier, "v" + frameworkName.Version.ToString())
  309                     let withProfile root =
  310                         if not (String.IsNullOrEmpty(frameworkName.Profile)) then
  311                             Path.Combine(root, "Profile", frameworkName.Profile)
  312                         else root
  313                     Some (Path.GetFullPath(withProfile basePath) + @"\")
  314                 with _ ->
  315                     // The compiler does not see the massage above an as exception;
  316                     None
  317             | _ -> None
  318 
  319 
  320         /// <summary>
  321         /// Generate the path to the program files reference assembly location by taking in the program files special folder and then 
  322         /// using that path to generate the path to the reference assemblies location.
  323         /// </summary>
  324         let generateProgramFilesReferenceAssemblyRoot =
  325             try
  326                 Some(Path.GetFullPath( Path.Combine(programFiles32, "Reference Assemblies\\Microsoft\\Framework") ))
  327             with _ ->
  328                 None
  329 
  330         let pathToDotNetFrameworkReferenceAssemblies =
  331             match GenerateReferenceAssemblyPath generateProgramFilesReferenceAssemblyRoot frameworkName with
  332             | Some x when Directory.Exists(x) -> x + @"\"
  333             | _ -> ""
  334 
  335 
  336         member this.Version = version
  337         member this.dotNetFrameworkRegistryKey = dotNetFrameworkRegistryKey
  338         member this.dotNetFrameworkSetupRegistryInstalledName = dotNetFrameworkSetupRegistryInstalledName
  339         member this.dotNetFrameworkSdkRegistryToolsKey = dotNetFrameworkSdkRegistryToolsKey
  340         member this.DotNetFrameworkSdkRegistryInstallationFolderName = dotNetFrameworkSdkRegistryInstallationFolderName
  341         member this.HasMSBuild = hasMSBuild
  342 
  343         member this.pathsToDotNetFramework = new ConcurrentDictionary<DotNetFrameworkArchitecture, string>()
  344         member this.pathsToDotNetFrameworkSdkTools = new ConcurrentDictionary<Version, string>()
  345         member this.pathToWindowsSdk = "Todo:   Review dow we really need this"
  346 
  347 //            /// <summary>
  348 //            /// Gets the full registry key of this .net framework Sdk for the given visual studio version.
  349 //            /// i.e. "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx40Tools-x86" for .net v4.5 on VS11.
  350 //            /// </summary>
  351 //            public virtual string GetDotNetFrameworkSdkRootRegistryKey(VisualStudioSpec visualStudioSpec)
  352 //            {
  353 //                return string.Join(@"\", HKLM, MicrosoftSDKsRegistryKey, visualStudioSpec.DotNetFrameworkSdkRegistryKey, this.dotNetFrameworkSdkRegistryToolsKey);
  354 //            }
  355 
  356         // Doesn't need to be virtual @@@@@
  357         abstract member GetPathToDotNetFramework: DotNetFrameworkArchitecture -> string
  358         default this.GetPathToDotNetFramework arch =
  359             match this.pathsToDotNetFramework.TryGetValue(arch) with
  360             | true, x -> x
  361             | _ ->
  362                 if not (CheckForFrameworkInstallation this.dotNetFrameworkRegistryKey this.dotNetFrameworkSetupRegistryInstalledName) then null
  363                 else
  364                     // We're not installed and we haven't found this framework path yet -- so find it!
  365                     let fwp:string option = (FindDotNetFrameworkPath dotNetFrameworkFolderPrefix dotNetFrameworkRegistryKey this.dotNetFrameworkSetupRegistryInstalledName arch)
  366                     match fwp with
  367                     | Some x ->
  368                         // For .net frameworks that should have msbuild.exe is it there
  369                         if hasMSBuild && not (File.Exists(Path.Combine(x, "msbuild.exe"))) then null
  370                         else this.pathsToDotNetFramework.[arch] <- x; x
  371                     | _ -> null
  372 
  373         // Doesn't need to be virtual @@@@@
  374         /// <summary>
  375         /// Gets the full path of reference assemblies folder.
  376         /// i.e. "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\" for .net v4.5.
  377         /// </summary>
  378         abstract member GetPathToDotNetFrameworkReferenceAssemblies: string
  379         default this.GetPathToDotNetFrameworkReferenceAssemblies = pathToDotNetFrameworkReferenceAssemblies
  380 
  381 //            /// <summary>
  382 //            /// Gets the full path of .net framework sdk tools for the given visual studio version.
  383 //            /// i.e. "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\" for .net v4.5 on VS11.
  384 //            /// </summary>
  385 //            public virtual string GetPathToDotNetFrameworkSdkTools(VisualStudioSpec visualStudioSpec)
  386 //            {
  387 //                string cachedPath;
  388 //                if (this.pathsToDotNetFrameworkSdkTools.TryGetValue(visualStudioSpec.Version, out cachedPath))
  389 //                {
  390 //                    return cachedPath;
  391 //                }
  392 //
  393 //                string registryPath = string.Join(@"\", MicrosoftSDKsRegistryKey, visualStudioSpec.DotNetFrameworkSdkRegistryKey, this.dotNetFrameworkSdkRegistryToolsKey);
  394 //
  395 //                // For the Dev10 SDK, we check the registry that corresponds to the current process' bitness, rather than
  396 //                // always the 32-bit one the way we do for Dev11 and onward, since that's what we did in Dev10 as well.
  397 //                // As of Dev11, the SDK reg keys are installed in the 32-bit registry. 
  398 //                RegistryView registryView = visualStudioSpec.Version == visualStudioVersion100 ? RegistryView.Default : RegistryView.Registry32;
  399 //
  400 //                string generatedPathToDotNetFrameworkSdkTools = FindRegistryValueUnderKey(
  401 //                    registryPath,
  402 //                    this.dotNetFrameworkSdkRegistryInstallationFolderName,
  403 //                    registryView);
  404 //
  405 //                if (string.IsNullOrEmpty(generatedPathToDotNetFrameworkSdkTools))
  406 //                {
  407 //                    // Fallback mechanisms.
  408 //
  409 //                    // Try to find explicit fallback rule.
  410 //                    // i.e. v4.5.1 on VS12 fallbacks to v4.5 on VS12.
  411 //                    bool foundExplicitRule = false;
  412 //                    for (int i = 0; i < s_explicitFallbackRulesForPathToDotNetFrameworkSdkTools.GetLength(0); ++i)
  413 //                    {
  414 //                        var trigger = s_explicitFallbackRulesForPathToDotNetFrameworkSdkTools[i, 0];
  415 //                        if (trigger.Item1 == this.version && trigger.Item2 == visualStudioSpec.Version)
  416 //                        {
  417 //                            foundExplicitRule = true;
  418 //                            var fallback = s_explicitFallbackRulesForPathToDotNetFrameworkSdkTools[i, 1];
  419 //                            generatedPathToDotNetFrameworkSdkTools = FallbackToPathToDotNetFrameworkSdkToolsInPreviousVersion(fallback.Item1, fallback.Item2);
  420 //                            break;
  421 //                        }
  422 //                    }
  423 //
  424 //                    // Otherwise, fallback to previous VS.
  425 //                    // i.e. fallback to v110 if the current visual studio version is v120.
  426 //                    if (!foundExplicitRule)
  427 //                    {
  428 //                        int index = Array.IndexOf(s_visualStudioSpecs, visualStudioSpec);
  429 //                        if (index > 0)
  430 //                        {
  431 //                            // The items in the array "visualStudioSpecs" must be ordered by version. That would allow us to fallback to the previous visual studio version easily.
  432 //                            VisualStudioSpec fallbackVisualStudioSpec = s_visualStudioSpecs[index - 1];
  433 //                            generatedPathToDotNetFrameworkSdkTools = FallbackToPathToDotNetFrameworkSdkToolsInPreviousVersion(this.version, fallbackVisualStudioSpec.Version);
  434 //                        }
  435 //                    }
  436 //                }
  437 //
  438 //                if (string.IsNullOrEmpty(generatedPathToDotNetFrameworkSdkTools))
  439 //                {
  440 //                    // Fallback to "default" ultimately.
  441 //                    generatedPathToDotNetFrameworkSdkTools = FallbackToDefaultPathToDotNetFrameworkSdkTools(this.version);
  442 //                }
  443 //
  444 //                if (!string.IsNullOrEmpty(generatedPathToDotNetFrameworkSdkTools))
  445 //                {
  446 //                    this.pathsToDotNetFrameworkSdkTools[visualStudioSpec.Version] = generatedPathToDotNetFrameworkSdkTools;
  447 //                }
  448 //
  449 //                return generatedPathToDotNetFrameworkSdkTools;
  450 //            }
  451 //
  452 //            /// <summary>
  453 //            /// Gets the full path of .net framework sdk.
  454 //            /// i.e. "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\" for .net v4.5 on VS11.
  455 //            /// </summary>
  456 //            public virtual string GetPathToDotNetFrameworkSdk(VisualStudioSpec visualStudioSpec)
  457 //            {
  458 //                string pathToBinRoot = this.GetPathToDotNetFrameworkSdkTools(visualStudioSpec);
  459 //                pathToBinRoot = RemoveDirectories(pathToBinRoot, 2);
  460 //                return pathToBinRoot;
  461 //            }
  462 //
  463 //            /// <summary>
  464 //            /// Gets the full path of reference assemblies folder.
  465 //            /// i.e. "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\" for .net v4.5.
  466 //            /// </summary>
  467 //            public virtual string GetPathToDotNetFrameworkReferenceAssemblies()
  468 //            {
  469 //                if (this.pathToDotNetFrameworkReferenceAssemblies == null)
  470 //                {
  471 //                    // when a user requests the 40 reference assembly path we don't need to read the redist list because we will not be chaining so we may as well just
  472 //                    // generate the path and save us some time.
  473 //                    string referencePath = GenerateReferenceAssemblyPath(FrameworkLocationHelper.programFilesReferenceAssemblyLocation, this.FrameworkName);
  474 //                    if (Directory.Exists(referencePath))
  475 //                    {
  476 //                        this.pathToDotNetFrameworkReferenceAssemblies = FileUtilities.EnsureTrailingSlash(referencePath);
  477 //                    }//                }
  478 //
  479 //                return this.pathToDotNetFrameworkReferenceAssemblies;
  480 //            }
  481 //
  482 //            /// <summary>
  483 //            /// Gets the full path of the corresponding windows sdk shipped with this .net framework.
  484 //            /// i.e. "C:\Program Files (x86)\Windows Kits\8.0\" for v8.0 (shipped with .net v4.5 and VS11).
  485 //            /// </summary>
  486 //            public virtual string GetPathToWindowsSdk()
  487 //            {
  488 //                if (this.pathToWindowsSdk == null)
  489 //                {
  490 //                    ErrorUtilities.VerifyThrowArgument(this.visualStudioVersion != null, "FrameworkLocationHelper.UnsupportedFrameworkVersionForWindowsSdk", this.version);
  491 //
  492 //                    var visualStudioSpec = GetVisualStudioSpec(this.visualStudioVersion);
  493 //
  494 //                    if (string.IsNullOrEmpty(visualStudioSpec.WindowsSdkRegistryKey) || string.IsNullOrEmpty(visualStudioSpec.WindowsSdkRegistryInstallationFolderName))
  495 //                    {
  496 //                        ErrorUtilities.ThrowArgument("FrameworkLocationHelper.UnsupportedFrameworkVersionForWindowsSdk", this.version);
  497 //                    }
  498 //
  499 //                    string registryPath = string.Join(@"\", MicrosoftSDKsRegistryKey, "Windows", visualStudioSpec.WindowsSdkRegistryKey);
  500 //
  501 //                    // As of Dev11, the SDK reg keys are installed in the 32-bit registry. 
  502 //                    this.pathToWindowsSdk = FindRegistryValueUnderKey(
  503 //                        registryPath,
  504 //                        visualStudioSpec.WindowsSdkRegistryInstallationFolderName,
  505 //                        RegistryView.Registry32);
  506 //                }
  507 //
  508 //                return this.pathToWindowsSdk;
  509 //            }
  510 //
  511 //            protected static string FallbackToPathToDotNetFrameworkSdkToolsInPreviousVersion(Version dotNetFrameworkVersion, Version visualStudioVersion)
  512 //            {
  513 //                VisualStudioSpec visualStudioSpec;
  514 //                DotNetFrameworkSpec dotNetFrameworkSpec;
  515 //                if (s_visualStudioSpecDict.TryGetValue(visualStudioVersion, out visualStudioSpec)
  516 //                    && s_dotNetFrameworkSpecDict.TryGetValue(dotNetFrameworkVersion, out dotNetFrameworkSpec)
  517 //                    && visualStudioSpec.SupportedDotNetFrameworkVersions.Contains(dotNetFrameworkVersion))
  518 //                {
  519 //                    return dotNetFrameworkSpec.GetPathToDotNetFrameworkSdkTools(visualStudioSpec);
  520 //                }
  521 //
  522 //                return null;
  523 //            }
  524 //
  525 //            protected static string FallbackToDefaultPathToDotNetFrameworkSdkTools(Version dotNetFrameworkVersion)
  526 //            {
  527 //                if (dotNetFrameworkVersion.Major == 4)
  528 //                {
  529 //                    return FrameworkLocationHelper.PathToV4ToolsInFallbackDotNetFrameworkSdk;
  530 //                }
  531 //
  532 //                if (dotNetFrameworkVersion == dotNetFrameworkVersion35)
  533 //                {
  534 //                    return FrameworkLocationHelper.PathToV35ToolsInFallbackDotNetFrameworkSdk;
  535 //                }
  536 //
  537 //                return null;
  538 //            }
  539 //        }
  540 
  541     type DotNetFrameworkSpecLegacy (version,
  542                                     dotNetFrameworkRegistryKey,
  543                                     dotNetFrameworkSetupRegistryInstalledName,
  544                                     dotNetFrameworkVersionFolderPrefix,
  545                                     dotNetFrameworkSdkRegistryToolsKey,
  546                                     dotNetFrameworkSdkRegistryInstallationFolderName,
  547                                     hasMSBuild, 
  548                                     vsBuild) =
  549         inherit DotNetFrameworkSpec (version,
  550                                      dotNetFrameworkRegistryKey,
  551                                      dotNetFrameworkSetupRegistryInstalledName,
  552                                      dotNetFrameworkVersionFolderPrefix,
  553                                      dotNetFrameworkSdkRegistryToolsKey,
  554                                      dotNetFrameworkSdkRegistryInstallationFolderName,
  555                                      hasMSBuild, 
  556                                      vsBuild)
  557 
  558     type DotNetFrameworkSpecV3 (version,
  559                                 dotNetFrameworkRegistryKey,
  560                                 dotNetFrameworkSetupRegistryInstalledName,
  561                                 dotNetFrameworkVersionFolderPrefix,
  562                                 dotNetFrameworkSdkRegistryToolsKey,
  563                                 dotNetFrameworkSdkRegistryInstallationFolderName,
  564                                 hasMSBuild, 
  565                                 vsBuild) =
  566         inherit DotNetFrameworkSpec(version,
  567                                     dotNetFrameworkRegistryKey,
  568                                     dotNetFrameworkSetupRegistryInstalledName,
  569                                     dotNetFrameworkVersionFolderPrefix,
  570                                     dotNetFrameworkSdkRegistryToolsKey,
  571                                     dotNetFrameworkSdkRegistryInstallationFolderName,
  572                                     hasMSBuild, 
  573                                     vsBuild)
  574 
  575 
  576 //        {
  577 //            private string _pathToDotNetFrameworkSdkTools;
  578 //
  579 //            public DotNetFrameworkSpecLegacy(
  580 //                Version version,
  581 //                string dotNetFrameworkRegistryKey,
  582 //                string dotNetFrameworkSetupRegistryInstalledName,
  583 //                string dotNetFrameworkVersionFolderPrefix,
  584 //                string dotNetFrameworkSdkRegistryInstallationFolderName,
  585 //                bool hasMSBuild)
  586 //                : base(version,
  587 //                      dotNetFrameworkRegistryKey,
  588 //                      dotNetFrameworkSetupRegistryInstalledName,
  589 //                      dotNetFrameworkVersionFolderPrefix,
  590 //                      null,
  591 //                      dotNetFrameworkSdkRegistryInstallationFolderName,
  592 //                      hasMSBuild)
  593 //            {
  594 //            }
  595 //
  596 //            /// <summary>
  597 //            /// Gets the full registry key of this .net framework Sdk for the given visual studio version.
  598 //            /// i.e. "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework" for v1.1 and v2.0.
  599 //            /// </summary>
  600 //            public override string GetDotNetFrameworkSdkRootRegistryKey(VisualStudioSpec visualStudioSpec)
  601 //            {
  602 //                return FrameworkLocationHelper.fullDotNetFrameworkRegistryKey;
  603 //            }
  604 //
  605 //            /// <summary>
  606 //            /// Gets the full path of .net framework sdk tools for the given visual studio version.
  607 //            /// </summary>
  608 //            public override string GetPathToDotNetFrameworkSdkTools(VisualStudioSpec visualStudioSpec)
  609 //            {
  610 //                if (_pathToDotNetFrameworkSdkTools == null)
  611 //                {
  612 //                    _pathToDotNetFrameworkSdkTools = FindRegistryValueUnderKey(
  613 //                        dotNetFrameworkRegistryPath,
  614 //                        this.dotNetFrameworkSdkRegistryInstallationFolderName);
  615 //                }
  616 //
  617 //                return _pathToDotNetFrameworkSdkTools;
  618 //            }
  619 //
  620 //            /// <summary>
  621 //            /// Gets the full path of .net framework sdk, which is the full path of .net framework sdk tools for v1.1 and v2.0.
  622 //            /// </summary>
  623 //            public override string GetPathToDotNetFrameworkSdk(VisualStudioSpec visualStudioSpec)
  624 //            {
  625 //                return this.GetPathToDotNetFrameworkSdkTools(visualStudioSpec);
  626 //            }
  627 //
  628 //            /// <summary>
  629 //            /// Gets the full path of reference assemblies folder, which is the full path of .net framework for v1.1 and v2.0.
  630 //            /// </summary>
  631 //            public override string GetPathToDotNetFrameworkReferenceAssemblies()
  632 //            {
  633 //                return this.GetPathToDotNetFramework(DotNetFrameworkArchitecture.Current);
  634 //            }
  635 //        }
  636 //
  637 //        /// <summary>
  638 //        /// Specialized implementation for legacy .net framework v3.0 and v3.5.
  639 //        /// </summary>
  640 //        private class DotNetFrameworkSpecV3 : DotNetFrameworkSpec
  641 //        {
  642 //            public DotNetFrameworkSpecV3(
  643 //                Version version,
  644 //                string dotNetFrameworkRegistryKey,
  645 //                string dotNetFrameworkSetupRegistryInstalledName,
  646 //                string dotNetFrameworkVersionFolderPrefix,
  647 //                string dotNetFrameworkSdkRegistryToolsKey,
  648 //                string dotNetFrameworkSdkRegistryInstallationFolderName,
  649 //                bool hasMSBuild)
  650 //                : base(version,
  651 //                      dotNetFrameworkRegistryKey,
  652 //                      dotNetFrameworkSetupRegistryInstalledName,
  653 //                      dotNetFrameworkVersionFolderPrefix,
  654 //                      dotNetFrameworkSdkRegistryToolsKey,
  655 //                      dotNetFrameworkSdkRegistryInstallationFolderName,
  656 //                      hasMSBuild)
  657 //            {
  658 //            }
  659 //
  660 //            /// <summary>
  661 //            /// Gets the full path of .net framework sdk.
  662 //            /// i.e. "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\" for .net v3.5 on VS11.
  663 //            /// </summary>
  664 //            public override string GetPathToDotNetFrameworkSdk(VisualStudioSpec visualStudioSpec)
  665 //            {
  666 //                string pathToBinRoot = this.GetPathToDotNetFrameworkSdkTools(visualStudioSpec);
  667 //                pathToBinRoot = RemoveDirectories(pathToBinRoot, 1);
  668 //                return pathToBinRoot;
  669 //            }
  670 //
  671 //            /// <summary>
  672 //            /// Gets the full path of reference assemblies folder.
  673 //            /// i.e. "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\" for v3.5.
  674 //            /// </summary>
  675 //            public override string GetPathToDotNetFrameworkReferenceAssemblies()
  676 //            {
  677 //                if (this.pathToDotNetFrameworkReferenceAssemblies == null)
  678 //                {
  679 //                    this.pathToDotNetFrameworkReferenceAssemblies = FindRegistryValueUnderKey(
  680 //                        dotNetFrameworkAssemblyFoldersRegistryPath + "\\" + this.dotNetFrameworkFolderPrefix,
  681 //                        referenceAssembliesRegistryValueName);
  682 //
  683 //                    if (this.pathToDotNetFrameworkReferenceAssemblies == null)
  684 //                    {
  685 //                        this.pathToDotNetFrameworkReferenceAssemblies = GenerateReferenceAssemblyDirectory(dotNetFrameworkFolderPrefix);
  686 //                    }
  687 //                }
  688 //
  689 //                return this.pathToDotNetFrameworkReferenceAssemblies;
  690 //            }
  691 //        }
  692 //
  693 
  694     let CreateDotNetFrameworkSpecForV4 version visualStudioVersion =
  695         new DotNetFrameworkSpec(
  696             version,
  697             dotNetFrameworkSetupRegistryPath + "\\v4\\Full",
  698             "Install",
  699             "v4.0",
  700             "WinSDK-NetFx40Tools-x86",
  701             "InstallationFolder",
  702             true,
  703             Some visualStudioVersion)
  704 
  705     let dotNetFrameworkSpecDict = 
  706         let array = [|
  707             new DotNetFrameworkSpecLegacy(dotNetFrameworkVersion11,                             // v1.1
  708                 dotNetFrameworkRegistryKeyV11,
  709                 dotNetFrameworkSetupRegistryInstalledName,
  710                 dotNetFrameworkVersionFolderPrefixV11,
  711                 dotNetFrameworkSdkInstallKeyValueV11,
  712                 "",
  713                 false,
  714                 None) :> DotNetFrameworkSpec
  715             new DotNetFrameworkSpecLegacy(                                                      // v2.0
  716                 dotNetFrameworkVersion20,
  717                 dotNetFrameworkRegistryKeyV20,
  718                 dotNetFrameworkSetupRegistryInstalledName,
  719                 dotNetFrameworkVersionFolderPrefixV20,
  720                 dotNetFrameworkSdkInstallKeyValueV20,
  721                 "",
  722                 true,
  723                 None) :> DotNetFrameworkSpec
  724             new DotNetFrameworkSpecV3(                                                          // v3.0
  725                 dotNetFrameworkVersion30,
  726                 dotNetFrameworkRegistryKeyV30,
  727                 "InstallSuccess",
  728                 dotNetFrameworkVersionFolderPrefixV30,
  729                 "",
  730                 "",
  731                 false,
  732                 None) :> DotNetFrameworkSpec
  733             new DotNetFrameworkSpecV3(                                                          // v3.5
  734                 dotNetFrameworkVersion35,
  735                 dotNetFrameworkRegistryKeyV35,
  736                 dotNetFrameworkSetupRegistryInstalledName,
  737                 dotNetFrameworkVersionFolderPrefixV35,
  738                 "WinSDK-NetFx35Tools-x86",
  739                 "InstallationFolder",
  740                 true,
  741                 None) :> DotNetFrameworkSpec
  742             CreateDotNetFrameworkSpecForV4 dotNetFrameworkVersion40  visualStudioVersion100     // v4.0
  743             CreateDotNetFrameworkSpecForV4 dotNetFrameworkVersion45  visualStudioVersion110     // v4.5
  744             CreateDotNetFrameworkSpecForV4 dotNetFrameworkVersion451 visualStudioVersion120     // v4.5.1
  745             CreateDotNetFrameworkSpecForV4 dotNetFrameworkVersion452 visualStudioVersion150     // v4.5.2
  746             CreateDotNetFrameworkSpecForV4 dotNetFrameworkVersion46  visualStudioVersion140     // v4.6
  747             CreateDotNetFrameworkSpecForV4 dotNetFrameworkVersion461 visualStudioVersion150     // v4.6.1
  748         |]
  749         array.ToDictionary<DotNetFrameworkSpec, Version>(fun spec -> spec.Version)
  750 
  751     let getDotNetFrameworkSpec version =
  752         match dotNetFrameworkSpecDict.TryGetValue(version) with
  753         | true, x -> x
  754         | _ -> raise (getArgumentException version)
  755 
  756     // Get a fully qualified path to the framework's root directory. 
  757 //    let GetPathToDotNetFramework version architecture =
  758 //        let frameworkVersion = TargetDotNetFrameworkVersionToSystemVersion version
  759 //        (getDotNetFrameworkSpec frameworkVersion).GetPathToDotNetFramework(architecture)
  760 
  761 
  762     // Get a fully qualified path to the frameworks root directory.
  763     let GetPathToDotNetFramework version =
  764 //        GetPathToDotNetFramework version DotNetFrameworkArchitecture.Current
  765         let frameworkVersion = TargetDotNetFrameworkVersionToSystemVersion version
  766         (getDotNetFrameworkSpec frameworkVersion).GetPathToDotNetFramework(DotNetFrameworkArchitecture.Current)
  767 
  768     /// <summary>
  769     /// Returns the path to the reference assemblies location for the given framework version.
  770     /// </summary>
  771     /// <param name="version">Version of the targeted .NET Framework</param>
  772     /// <returns>Path string.</returns>
  773     let GetPathToDotNetFrameworkReferenceAssemblies version =
  774         let frameworkVersion = TargetDotNetFrameworkVersionToSystemVersion version
  775         (getDotNetFrameworkSpec frameworkVersion).GetPathToDotNetFrameworkReferenceAssemblies
  776 
  777     type IBuildEngine =
  778         abstract member BuildProjectFile : string*string[]*IDictionary*IDictionary -> bool
  779         abstract member LogCustomEvent : (*CustomBuildEventArgs*) obj -> unit
  780         abstract member LogErrorEvent : (*BuildErrorEventArgs*) obj -> unit
  781         abstract member LogMessageEvent : (*BuildMessageEventArgs*) obj -> unit
  782         abstract member LogWarningEvent : (*BuildMessageEventArgs*) obj -> unit
  783 
  784         // Properties
  785         abstract member ColumnNumberOfTaskNode : int with get
  786         abstract member ContinueOnError : bool with get
  787         abstract member LineNumberOfTaskNode : int with get
  788         abstract member ProjectFileOfTaskNode : string with get
  789 
  790 //    let getPropertyValue instance propName =
  791 //        instance.GetType().GetProperty(propName, BindingFlags.Public).GetValue(instance, null)
  792 //
  793 //    let setPropertyValue instance propName propValue=
  794 //        instance.GetType().GetPropserty(propName, BindingFlags.Public).SetValue(instance, propValue, null)
  795 
  796     type ResolveAssemblyReference () =
  797         let assembly = Assembly.Load(new AssemblyName("Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"))
  798         let resolveAssemblyReferenceType = assembly.GetType("Microsoft.Build.Tasks.ResolveAssemblyReference")
  799         let instance = Activator.CreateInstance(resolveAssemblyReferenceType)
  800 
  801         member this.BuildEngine
  802             with get ():IBuildEngine = (instance.GetPropertyValue("BuildEngine") :?> IBuildEngine)
  803             and set (value:IBuildEngine) = (instance.SetPropertyValue("BuildEngine", value)); ()
  804 
  805         member this.TargetFrameworkDirectories
  806             with get ():string[] = (instance.GetPropertyValue("TargetFrameworkDirectories") :?> string[])
  807             and set (value:string[]) = (instance.SetPropertyValue("TargetFrameworkDirectories", value)); ()
  808 
  809         member this.FindRelatedFiles
  810             with get () :bool = (instance.GetPropertyValue("FindRelatedFiles") :?> bool)
  811             and set (value:bool) = (instance.SetPropertyValue("FindRelatedFiles", value)); ()
  812 
  813         member this.FindDependencies
  814             with get ():bool = (instance.GetPropertyValue("FindDependencies") :?> bool)
  815             and set (value:bool) = (instance.SetPropertyValue("FindDependencies", value)); ()
  816 
  817         member this.FindSatellites
  818             with get ():bool = (instance.GetPropertyValue("FindSatellites") :?> bool)
  819             and set (value:bool) = (instance.SetPropertyValue("FindSatellites", value)); ()
  820 
  821         member this.FindSerializationAssemblies
  822             with get ():bool = (instance.GetPropertyValue("FindSerializationAssemblies") :?> bool)
  823             and set (value:bool) = (instance.SetPropertyValue("FindSerializationAssemblies", value)); ()
  824 
  825         member this.TargetedRuntimeVersion
  826             with get ():string = (instance.GetPropertyValue("TargetedRuntimeVersion") :?> string)
  827             and set (value:string) = (instance.SetPropertyValue("TargetedRuntimeVersion", value)); ()
  828 
  829         member this.TargetProcessorArchitecture
  830             with get ():string = (instance.GetPropertyValue("TargetProcessorArchitecture") :?> string)
  831             and set (value:string) = (instance.SetPropertyValue("TargetProcessorArchitecture", value)); ()
  832 
  833         member this.CopyLocalDependenciesWhenParentReferenceInGac
  834             with get ():bool = (instance.GetPropertyValue("CopyLocalDependenciesWhenParentReferenceInGac") :?> bool)
  835             and set (value:bool) = (instance.SetPropertyValue("CopyLocalDependenciesWhenParentReferenceInGac", value)); ()
  836 
  837         member this.AllowedAssemblyExtensions
  838             with get () :string[] = (instance.GetPropertyValue("AllowedAssemblyExtensions") :?> string[])
  839             and set (value:string[]) =  (instance.SetPropertyValue("AllowedAssemblyExtensions", value)); ()
  840 
  841         member this.Assemblies
  842             with get ():ITaskItem[] = (instance.GetPropertyValue("Assemblies") :?> ITaskItem[])
  843             and set (value:ITaskItem[]) = (instance.SetPropertyValue("Assemblies", value)); ()
  844 
  845         member this.CopyLocalFiles = (instance.GetPropertyValue("CopyLocalFiles") :?> ITaskItem[])
  846 
  847         member this.RelatedFiles = (instance.GetPropertyValue("RelatedFiles") :?> ITaskItem[])
  848 
  849         member this.ResolvedFiles = (instance.GetPropertyValue("ResolvedFiles") :?> ITaskItem[])
  850 
  851         member this.ResolvedDependencyFiles = (instance.GetPropertyValue("ResolvedDependencyFiles") :?> ITaskItem[])
  852 
  853         member this.SatelliteFiles = (instance.GetPropertyValue("SatelliteFiles") :?> ITaskItem[])
  854 
  855         member this.ScatterFiles = (instance.GetPropertyValue("ScatterFiles") :?> ITaskItem[])
  856 
  857         member this.SuggestedRedirects = (instance.GetPropertyValue("SuggestedRedirects") :?> ITaskItem[])
  858 
  859         member this.SearchPaths
  860             with get () :string[] = (instance.GetPropertyValue("SearchPaths") :?> string[])
  861             and set (value:string[]) =  (instance.SetPropertyValue("SearchPaths", value)); ()
  862 
  863         member this.Execute () =
  864             let m = instance.GetType().GetMethod("Execute", [| |])
  865             m.Invoke(instance, [||]) :?> bool
  866 
  867 #endif