Microsoft.Build.Utilities.Core Represents an API contract definition Name of the contract Version of the contract Constructor. Returns true if this element is a "ContainedApiContracts" element. Given an XML element containing API contracts, read out all contracts within that element. Helper class with ApiContract element names Element containing a bucket of contracts Element representing an individual API contract Element representing a flag to indicate if the SDK content is versioned Helper class with attribute names Name associated with this element Version associated with this element This class provides the same functionality as the Task class, but derives from MarshalByRefObject so that it can be instantiated in its own app domain. Default (family) constructor. This (family) constructor allows derived task classes to register their resources. The task resources. This (family) constructor allows derived task classes to register their resources, as well as provide a prefix for composing help keywords from string resource names. If the prefix is an empty string, then string resource names will be used verbatim as help keywords. For an example of how the prefix is used, see the method. The task resources. The help keyword prefix. The build engine automatically sets this property to allow tasks to call back into it. The build engine interface available to tasks. The build engine sets this property if the host IDE has associated a host object with this particular task. The host object instance (can be null). Gets an instance of a TaskLoggingHelper class containing task logging methods. The logging helper object. Gets or sets the task's culture-specific resources. Derived classes should register their resources either during construction, or via this property, if they have localized strings. The task's resources (can be null). Gets or sets the prefix used to compose help keywords from string resource names. If a task does not have help keywords associated with its messages, it can ignore this property or set it to null. If the prefix is set to an empty string, then string resource names will be used verbatim as help keywords. For an example of how this prefix is used, see the method. The help keyword prefix string (can be null). Must be implemented by derived class. true, if successful Overridden to give tasks deriving from this class infinite lease time. Otherwise we end up with a limited lease (5 minutes I think) and task instances can expire if they take long time processing. Contains information about entries in the AssemblyFoldersEx registry keys. Constructor Registry hive used Registry view used The registry key to the component Folder found at the registry keys default value Target framework version for the registry key Represents information about assembly folders. Initializes a new instance of the AssemblyFoldersFromConfigInfo class. The directory path. The of the target framework. Gets the path to the assembly folder. Gets the of the target framework. (1) Make sure values containing hyphens are quoted (RC at least requires this) (2) Escape any embedded quotes. -- Literal double quotes should be written in the form \" not "" -- Backslashes falling just before doublequotes must be doubled. -- Literal double quotes can only occur in pairs (you cannot pass a single literal double quote) -- Functional double quotes (for example to handle spaces) are best put around both name and value in switches like /Dname=value. Below are some quoting experiments, using the /D switch with the CL and RC preprocessor. The /D switch is a little more tricky than most switches, because it has a name=value pair. The table below contains what the preprocessor actually embeds when passed the switch in the first column: CL via cmd line CL via response file RC /DFOO="A" A A /D"FOO="A"" A A A /DFOO=A A A /D"FOO=A" A A /DFOO=""A"" A A A /DFOO=\"A\" "A" "A" /DFOO="""A""" "A" broken "A" /D"FOO=\"A\"" "A" "A" /D"FOO=""A""" "A" "A" /DFOO="A B" A B A B /D"FOO=A B" A B A B /D"FOO="A B"" broken /DFOO=\"A B\" broken /D"FOO=\"A B\"" "A B" "A B" "A B" /D"FOO=""A B""" "A B" broken broken From my experiments (with CL and RC only) it seems that -- Literal double quotes are most reliably written in the form \" not "" -- Backslashes falling just before doublequotes must be doubled. -- Values containing literal double quotes must be quoted. -- Literal double quotes can only occur in pairs (you cannot pass a single literal double quote) -- For /Dname=value style switches, functional double quotes (for example to handle spaces) are best put around both name and value (in other words, these kinds of switches don't need special treatment for their '=' signs). -- Values containing hyphens should be quoted; RC requires this, and CL does not mind. Default constructor Default constructor Default constructor Returns the length of the current command Retrieves the private StringBuilder instance for inheriting classes Return the command-line as a string. Should hyphens be quoted or not Should use new line separators instead of spaces to separate arguments. Instead of defining which characters must be quoted, define which characters we know its safe to not quote. This way leads to more false-positives (which still work, but don't look as nice coming out of the logger), but is less likely to leave a security hole. Also, define the characters that we know for certain need quotes. This is partly to document which characters we know can cause trouble and partly as a sanity check against a bug creeping in. Use a private property so that we can lazy initialize the regex Use a private getter property to we can lazy initialize the regex Checks the given switch parameter to see if it must/can be quoted. the string to examine for characters that require quoting true, if parameter should be quoted Add a space or newline to the specified string if and only if it's not empty. This is a pretty obscure method and so it's only available to inherited classes. Appends a string. Quotes are added if they are needed. This method does not append a space to the command line before executing. Escapes any double quotes in the string. The string to append Appends given text to the buffer after first quoting the text if necessary. Appends a string. No quotes are added. This method does not append a space to the command line before executing. AppendTextUnquoted(@"Folder name\filename.cs") => "Folder name\\filename.cs" In the future, this function may fixup 'textToAppend' to handle literal embedded quotes. The string to append Appends a file name. Quotes are added if they are needed. If the first character of the file name is a dash, ".\" is prepended to avoid confusing the file name with a switch This method does not append a space to the command line before executing. AppendFileNameWithQuoting("-StrangeFileName.cs") => ".\-StrangeFileName.cs" In the future, this function may fixup 'text' to handle literal embedded quotes. The file name to append Appends a file name quoting it if necessary. This method appends a space to the command line (if it's not currently empty) before the file name. AppendFileNameIfNotNull("-StrangeFileName.cs") => ".\-StrangeFileName.cs" File name to append, if it's null this method has no effect Appends a file name quoting it if necessary. This method appends a space to the command line (if it's not currently empty) before the file name. See the string overload version File name to append, if it's null this method has no effect Appends array of file name strings, quoting them if necessary, delimited by a delimiter. This method appends a space to the command line (if it's not currently empty) before the file names. AppendFileNamesIfNotNull(new string[] {"Alpha.cs", "Beta.cs"}, ",") => "Alpha.cs,Beta.cs" File names to append, if it's null this method has no effect The delimiter between file names Appends array of ITaskItem specs as file names, quoting them if necessary, delimited by a delimiter. This method appends a space to the command line (if it's not currently empty) before the file names. See the string[] overload version Task items to append, if null this method has no effect Delimiter to put between items in the command line Appends a command-line switch that has no separate value, without any quoting. This method appends a space to the command line (if it's not currently empty) before the switch. AppendSwitch("/utf8output") => "/utf8output" The switch to append to the command line, may not be null Appends a command-line switch that takes a single string parameter, quoting the parameter if necessary. This method appends a space to the command line (if it's not currently empty) before the switch. AppendSwitchIfNotNull("/source:", "File Name.cs") => "/source:\"File Name.cs\"" The switch to append to the command line, may not be null Switch parameter to append, quoted if necessary. If null, this method has no effect. Throws if the parameter has a double-quote in it. This is used to prevent parameter injection. It's virtual so that tools can override this method if they want to have quotes escaped in filenames Switch name for error message Switch parameter to scan Append a switch [overload] This method appends a space to the command line (if it's not currently empty) before the switch. See the string overload version The switch to append to the command line, may not be null Switch parameter to append, quoted if necessary. If null, this method has no effect. Appends a command-line switch that takes a string[] parameter, and add double-quotes around the individual filenames if necessary. This method appends a space to the command line (if it's not currently empty) before the switch. AppendSwitchIfNotNull("/sources:", new string[] {"Alpha.cs", "Be ta.cs"}, ";") => "/sources:Alpha.cs;\"Be ta.cs\"" The switch to append to the command line, may not be null Switch parameters to append, quoted if necessary. If null, this method has no effect. Delimiter to put between individual parameters, may not be null (may be empty) Appends a command-line switch that takes a ITaskItem[] parameter, and add double-quotes around the individual filenames if necessary. This method appends a space to the command line (if it's not currently empty) before the switch. See the string[] overload version The switch to append to the command line, may not be null Switch parameters to append, quoted if necessary. If null, this method has no effect. Delimiter to put between individual parameters, may not be null (may be empty) Appends the literal parameter without trying to quote. This method appends a space to the command line (if it's not currently empty) before the switch. AppendSwitchUnquotedIfNotNull("/source:", "File Name.cs") => "/source:File Name.cs" The switch to append to the command line, may not be null Switch parameter to append, not quoted. If null, this method has no effect. Appends the literal parameter without trying to quote. This method appends a space to the command line (if it's not currently empty) before the switch. See the string overload version The switch to append to the command line, may not be null Switch parameter to append, not quoted. If null, this method has no effect. Appends a command-line switch that takes a string[] parameter, not quoting the individual parameters This method appends a space to the command line (if it's not currently empty) before the switch. AppendSwitchUnquotedIfNotNull("/sources:", new string[] {"Alpha.cs", "Be ta.cs"}, ";") => "/sources:Alpha.cs;Be ta.cs" The switch to append to the command line, may not be null Switch parameters to append, not quoted. If null, this method has no effect. Delimiter to put between individual parameters, may not be null (may be empty) Appends a command-line switch that takes a ITaskItem[] parameter, not quoting the individual parameters This method appends a space to the command line (if it's not currently empty) before the switch. See the string[] overload version The switch to append to the command line, may not be null Switch parameters to append, not quoted. If null, this method has no effect. Delimiter to put between individual parameters, may not be null (may be empty) Structure to represent an extension sdk Path to the platform sdk may be null if not a platform sdk. Extension SDK moniker SDK version SDK identifier Object containing the properties in the SDK manifest Caches minimum Visual Studio version from the manifest Caches max platform version from the manifest Constructor SDK version from the moniker SDK identifier from the moniker The type of the SDK. Minimum Visual Studio version from SDKManifest.xml Maximum platform version from SDKManifest.xml Api contracts from the SDKManifest, if any Reference to the manifest object Makes sure manifest is instantiated only once Load manifest from disk the first time it is needed Parse SDK moniker This helper base class provides default functionality for loggers that handle events raised by the build engine. This class can only be instantiated in a derived form. Gets or sets the level of detail to show in the event log. The verbosity level. Gets or sets the user-specified parameters to the logger. Derived class can ignore if it doesn't take parameters. The parameter string (can be null). Must be implemented by derived class to subscribe to build events. The available events that a logger can subscribe to. Derived class should override if it needs to release any resources. Generates a message in the default format from a BuildErrorEventArgs object. Error event arguments Error message in canonical format Generates a message in the default format from a BuildWarningEventArgs object. Warning event arguments Warning message in canonical format Determines whether the current verbosity setting is at least the value passed in. This is a multiplexing logger. The purpose of this logger is to allow the registration and deregistration of multiple loggers during the build. This is to support the VS IDE scenario where loggers are registered and unregistered for each project system's build request. This means one physical build may have multiple logical builds each with their own set of loggers. The Mux logger will register itself with the build manager as a regular central /l style logger. It will be responsible for receiving messages from the build manager and route them to the correct logger based on the logical build the message came from. Requirements: 1) Multiplexing logger will be registered at the beginning of the build manager's Begin build Any loggers registered before the build manager actually started building will get the build started event at the same time as the MUX logger Any loggers registered after the build manager starts the build will get a synthesised build started event. The event cannot be cached because the timestamp of the build started event is determined when the event is created, caching the event would give incorrect build times in the loggers registered to the MUX. 2) The MUX logger will be initialized by the build manager. The mux will listen to all events on the event source from the build manager and will route events correctly to the registered loggers. 3) The MUX logger will be shutdown when the build is finished in end build . At this time it will un-register any loggers attached to it. 4) The MUX logger will log the build finished event when the project finished event for the first project started event is seen for each logger. Registering Loggers: The multiplexing logger will function in the following way: A logger will be passed to the MUX Register logger method with a submission ID which will be used to route a the message to the correct logger. A new event source will be created so that the logger passed in can be registered to that event source If the build started event has already been logged the MUX logger will create a new BuildStartedEvent and send that to the event source. UnregisterLoggers: When a build submission is completed the UnregisterLoggers method will be called with the submission ID. At this point we will look up the success state of the project finished event for the submission ID and log a build finished event to the logger. The event source will be cleaned up. This may be interesting because the unregister will come from a thread other than what is doing the logging. This may create a Synchronization issue, if unregister is called while events are being logged. The mapping of submission IDs to the submission record. Keep the build started event if it has been seen, we need the message off it. Event source which events from the build manager will be raised on. The handler for the build started event The handler for the build finished event. The handler for the project started event. The handler for the project finished event. Dictionary mapping submission id to projects in progress. The maximum node count as specified in the call to Initialize() Constructor. Required for ILogger interface Required for the ILoggerInterface Should evaluation events include generated metaprojects? Should evaluation events include profiling information? Should task events include task inputs? Should properties and items be logged on instead of ? Initialize the logger. Initialize the logger. Shutdown the mux logger and clear out any state This method will register a logger on the MUX logger and then raise a build started event if the build started event has already been logged Unregisters all the loggers for a given submission id. Receives the build started event for the whole build. Receives the build finished event. Receives the project started event and records the submission as being in-progress. Receives the project finished event. This class holds everything the logger needs to know about a particular submission, including the event source. Object used to synchronize access to internals. List of loggers The maximum node count The event source which will have events raised from the buld manager. The buildStartedEvent to use when synthesizing the build started event. The project build event coontext for the first project started event seen, this is the root of the submission. SubmissionId for this submission record Has the record been shutdown yet. Even hander for "anyEvent" this is a handler which will be called from each of the other event handlers Handle the Build Finished event Handle the Build started event Handle custom build events Handle error events Handle message events Handle project finished events Handle project started events Handle build sttus events Handle target finished events Handle target started events Handle task finished Handle task started Handle warning events Handle telemetry events. Constructor. This event is raised to log a message. This event is raised to log an error. This event is raised to log a warning. this event is raised to log the start of a build this event is raised to log the end of a build this event is raised to log the start of a project build this event is raised to log the end of a project build this event is raised to log the start of a target build this event is raised to log the end of a target build this event is raised to log the start of task execution this event is raised to log the end of task execution this event is raised to log a custom event this event is raised to log build status events, such as build/project/target/task started/stopped This event is raised to log that some event has occurred. It is raised on every event. This event is raised when telemetry is sent. Adds the specified logger to the set of loggers for this submission. Shuts down the loggers and removes them Sets the build started event for this event source if it hasn't already been set. Raises a message event to all registered loggers. sender of the event BuildMessageEventArgs Raises an error event to all registered loggers. sender of the event BuildErrorEventArgs Raises a warning event to all registered loggers. sender of the event BuildWarningEventArgs Raises a "build started" event to all registered loggers. sender of the event BuildStartedEventArgs Raises a "build finished" event to all registered loggers. sender of the event BuildFinishedEventArgs Raises a "project build started" event to all registered loggers. sender of the event ProjectStartedEventArgs Raises a "project build finished" event to all registered loggers. sender of the event ProjectFinishedEventArgs Raises a "target build started" event to all registered loggers. sender of the event TargetStartedEventArgs Raises a "target build finished" event to all registered loggers. sender of the event TargetFinishedEventArgs Raises a "task execution started" event to all registered loggers. sender of the event TaskStartedEventArgs Raises a "task finished executing" event to all registered loggers. sender of the event TaskFinishedEventArgs Raises a custom event to all registered loggers. sender of the event CustomBuildEventArgs Raises a catch-all build status event to all registered loggers. sender of the event BuildStatusEventArgs Raises a status event, optionally cascading to an any event. Raises a catch-all build event to all registered loggers. sender of the event Build EventArgs Raises a telemetry event to all registered loggers. Initialize the internal event source which is used to raise events on loggers registered to this submission Clears out all events. Structure to represent the information contained in Platform.xml Location of Platform.xml Constructor Takes the location of Platform.xml and populates the structure with manifest data Platform name Platform friendly name Platform version The platforms that this platform depends on. Item1: Platform name Item2: Platform version The contracts contained by this platform Item1: Contract name Item2: Contract version Flag set to true if an exception occurred while reading the manifest Message from exception thrown while reading manifest Load content of Platform.xml Represents a dependency on another platform Name of the platform on which this platform depends Version of the platform on which this platform depends Constructor Helper class with element names in Platform.xml Root element Element describing a platform this platform is dependent on Helper class with attribute names in Platform.xml Name associated with this element Friendly name associated with this element Version associated with this element Processor architecture utilities Represents the 32-bit x86 processor architecture. Represents the 64-bit IA64 processor architecture. Represents the 64-bit AMD64 processor architecture. Represents the Microsoft Intermediate Language processor architecture. Represents the ARM processor architecture. Represents the ARM64 processor architecture. Represents the WebAssembly platform. Represents the S390x processor architecture. Represents the LoongAarch64 processor architecture. Represents the 32-bit ARMv6 processor architecture. Represents the PowerPC 64-bit (little-endian) processor architecture. Lazy-initted property for getting the architecture of the currently running process Gets the processor architecture of the currently running process null if unknown architecture or error, one of the known architectures otherwise What should happen if multiple versions of a given productfamily or sdk name are found No action should be taken if multiple versions are detected Log warning Log an error Structure to represent the information contained in SDKManifest.xml Pattern in path to extension SDK used to help determine if manifest is from a framework SDK Default version of MaxPlatformVersion in framework extension SDKs with manifest not containing such a property Default version of MinOSVersion in framework extension SDKs with manifest not containing such a property Default version of MaxOSVersionTested in framework extension SDKs with manifest not containing such a property What should happen if this sdk is resolved with other sdks of the same productfamily or same sdk name. Path to where the file SDKManifest.xml is stored Whatever appx locations we found in the manifest Whatever framework identities we found in the manifest. Whatever MaxOSVersionTested we found in the manifest. Whatever MinOSVersion we found in the manifest Whatever MaxPlatformVersion we found in the manifest The SDKType, default of unspecified Constructor Takes the path to SDKManifest.xml and populates the structure with manifest data Whatever information regarding support for multiple versions is found in the manifest Whatever framework identities we found in the manifest. Whatever appx locations we found in the manifest PlatformIdentity if it exists in the appx manifest for this sdk. The FrameworkIdentity for the sdk, this may be a single name or a | delimited name Support Prefer32bit found in the sdk manifest SDKType found in the sdk manifest CopyRedistToSubDirectory specifies where the redist files should be copied to relative to the root of the package. Supported Architectures is a semicolon delimited list of architectures that the SDK supports. DependsOnSDK is a semicolon delimited list of SDK identities that the SDK requires be resolved in order to function. ProductFamilyName specifies the product family for the SDK. This is offered up as metadata on the resolved sdkreference and is used to detect sdk conflicts. The platform the SDK targets. Minimum version of the platform the SDK supports. Maximum version of the platform that the SDK supports. DisplayName found in the sdk manifest MinVSVersion found in the sdk manifest MinOSVersion found in the sdk manifest, defaults to 6.2.1 for framework extension SDKs when manifest does not have this property set MaxPlatformVersion found in the sdk manifest, defaults to 8.0 for framework extension SDKs when manifest does not have this property set MaxOSVersionTested found in the sdk manifest, defaults to 6.2.1 for framework extension SDKs when manifest does not have this property set MoreInfo as found in the sdk manifest Flag set to true if an exception occurred while reading the manifest Message from exception thrown while reading manifest The contracts contained by this manifest, if any Item1: Contract name Item2: Contract version Decide on whether it is a framework extension sdk based on manifest's FrameworkIdentify and path Load content of SDKManifest.xml Reads the attributes from the "FileList" element of the SDK manifest. Parse the multipleversions string. Returns MultipleVersionSupport.Allow if it cannot be parsed correctly. Helper class with attributes of SDKManifest.xml Platform that the SDK targets The minimum version of the platform that the SDK targets The max version of the platform that the SDK targets Framework Identity metadata name and manifest attribute Supported Architectures metadata name and manifest attribute Prefer32BitSupport metadata name and manifest attribute AppxLocation metadata APPX manifest attribute PlatformIdentity metadata name and manifest attribute SDKType metadata name and manifest attribute DisplayName metadata name and manifest attribute CopyRedistToSubDirectory metadata name and manifest attribute ProductFamilyName metadata name and manifest attribute SupportsMultipleVersions metadata name and manifest attribute TargetedSDKArchitecture metadata name TargetedSDKConfiguration metadata name ExpandReferenceAssemblies metadata name DependsOn metadata name CopyRedist metadata name CopyLocalExpandedReferenceAssemblies metadata name MinOSVersion metadata name MinVSVersion metadata name MaxPlatformVersionAttribute metadata name MoreInfoAttribute metadata name MaxOSVersionTestedAttribute metadata name Helper class with elements of SDKManifest.xml Root element Type of SDK Not specified Traditional 3rd party SDK Platform extension SDK Framework extension SDK Structure to represent a target platform sdk Path to the platform sdk may be null if not a platform sdk. Object containing the properties in the SDK manifest Cache for min Visual Studio version from manifest Cache for min OS version from manifest Constructor Min Visual Studio version from manifest Min OS version from manifest Target platform identifier Target platform version Path to target platform sdk if it exists, it may not if there is no target platform is installed The SDK's display name, or null if one is not defined. Extension sdks within this platform, Set of platforms supported by this SDK. Reference to manifest object Makes it is instantiated only once Override GetHashCode Override equals Implement IEquatable Returns true if this SDK supports the given platform, or false otherwise. Given an identifier and version, construct a string to use as a key for that combination. This helper base class provides default functionality for tasks. This class can only be instantiated in a derived form. Default (family) constructor. This (family) constructor allows derived task classes to register their resources. The task resources. This (family) constructor allows derived task classes to register their resources, as well as provide a prefix for composing help keywords from string resource names. If the prefix is an empty string, then string resource names will be used verbatim as help keywords. For an example of how the prefix is used, see the TaskLoggingHelper.LogErrorWithCodeFromResources(string, object[]) method. The task resources. The help keyword prefix. The build engine automatically sets this property to allow tasks to call back into it. The build engine interface available to tasks. The build engine automatically sets this property to allow tasks to call back into it. This is a convenience property so that task authors inheriting from this class do not have to cast the value from IBuildEngine to IBuildEngine2. The build engine interface available to tasks. Retrieves the version of the build engine interface provided by the host. Retrieves the version of the build engine interface provided by the host. Retrieves the version of the build engine interface provided by the host. Retrieves the version of the build engine interface provided by the host. Retrieves the version of the build engine interface provided by the host. Retrieves the version of the build engine interface provided by the host. Retrieves the version of the build engine interface provided by the host. The build engine sets this property if the host IDE has associated a host object with this particular task. The host object instance (can be null). Gets an instance of a TaskLoggingHelper class containing task logging methods. The taskLoggingHelper is a MarshallByRef object which needs to have MarkAsInactive called if the parent task is making the appdomain and marshaling this object into it. If the appdomain is not unloaded at the end of the task execution and the MarkAsInactive method is not called this will result in a leak of the task instances in the appdomain the task was created within. The logging helper object. Gets or sets the task's culture-specific resources. Derived classes should register their resources either during construction, or via this property, if they have localized strings. The task's resources (can be null). Gets or sets the prefix used to compose help keywords from string resource names. If a task does not have help keywords associated with its messages, it can ignore this property or set it to null. If the prefix is set to an empty string, then string resource names will be used verbatim as help keywords. For an example of how this prefix is used, see the TaskLoggingHelper.LogErrorWithCodeFromResources(string, object[]) method. The help keyword prefix string (can be null). Must be implemented by derived class. true, if successful This class represents a single item of the project, as it is passed into a task. TaskItems do not exactly correspond to item elements in project files, because then tasks would have access to data that wasn't explicitly passed into the task via the project file. It's not a security issue, but more just an issue with project file clarity and transparency. Note: This class has to be sealed. It has to be sealed because the engine instantiates it's own copy of this type and thus if someone were to extend it, they would not get the desired behavior from the engine. Surprisingly few of these Utilities TaskItems are created: typically several orders of magnitude fewer than the number of engine TaskItems. May be defined if we're copying this item from a pre-existing one. Otherwise, we simply don't know enough to set it properly, so it will stay null. Default constructor -- we need it so this type is COM-createable. This constructor creates a new task item, given the item spec. Assumes the itemspec passed in is escaped. The item-spec string. This constructor creates a new TaskItem, using the given item spec and metadata. Assumes the itemspec passed in is escaped, and also that any escapable metadata values are passed in escaped form. The item-spec string. Custom metadata on the item. This constructor creates a new TaskItem, using the given ITaskItem. The item to copy. Gets or sets the item-spec. This one is a bit tricky. Orcas assumed that the value being set was escaped, but that the value being returned was unescaped. Maintain that behaviour here. To get the escaped value, use ITaskItem2.EvaluatedIncludeEscaped. The item-spec string. Gets or sets the escaped include, or "name", for the item. Taking the opportunity to fix the property name, although this doesn't make it obvious it's an improvement on ItemSpec. Gets the names of all the item's metadata. List of metadata names. Gets the number of metadata set on the item. Count of metadata. Gets the metadata dictionary Property is required so that we can access the metadata dictionary in an item from another appdomain, as the CLR has implemented remoting policies that disallow accessing private fields in remoted items. Removes one of the arbitrary metadata on the item. Name of metadata to remove. Sets one of the arbitrary metadata on the item. Assumes that the value being passed in is in its escaped form. Name of metadata to set or change. Value of metadata. Retrieves one of the arbitrary metadata on the item. If not found, returns empty string. Returns the unescaped value of the metadata requested. The name of the metadata to retrieve. The metadata value. Copy the metadata (but not the ItemSpec) to destinationItem. If a particular metadata already exists on the destination item, then it is not overwritten -- the original value wins. The item to copy metadata to. Get the collection of custom metadata. This does not include built-in metadata. RECOMMENDED GUIDELINES FOR METHOD IMPLEMENTATIONS: 1) this method should return a clone of the metadata 2) writing to this dictionary should not be reflected in the underlying item. Returns an UNESCAPED version of the custom metadata. For the escaped version (which is how it is stored internally), call ITaskItem2.CloneCustomMetadataEscaped. Gets the item-spec. The item-spec string. Overridden to give this class infinite lease time. Otherwise we end up with a limited lease (5 minutes I think) and instances can expire if they take long time processing. This allows an explicit typecast from a "TaskItem" to a "string", returning the escaped ItemSpec for this item. The item to operate on. The item-spec of the item. Returns the escaped value of the metadata with the specified key. Sets the escaped value of the metadata with the specified name. Assumes the value is passed in unescaped. ITaskItem2 implementation which returns a clone of the metadata on this object. Values returned are in their original escaped form. The cloned metadata. Used to specify the targeted version of the .NET Framework for some methods of ToolLocationHelper. version 1.1 version 2.0 version 3.0 version 3.5 version 4.0 version 4.5 version 4.5.1 version 4.6 version 4.6.1 version 4.5.2. Enum is out of order because it was shipped out of band from a Visual Studio update without a corresponding SDK release. version 4.6.2 version 4.7 version 4.7.1 version 4.7.2 version 4.8 version 4.8.1 The latest version available at the time of major release. This value should not be updated in minor releases as it could be a breaking change. Use 'Latest' if possible, but note the compatibility implications. Sentinel value for the latest version that this version of MSBuild is aware of. Similar to VersionLatest except the compiled value in the calling application will not need to change for the update in MSBuild to be used. This value was introduced in Visual Studio 15.1. It is incompatible with previous versions of MSBuild. Used to specify the version of Visual Studio from which to select associated tools for some methods of ToolLocationHelper Visual Studio 2010 (Dev10) and SP1 Visual Studio 2012 (Dev11) Visual Studio 2013 (Dev12) Visual Studio 2015 (Dev14) Visual Studio 2017 (Dev15) Visual Studio 2019 (Dev16) Visual Studio 2022 (Dev17) The latest version available at the time of release Used to specify the targeted bitness of the .NET Framework for some methods of ToolLocationHelper Indicates the .NET Framework that is currently being run under. Indicates the 32-bit .NET Framework Indicates the 64-bit .NET Framework ToolLocationHelper provides utility methods for locating .NET Framework and .NET Framework SDK directories and files. NOTE: All public methods of this class are available to MSBuild projects for use in functions - they must be safe for use during project evaluation. Cache the results of reading the redist list so that we do not have to read the redist list over and over again to get the chains. Lock object to synchronize chainedReferenceAssemblyPath dictionary Cache the results of calling the GetPathToReferenceAssemblies so that we do not recalculate it every time we call the method Cache the frameworkName of the highest version of a framework given its root path and identifier. This is to optimize calls to GetHighestVersionOfTargetFramework Cache the sdk structure as found by enumerating the disk and registry. Cache new style extension sdks that we've enumerated Cache the display name for the TFM/FrameworkName, keyed by the target framework directory. This is generated by the "Name" attribute on the root tag of the primary matching redist list. Value is never an empty string or null: a name will be synthesized if necessary. Cache the set of target platform references for a particular combination of inputs. For legacy target platforms, this is just grabbing all winmds from the References\CommonConfiguration\Neutral folder; for OneCore-based platforms, this involves reading the list from Platform.xml and synthesizing the locations. Cache the set of extension Sdk references for a particular combination of inputs. Cache the list of supported frameworks Cache the VS Install folders for particular range of VS versions Character used to separate search paths specified for MSBuildExtensionsPath* in the config file Delegate to a method which takes a version enumeration and return a string path The current ToolsVersion. Get a sorted list of AssemblyFoldersExInfo which contain information about what directories the 3rd party assemblies are registered under for use during build and design time. This method will enumerate the AssemblyFoldersEx registry location and return a list of AssemblyFoldersExInfo in the same order in which they will be searched during both design and build time for reference assemblies. The root registry location for the targeted framework. For .NET this is SOFTWARE\MICROSOFT\.NETFramework The targeted framework version (2.0, 3.0, 3.5, 4.0, etc) The name of the folder (AssemblyFoldersEx) could also be PocketPC\AssemblyFoldersEx, or others Components may declare Min and Max OSVersions in the registry this value can be used filter directories returned based on whether or not the osversion is bounded by the Min and Max versions declared by the component. If this value is blank or null no filtering is done Components may declare platform guids in the registry this can be used to return only directories which have a certain platform guid. If this value is blank or null no filtering is done What processor architecture is being targeted. This determines which registry hives are searched in what order. On a 64 bit operating system we do the following If you are targeting 64 bit (target x64 or ia64) Add in the 64 bit hive first Add in the 32 bit hive second If you are not targeting a 64 bit Add in the 32 bit hive first Add in the 64 bit hive second On a 32 bit machine we only add in the 32 bit hive. List of AssemblyFoldersExInfo Get a sorted list of AssemblyFoldersFromConfigInfo which contain information about what directories the 3rd party assemblies are registered under for use during build and design time. This method will read the specified configuration file and enumerate the and return a list of AssemblyFoldersFromConfigInfo in the same order in which they will be searched during both design and build time for reference assemblies. Full path to the Assembly Folders config file. The targeted framework version (2.0, 3.0, 3.5, 4.0, etc). What processor architecture is being targeted. This determines which registry hives are searched in what order. On a 64 bit operating system we do the following If you are targeting 64 bit (target x64 or ia64) Add in the 64 bit assembly folders first Add in the 32 bit assembly folders second If you are not targeting a 64 bit Add in the 32 bit assembly folders first Add in the 64 bit assembly folders second On a 32 bit machine we only add in the 32 bit assembly folders. List of AssemblyFoldersFromConfigInfo Get a list of SDK's installed on the machine for a given target platform Targeted platform to find SDKs for Targeted platform version to find SDKs for IDictionary of installed SDKS and their location. K:SDKName V:SDK installation location Get a list of SDK's installed on the machine for a given target platform Array of disk locations to search for sdks Root registry location to look for sdks Targeted platform to find SDKs for Targeted platform version to find SDKs for IDictionary of installed SDKS and their location. K:SDKName V:SDK installation location Get a list of SDK's installed on the machine for a given target platform Array of disk locations to search for sdks New style extension SDK roots Root registry location to look for sdks Targeted platform to find SDKs for Targeted platform version to find SDKs for IDictionary of installed SDKS and their location. K:SDKName V:SDK installation location Get a list of SDK's installed on the machine for a given target platform Targeted platform to find SDKs for Targeted platform version to find SDKs for IDictionary of installed SDKS and their tuples containing (location, platform version). Set of installed SDKs and their location and platform versions Array of disk locations to search for sdks Root registry location to look for sdks Targeted platform to find SDKs for Targeted platform version to find SDKs for IDictionary of installed SDKS and their tuples containing (location, platform version). Set of installed SDKs and their location and platform versions Array of disk locations to search for sdks Array of disk locations to search for SDKs that target multiple versions Root registry location to look for sdks Targeted platform to find SDKs for Targeted platform version to find SDKs for IDictionary of installed SDKS and their tuples containing (location, platform version). Version may be null if the SDK targets multiple versions. Get target platform monikers used to extract ESDK information in the methods GetPlatformExtensionSDKLocationsAndVersions and GetPlatformExtensionSDKLocations Given an SDKName, targetPlatformIdentifier and TargetPlatformVersion search the default sdk locations for the passed in sdk name. The format of the sdk moniker is SDKName, Version=X.X Name of the SDK to determine the installation location for. Targeted platform to find SDKs for Targeted platform version to find SDKs for Location of the SDK if it is found, empty string if it could not be found Given an SDKName, targetPlatformIdentifier and TargetPlatformVersion search the default sdk locations for the passed in sdk name. The format of the sdk moniker is SDKName, Version=X.X Name of the SDK to determine the installation location for. Targeted platform to find SDKs for Targeted platform version to find SDKs for List of disk roots to search for sdks within Registry root to look for sdks within Location of the SDK if it is found, empty string if it could not be found Given an SDKName, targetPlatformIdentifier and TargetPlatformVersion search the default sdk locations for the passed in sdk name. The format of the sdk moniker is SDKName, Version=X.X Name of the SDK to determine the installation location for. Targeted platform to find SDKs for Targeted platform version to find SDKs for List of disk roots to search for sdks within List of disk roots to look for manifest driven extension sdks Registry root to look for sdks within Location of the SDK if it is found, empty string if it could not be found Given an SDK moniker and the targeted platform get the path to the SDK root if it exists. Moniker for the sdk Identifier for the platform Version of the platform A full path to the sdk root if the sdk exists in the targeted platform or an empty string if it does not exist. Given an SDKName, targetPlatformIdentifier and TargetPlatformVersion search the default sdk locations for the passed in sdk name. The format of the sdk moniker is SDKName, Version=X.X Name of the SDK to determine the installation location for. Targeted platform to find SDKs for Targeted platform version to find SDKs for List of disk roots to search for sdks within Registry root to look for sdks within Location of the SDK if it is found, empty string if it could not be found Given an SDKName, targetPlatformIdentifier and TargetPlatformVersion search the default sdk locations for the passed in sdk name. The format of the sdk moniker is SDKName, Version=X.X Name of the SDK to determine the installation location for. Targeted platform to find SDKs for Targeted platform version to find SDKs for List of disk roots to search for sdks within List of disk roots to look for manifest driven extension sdks Registry root to look for sdks within Location of the SDK if it is found, empty string if it could not be found Gets a dictionary containing a collection of extension SDKs and filter it based on the target platform version if max platform version isn't set in the extension sdk manifest, add the extension sdk to the filtered list A IDictionary collection of filtered extension SDKs Get the list of SDK folders which contains the references for the sdk at the sdkRoot provided in the order in which they should be searched for references. Root folder for the SDK A list of folders in the order which they should be used when looking for references in the SDK Get the list of SDK folders which contains the references for the sdk at the sdkRoot provided in the order in which they should be searched for references. Root folder for the SDK The configuration the SDK is targeting. This should be Debug or Retail The architecture the SDK is targeting A list of folders in the order which they should be used when looking for references in the SDK Add the set of paths for where sdk files should be found. Where <folderType> is redist, references, designtime Get the list of SDK folders which contains the redist files for the sdk at the sdkRoot provided in the order in which they should be searched for references. Root folder for the SDK must contain a redist folder A list of folders in the order which they should be used when looking for redist files in the SDK Get the list of SDK folders which contains the redist files for the sdk at the sdkRoot provided in the order in which they should be searched for references. Root folder for the SDK must contain a redist folder The configuration the SDK is targeting. This should be Debug or Retail The architecture the SDK is targeting A list of folders in the order which they should be used when looking for redist files in the SDK Get the list of SDK folders which contains the designtime files for the sdk at the sdkRoot provided in the order in which they should be searched for references. Root folder for the SDK must contain a Designtime folder A list of folders in the order which they should be used when looking for DesignTime files in the SDK Get the list of SDK folders which contains the DesignTime files for the sdk at the sdkRoot provided in the order in which they should be searched for references. Root folder for the SDK must contain a DesignTime folder The configuration the SDK is targeting. This should be Debug or Retail The architecture the SDK is targeting A list of folders in the order which they should be used when looking for DesignTime files in the SDK Get a list target platform sdks on the machine. List of Target Platform SDKs, Item1: TargetPlatformName Item2: Version of SDK Item3: Path to sdk root Get a list target platform sdks on the machine. List of disk locations to search for platform sdks Registry root location to look for platform sdks List of Target Platform SDKs Filter list of platform sdks based on minimum OS and VS versions List of platform sdks Operating System version. Pass null to not filter based on this parameter Visual Studio version. Pass null not to filter based on this parameter List of Target Platform SDKs Get the location of the target platform SDK props file for a given {SDKI, SDKV, TPI, TPMinV, TPV} combination. The OneCore SDK identifier that defines OnceCore SDK root The verision of the OneCore SDK Identifier for the targeted platform The min version of the targeted platform The version of the targeted platform Location of the target platform SDK props file without .props filename Get the location of the target platform SDK props file for a given {SDKI, SDKV, TPI, TPMinV, TPV} combination. The OneCore SDK identifier that defines OnceCore SDK root The verision of the OneCore SDK Identifier for the targeted platform The min version of the targeted platform The version of the targeted platform List of disk roots to search for sdks within Registry root to look for sdks within Location of the target platform SDK props file without .props filename Gathers the set of platform winmds for a particular {SDKI, SDKV, TPI, TPMinV, TPV} combination Gathers the set of platform winmds for a particular {SDKI, SDKV, TPI, TPMinV, TPV} combination Gathers the specified extension SDK references for the given target SDK The moniker is the Name/Version string. Example: "Windows Desktop, Version=10.0.0.1" The target SDK name. The target SDK version. The disk roots used to gather installed SDKs. The disk roots used to gather installed extension SDKs. The registry root used to gather installed extension SDKs. Gathers the specified extension SDK references for the given target SDK The moniker is the Name/Version string. Example: "Windows Desktop, Version=10.0.0.1" The target SDK name. The target SDK version. The target platform name. The target platform version. The disk roots used to gather installed SDKs. The disk roots used to gather installed extension SDKs. The registry root used to gather installed extension SDKs. Get platform version string which is used to generate versioned path The target SDK The target platform name. The target platform version. Return the version string if the platform is versioned, otherwise return empty string Gathers the set of platform winmds based on the assumption that they come from an SDK that is specified solely by TPI / TPV. Gathers the set of platform winmds for a particular {SDKI, SDKV, TPI, TPMinV, TPV} combination, based on the assumption that it is an SDK that has both {SDKI, SDKV} and TP* specifiers. Return the WinMD paths referenced by the given api contracts and target sdk root The API contract definitions The root of the target platform SDK List of matching WinMDs Return the WinMD paths referenced by the given api contracts and target sdk root The API contract definitions The root of the target platform SDK The version of the target platform SDK List of matching WinMDs Return the versioned/unversioned SDK content folder path The identifier of the SDK The verision of the SDK The identifier of the targeted platform The min version of the targeted platform The version of the targeted platform The content folder name under SDK path An optional disk root to search. A value should only be passed from a unit test. The SDK content folder path Given a target platform identifier and a target platform version search the default sdk locations for the platform sdk for the target platform. Targeted platform to find SDKs for Targeted platform version to find SDKs for Location of the SDK if it is found, empty string if it could not be found Given a target platform identifier and a target platform version search the default sdk locations for the platform sdk for the target platform. Targeted platform to find SDKs for Targeted platform version to find SDKs for List of disk roots to search for sdks within Registry root to look for sdks within Location of the SDK if it is found, empty string if it could not be found Given a target platform identifier and a target platform version search the default sdk locations for the platform sdk for the target platform. Identifier for the platform Version of the platform A full path to the sdk root if the sdk exists in the targeted platform or an empty string if it does not exist. Given a target platform identifier and a target platform version search the default sdk locations for the platform sdk for the target platform. Targeted platform to find SDKs for Targeted platform version to find SDKs for List of disk roots to search for sdks within Registry root to look for sdks within Location of the platform SDK if it is found, empty string if it could not be found Given a target platform identifier and version, get the display name for that platform SDK. Given a target platform identifier and version, get the display name for that platform SDK. Given an SDK identifier and an SDK version, return a list of installed platforms. SDK for which to find the installed platforms SDK version for which to find the installed platforms A list of keys for the installed platforms for the given SDK Given an SDK identifier and an SDK version, return a list of installed platforms. SDK for which to find the installed platforms SDK version for which to find the installed platforms List of disk roots to search for sdks within Registry root to look for sdks within A list of keys for the installed platforms for the given SDK Given an SDK Identifier and SDK version, return the latest installed platform. SDK for which to find the latest installed platform SDK version for which to find the latest installed platform The latest installed version for the given SDK Given an SDK Identifier and SDK version, return the latest installed platform. SDK for which to find the latest installed platform SDK version for which to find the latest installed platform SDK Root folders The latest installed version for the given SDK Returns folders in VS installs of specifid range of versions, starting with 15.0. Optional. If specified, only VS instances with this or bigger version will be included. Optional. If specified, only VS instances with smaller versions will be included. For instance, 16.0 means that only 15.* versions will be included. Optional. If specified, the returned list will contain [VSInstallDir][subFolder] paths Returns folders in VS installs in VS version descending order Returns folders in VS installs of specified range of versions (starting with 15.0) separated by ';'. Optional. If specified, only VS instances with this or bigger version will be included. Optional. If specified, only VS instances with smaller versions will be included. For instance, 16.0 means that only 15.* versions will be included. Optional. If specified, the returned list will contain [VSInstallDir][subFolder] paths Returns folders in VS installs in VS version descending order separated by ';' Finds first folder in the list which contains all given files. Returns an empty string if not found. Root folders separated by ';' Relative file paths to find under root folders, separated by ';'. The first root folder in the given list, which contains all files. Empty string if not found. Tries to parse the "version" out of a platformMoniker. PlatformMoniker, in the form "PlatformName, Version=version" The version of the platform, if the parse was successful - Else set to null True if parse was successful, false otherwise Given a target platform identifier and version and locations in which to search, find the TargetPlatformSDK object that matches. Given a target platform identifier and version and locations in which to search, find the TargetPlatformSDK object that matches. Given a target platform identifier and version, generate a reasonable default display name. Gets the fully qualified path to the system directory i.e. %SystemRoot%\System32 The system path. Returns the prefix of the .NET Framework version folder (e.g. "v2.0") Version of the targeted .NET Framework Returns the full name of the .NET Framework root registry key Version of the targeted .NET Framework Returns the full name of the .NET Framework SDK root registry key. When targeting .NET 3.5 or above, looks in the locations associated with Visual Studio 2010. If you wish to target the .NET Framework SDK that ships with Visual Studio Dev11 or later, please use the override that specifies a VisualStudioVersion. Version of the targeted .NET Framework Returns the full name of the .NET Framework SDK root registry key Version of the targeted .NET Framework Version of Visual Studio the requested SDK is associated with Name of the value of GetDotNetFrameworkRootRegistryKey that contains the SDK install root path. When targeting .NET 3.5 or above, looks in the locations associated with Visual Studio 2010. If you wish to target the .NET Framework SDK that ships with Visual Studio Dev11 or later, please use the override that specifies a VisualStudioVersion. Version of the targeted .NET Framework Name of the value of GetDotNetFrameworkRootRegistryKey that contains the SDK install root path Version of the targeted .NET Framework Version of Visual Studio the requested SDK is associated with Get a fully qualified path to the frameworks root directory. Version of the targeted .NET Framework Will return 'null' if there is no target frameworks on this machine. Get a fully qualified path to the framework's root directory. Version of the targeted .NET Framework Desired architecture, or DotNetFrameworkArchitecture.Current for the architecture this process is currently running under. Returns the path to the "bin" directory of the latest .NET Framework SDK. When targeting .NET 3.5 or above, looks in the locations associated with Visual Studio 2010. If you wish to target the .NET Framework SDK that ships with Visual Studio Dev11 or later, please use the override that specifies a VisualStudioVersion. Path string. Returns the path to the "bin" directory of the .NET Framework SDK. When targeting .NET 3.5 or above, looks in the locations associated with Visual Studio 2010. If you wish to target the .NET Framework SDK that ships with Visual Studio Dev11 or later, please use the override that specifies a VisualStudioVersion. Version of the targeted .NET Framework Path string. Returns the path to the .NET Framework SDK. The of the .NET Framework. The of Visual Studio. Returns the path to the reference assemblies location for the given framework version. Version of the targeted .NET Framework Path string. Returns the path to the reference assemblies location for the given target framework's standard libraries (i.e. mscorlib). This method will assume the requested ReferenceAssemblyRoot path will be the ProgramFiles directory specified by Environment.SpecialFolder.ProgramFiles In additon when the .NETFramework or .NET Framework targetFrameworkIdentifiers are seen and targetFrameworkVersion is 2.0, 3.0, 3.5 or 4.0 we will return the correctly chained reference assembly paths for the legacy .net frameworks. This chaining will use the existing GetPathToDotNetFrameworkReferenceAssemblies to build up the list of reference assembly paths. Identifier being targeted Version being targeted Profile being targeted When the frameworkName is null Collection of reference assembly locations. Returns the path to mscorlib and system.dll Identifier being targeted Version being targeted Profile being targeted What is the targeted platform, this is used to determine where we should look for the standard libraries. Note, this parameter is only used for .net frameworks less than 4.0 When the frameworkName is null Collection of reference assembly locations. Returns the path to mscorlib and system.dll Identifier being targeted Version being targeted Profile being targeted What is the targeted platform, this is used to determine where we should look for the standard libraries. Note, this parameter is only used for .net frameworks less than 4.0 Root directory where the target framework will be looked for. Uses default path if this is null When the frameworkName is null Collection of reference assembly locations. Returns the path to mscorlib and system.dll Identifier being targeted Version being targeted Profile being targeted What is the targeted platform, this is used to determine where we should look for the standard libraries. Note, this parameter is only used for .net frameworks less than 4.0 Root directory where the target framework will be looked for. Uses default path if this is null ';' separated list of paths that are looked up if the framework cannot be found in @targetFrameworkRootPath When the frameworkName is null Collection of reference assembly locations. Returns the paths to the reference assemblies location for the given target framework. This method will assume the requested ReferenceAssemblyRoot path will be the ProgramFiles directory specified by Environment.SpecialFolder.ProgramFiles In additon when the .NETFramework or .NET Framework targetFrameworkIdentifiers are seen and targetFrameworkVersion is 2.0, 3.0, 3.5 or 4.0 we will return the correctly chained reference assembly paths for the legacy .net frameworks. This chaining will use the existing GetPathToDotNetFrameworkReferenceAssemblies to build up the list of reference assembly paths. Identifier being targeted Version being targeted Profile being targeted When the frameworkName is null Collection of reference assembly locations. Returns the paths to the reference assemblies location for the given target framework. This method will assume the requested ReferenceAssemblyRoot path will be the ProgramFiles directory specified by Environment.SpecialFolder.ProgramFiles In additon when the .NETFramework or .NET Framework targetFrameworkIdentifiers are seen and targetFrameworkVersion is 2.0, 3.0, 3.5 or 4.0 we will return the correctly chained reference assembly paths for the legacy .net frameworks. This chaining will use the existing GetPathToDotNetFrameworkReferenceAssemblies to build up the list of reference assembly paths. Identifier being targeted Version being targeted Profile being targeted Root directory which will be used to calculate the reference assembly path. The references assemblies will be generated in the following way TargetFrameworkRootPath\TargetFrameworkIdentifier\TargetFrameworkVersion\SubType\TargetFrameworkSubType. Uses the default path if this is null. When the frameworkName is null Collection of reference assembly locations. Returns the paths to the reference assemblies location for the given target framework. This method will assume the requested ReferenceAssemblyRoot path will be the ProgramFiles directory specified by Environment.SpecialFolder.ProgramFiles In addition when the .NETFramework or .NET Framework targetFrameworkIdentifiers are seen and targetFrameworkVersion is 2.0, 3.0, 3.5 or 4.0 we will return the correctly chained reference assembly paths for the legacy .net frameworks. This chaining will use the existing GetPathToDotNetFrameworkReferenceAssemblies to build up the list of reference assembly paths. Identifier being targeted Version being targeted Profile being targeted Root directory which will be used to calculate the reference assembly path. The references assemblies will be generated in the following way TargetFrameworkRootPath\TargetFrameworkIdentifier\TargetFrameworkVersion\SubType\TargetFrameworkSubType. Uses the default path if this is null. ';' separated list of paths that are looked up if the framework cannot be found in When the frameworkName is null Collection of reference assembly locations. Returns the paths to the reference assemblies location for the given target framework. This method will assume the requested ReferenceAssemblyRoot path will be the ProgramFiles directory specified by Environment.SpecialFolder.ProgramFiles In additon when the .NETFramework or .NET Framework targetFrameworkIdentifiers are seen and targetFrameworkVersion is 2.0, 3.0, 3.5 or 4.0 we will return the correctly chained reference assembly paths for the legacy .net frameworks. This chaining will use the existing GetPathToDotNetFrameworkReferenceAssemblies to build up the list of reference assembly paths. Framework required When the frameworkName is null Collection of reference assembly locations. Call either the static method or the delegate. This is done purely for performance as the delegate is only required for ease of unit testing and since the methods being called are static this will be a non 0 cost to use delegates vs the static methods directly. Call either the static method or the delegate. This is done purely for performance as the delegate is only required for ease of unit testing and since the methods being called are static this will be a non 0 cost to use delegates vs the static methods directly. Generate the list of reference assembly paths for well known .net framework versions Target framework moniker class which contains the targetframeworkVersion A collection of strings which list the chained reference assembly paths with the highest version being first Returns the path to the "bin" directory of the .NET Framework SDK. Version of the targeted .NET Framework Version of Visual Studio the requested SDK is associated with Path string. Generate the key which will be used for the reference assembly cache so that multiple static methods will generate it in the same way. Create the shared cache if it is not null Do the correct chaining of .net 3.5, 3.0 and 2.0. Throw an exception if any of the chain is missing Do the correct chaining of .net 3.5, 3.0 and 2.0. Throw an exception if any of the chain is missing Check to see if .net 2.0 is installed Returns the paths to the reference assemblies location for the given framework version relative to a given targetFrameworkRoot. The method will not check to see if the path exists or not. Root directory which will be used to calculate the reference assembly path. The references assemblies will be generated in the following way TargetFrameworkRootPath\TargetFrameworkIdentifier\TargetFrameworkVersion\SubType\TargetFrameworkSubType. ';' separated list of paths that are looked up if the framework cannot be found in @targetFrameworkRootPath A frameworkName class which represents a TargetFrameworkMoniker. This cannot be null. Collection of reference assembly locations. Returns the paths to the reference assemblies location for the given framework version relative to a given targetFrameworkRoot. The method will not check to see if the path exists or not. Root directory which will be used to calculate the reference assembly path. The references assemblies will be generated in the following way TargetFrameworkRootPath\TargetFrameworkIdentifier\TargetFrameworkVersion\SubType\TargetFrameworkSubType. A frameworkName class which represents a TargetFrameworkMoniker. This cannot be null. Collection of reference assembly locations. Figures out a display name given the target framework details. This is the equivalent of the target framework moniker, but for display. If one cannot be found from the redist list file, a synthesized one is returned, so there is always a display name. Returns the paths to the reference assemblies location for the given framework version and properly chains the reference assemblies if required. Collection of reference assembly locations. Clear out the appdomain wide cache of Platform and Extension SDKs. Clear our the appdomain wide caches Remap some common architectures to a single one that will be in the SDK. Add the reference folder to the list of reference directories if it exists. Get the list of extension sdks for a given platform and version Gets new style extension SDKs (those that are under the target SDK name and version and are driven by manifest, not directory structure). Given a root disk location and the target platform properties find all of the SDKs installed in that location. Given a registry location enumerate the registry and find the installed SDKs. Gather the list of SDKs installed on the machine from the registry. Do not parallelize the getting of these entries, order is important, we want the first ones in to win. Get the disk locations to search for sdks under. This can be overridden by an environment variable Extract the disk roots from the environment Get the disk roots to search for both platform and extension sdks in. The environment variable can override the defaults. Get the disk roots to search for multi platform extension sdks in. The environment variable can override the defaults. Get the registry root to find sdks under. The registry can be disabled if we are in a checked in scenario Given a platform SDK object, populate its supported platforms. Take the path to a reference assembly directory which contains a RedistList folder which then contains a FrameworkList.xml file. We will read in the xml file and determine if it has an IncludedFramework element in the redist list. If it does it will calculate the path where the next link in the chain should be and return that path. Also, when reading the redist list, if any display name is found it will be cached, keyed off the path passed in. Return null if we could not chain due to an error or the path not being found. return String.Empty if there is no next element in the chain Get a fully qualified path to a file in the latest .NET Framework SDK. Error if the .NET Framework SDK can't be found. When targeting .NET 3.5 or above, looks in the locations associated with Visual Studio 2010. If you wish to target the .NET Framework SDK that ships with Visual Studio Dev11 or later, please use the override that specifies a VisualStudioVersion. File name to locate in the .NET Framework SDK directory Path string. Get a fully qualified path to a file in the .NET Framework SDK. Error if the .NET Framework SDK can't be found. When targeting .NET 3.5 or above, looks in the locations associated with Visual Studio 2010. If you wish to target the .NET Framework SDK that ships with Visual Studio Dev11 or later, please use the override that specifies a VisualStudioVersion. File name to locate in the .NET Framework SDK directory Version of the targeted .NET Framework Path string. Get a fully qualified path to a file in the .NET Framework SDK. Error if the .NET Framework SDK can't be found. File name to locate in the .NET Framework SDK directory Version of the targeted .NET Framework Version of Visual Studio the requested SDK is associated with Path string. Get a fully qualified path to a file in the .NET Framework SDK. Error if the .NET Framework SDK can't be found. File name to locate in the .NET Framework SDK directory Version of the targeted .NET Framework The required architecture of the requested file. Path string. Get a fully qualified path to a file in the .NET Framework SDK. Error if the .NET Framework SDK can't be found. File name to locate in the .NET Framework SDK directory Version of the targeted .NET Framework Version of Visual Studio The required architecture of the requested file. Path string. Get a fully qualified path to a file in the .NET Framework SDK. Error if the .NET Framework SDK can't be found. File name to locate in the .NET Framework SDK directory Version of the targeted .NET Framework Version of Visual Studio The required architecture of the requested file. If true, will follow the fallback pattern -- from requested architecture, to current architecture, to x86. Otherwise, if the requested architecture path doesn't exist, that's it -- no path will be returned. Gets the path to a sdk exe based on the processor architecture and the provided bin directory path. If the fileName cannot be found in the pathToSDK after the processor architecture has been taken into account a null is returned. Given a member of the DotNetFrameworkArchitecture enumeration, returns the equivalent ProcessorArchitecture string. Internal for Testing Purposes Only Returns the path to the Windows SDK for the desired .NET Framework and Visual Studio version. Note that this is only supported for a targeted .NET Framework version of 4.5 and above. Target .NET Framework version Version of Visual Studio associated with the SDK. Path to the appropriate Windows SDK location Returns the path to a file in the Windows SDK for the desired .NET Framework and Visual Studio version. Note that this is only supported for a targeted .NET Framework version of 4.5 and above. The name of the file being requested. Target .NET Framework version. Version of Visual Studio associated with the SDK. Path to the appropriate Windows SDK file Returns the path to a file in the Windows SDK for the desired .NET Framework and Visual Studio version and the desired architecture. Note that this is only supported for a targeted .NET Framework version of 4.5 and above. The name of the file being requested. Target .NET Framework version. Version of Visual Studio associated with the SDK. Desired architecture of the resultant file. Path to the appropriate Windows SDK file Returns the path to a file in the Windows SDK for the desired .NET Framework and Visual Studio version and the desired architecture. Note that this is only supported for a targeted .NET Framework version of 4.5 and above. The name of the file being requested. Target .NET Framework version. Version of Visual Studio associated with the SDK. Desired architecture of the resultant file. true to fallback, otherwise false. Path to the appropriate Windows SDK file Gets the path to a sdk exe based on the processor architecture and the provided bin directory path. If the fileName cannot be found in the pathToSDK after the processor architecture has been taken into account a null is returned. Given a ToolsVersion, return the path to the MSBuild tools for that ToolsVersion The ToolsVersion for which to get the tools path The tools path folder of the appropriate ToolsVersion if it exists, otherwise null. Given a ToolsVersion, return the path to the MSBuild tools for that ToolsVersion The ToolsVersion for which to get the tools path The architecture of the build tools location to get The tools path folder of the appropriate ToolsVersion if it exists, otherwise null. Given the name of a file and a ToolsVersion, return the path to that file in the MSBuild tools path for that ToolsVersion The file to find the path to The ToolsVersion in which to find the file The path to the file in the tools path folder of the appropriate ToolsVersion if it exists, otherwise null. Given the name of a file and a ToolsVersion, return the path to that file in the MSBuild tools path for that ToolsVersion The file to find the path to The ToolsVersion in which to find the file The architecture of the build tools file to get The path to the file in the tools path folder of the appropriate ToolsVersion if it exists, otherwise null. Get a fully qualified path to a file in the frameworks root directory. File name to locate in the .NET Framework directory Version of the targeted .NET Framework Will return 'null' if there is no target frameworks on this machine. Get a fully qualified path to a file in the frameworks root directory for the specified architecture. File name to locate in the .NET Framework directory Version of the targeted .NET Framework Desired architecture, or DotNetFrameworkArchitecture.Current for the architecture this process is currently running under. Will return 'null' if there is no target frameworks on this machine. Get a fully qualified path to a file in the system directory (i.e. %SystemRoot%\System32) File name to locate in the system directory Path string. Gets a IList of supported target framework monikers. list of supported target framework monikers This method will return the highest version of a target framework moniker based on the identifier. This method will only find full frameworks, this means no profiles will be returned. Will return the root location for the reference assembly directory under the program files directory. Converts a member of the Microsoft.Build.Utilities.DotNetFrameworkArchitecture enum to the equivalent member of the Microsoft.Build.Shared.DotNetFrameworkArchitecture enum. Given a string which may start with a "v" convert the string to a version object. Gets the installed framework identifiers Gets the installed versions for a given framework Get installed framework profiles returns the .NETFramework versions lessthanOrEqualTo 3.5 installed in the machine Only returns Fx versions lessthanOrEqualTo 3.5 if DNFx3.5 is installed Compares framework version strings of the format v4.1.2.3 major version and minor version are mandatory others are optional The return value from InitializeHostObject. This enumeration defines what action the ToolTask should take next, after we've tried to initialize the host object. This means that there exists an appropriate host object for this task, it can support all of the parameters passed in, and it should be invoked to do the real work of the task. This means that either there is no host object available, or that the host object is not capable of supporting all of the features required for this build. Therefore, ToolTask should fallback to an alternate means of doing the build, such as invoking the command-line tool. This means that the host object is already up-to-date, and no further action is necessary. This means that some of the parameters being passed into the task are invalid, and the task should fail immediately. Base class used for tasks that spawn an executable. This class implements the ToolPath property which can be used to override the default path. Protected constructor Protected constructor The resource manager for task resources Protected constructor The resource manager for task resources The help keyword prefix for task's messages The return code of the spawned process. If the task logged any errors, but the process had an exit code of 0 (success), this will be set to -1. When set to true, this task will yield the node when its task is executing. When set to true, the tool task will create a batch file for the command-line and execute that using the command-processor, rather than executing the command directly. When set to true, it passes /Q to the cmd.exe command line such that the command line does not get echo-ed on stdout A timeout to wait for a task to terminate before killing it. In milliseconds. Used to signal when a tool has been cancelled. This is the batch file created when UseCommandProcessor is set to true. The encoding set to the console code page. Implemented by the derived class. Returns a string which is the name of the underlying .EXE to run e.g. "resgen.exe" Only used by the ToolExe getter. Name of tool. Projects may set this to override a task's ToolName. Tasks may override this to prevent that. Project-visible property allows the user to override the path to the executable. Path to tool. Whether or not to use UTF8 encoding for the cmd file and console window. Values: Always, Never, Detect If set to Detect, the current code page will be used unless it cannot represent the Command string. In that case, UTF-8 is used. Array of equals-separated pairs of environment variables that should be passed to the spawned executable, in addition to (or selectively overriding) the regular environment block. Using this instead of EnvironmentOverride as that takes a Dictionary, which cannot be set from an MSBuild project. Project visible property that allows the user to specify an amount of time after which the task executable is terminated. Time-out in milliseconds. Default is (no time-out). Overridable property specifying the encoding of the response file, UTF8 by default Overridable method to escape content of the response file Overridable property specifying the encoding of the captured task standard output stream Console-based output uses the current system OEM code page by default. Note that we should not use Console.OutputEncoding here since processes we run don't really have much to do with our console window (and also Console.OutputEncoding doesn't return the OEM code page if the running application that hosts MSBuild is not a console application). Overridable property specifying the encoding of the captured task standard error stream Console-based output uses the current system OEM code page by default. Note that we should not use Console.OutputEncoding here since processes we run don't really have much to do with our console window (and also Console.OutputEncoding doesn't return the OEM code page if the running application that hosts MSBuild is not a console application). Gets the Path override value. The new value for the Environment for the task. Importance with which to log text from the standard error stream. Whether this ToolTask has logged any errors Task Parameter: Importance with which to log text from the standard out stream. Task Parameter: Importance with which to log text from the standard error stream. Should ALL messages received on the standard error stream be logged as errors. Importance with which to log text from in the standard out stream. The actual importance at which standard out messages will be logged. The actual importance at which standard error messages will be logged. Gets an instance of a private TaskLoggingHelper class containing task logging methods. This is necessary because ToolTask lives in a different assembly than the task inheriting from it and needs its own separate resources. The logging helper object. Gets an instance of a shared resources TaskLoggingHelper class containing task logging methods. This is necessary because ToolTask lives in a different assembly than the task inheriting from it and needs its own separate resources. The logging helper object. Overridable function called after in Gets the fully qualified tool name. Should return ToolExe if ToolTask should search for the tool in the system path. If ToolPath is set, this is ignored. Path string. Gets the working directory to use for the process. Should return null if ToolTask should use the current directory. This is a method rather than a property so that derived classes (like Exec) can choose to expose a public WorkingDirectory property, and it would be confusing to have two properties. Implemented in the derived class true, if successful Returns true if task execution is not necessary. Executed after ValidateParameters ToolTask is not incremental by default. When a derived class overrides SkipTaskExecution, then Question feature can take into effect. Returns a string with those switches and other information that can go into a response file. Called after ValidateParameters and SkipTaskExecution Returns a string with those switches and other information that can't go into a response file and must go directly onto the command line. Called after ValidateParameters and SkipTaskExecution Returns the command line switch used by the tool executable to specify the response file. Will only be called if the task returned a non empty string from GetResponseFileCommands Called after ValidateParameters, SkipTaskExecution and GetResponseFileCommands full path to the temporarily created response file Allows tool to handle the return code. This method will only be called with non-zero exitCode. The return value of this method will be used as the task return value We expect the tasks to override this method, if they support host objects. The implementation should call into the host object to perform the real work of the task. For example, for compiler tasks like Csc and Vbc, this method would call Compile() on the host object. The return value indicates success (true) or failure (false) if the host object was actually called to do the work. We expect tasks to override this method if they support host objects. The implementation should make sure that the host object is ready to perform the real work of the task. The return value indicates what steps to take next. The default is to assume that there is no host object provided, and therefore we should fallback to calling the command-line tool. Logs the actual command line about to be executed (or what the task wants the log to show) Descriptive message about what is happening - usually the command line to be executed. Logs the tool name and the path from where it is being run. The tool to Log. This is the actual tool being used, ie. if ToolExe has been specified it will be used, otherwise it will be ToolName The path from where the tool is being run. Figures out the path to the tool (including the .exe), either by using the ToolPath parameter, or by asking the derived class to tell us where it should be located. path to the tool, or null Creates a temporary response file for the given command line arguments. We put as many command line arguments as we can into a response file to prevent the command line from getting too long. An overly long command line can cause the process creation to fail. Command line arguments that cannot be put into response files, and which must appear on the command line, should not be passed to this method. The command line arguments that need to go into the temporary response file. [out] The command line switch for using the temporary response file, or null if the response file is not needed. The path to the temporary response file, or null if the response file is not needed. Initializes the information required to spawn the process executing the tool. The information required to start the process. We expect tasks to override this method if they need information about the tool process or its process events during task execution. Implementation should make sure that the task is started in this method. Starts the process during task execution. Fully populated instance representing the tool process to be started. A started process. This could be or another instance. Writes out a temporary response file and shell-executes the tool requested. Enables concurrent logging of the output of the tool. The computed path to tool executable on disk Command line arguments that should go into a temporary response file Command line arguments that should be passed to the tool executable directly exit code from the tool - if errors were logged and the tool has an exit code of zero, then we sit it to -1 Cancels the process executing the task by asking it to close nicely, then after a short period, forcing termination. Delete temporary file. If the delete fails for some reason (e.g. file locked by anti-virus) then the call will not throw an exception. Instead a warning will be logged, but the build will not fail. File to delete Handles all the notifications sent while the tool is executing. The notifications can be for tool output, tool time-out, or tool completion. The slightly convoluted use of the async stderr/stdout streams of the Process class is necessary because we want to log all our messages from the main thread, instead of from a worker or callback thread. Kills the given process that is executing the tool, because the tool's time-out period expired. Kills the specified process Confirms that the given process has really and truly exited. If the process is still finishing up, this method waits until it is done. This method is a hack, but it needs to be called after both Process.WaitForExit() and Process.Kill(). Logs all the messages that the tool wrote to stderr. The messages are read out of the stderr data queue. Logs all the messages that the tool wrote to stdout. The messages are read out of the stdout data queue. Logs all the messages that the tool wrote to either stderr or stdout. The messages are read out of the given data queue. This method is a helper for the () and () methods. Calls a method on the TaskLoggingHelper to parse a single line of text to see if there are any errors or warnings in canonical format. This can be overridden by the derived class if necessary. Signals when the tool times-out. The tool timer calls this method when the time-out period on the tool expires. This method is used as a System.Threading.TimerCallback delegate. Signals when the tool exits. The Process object executing the tool calls this method when the tool exits. This method is used as a System.EventHandler delegate. Queues up the output from the stderr stream of the process executing the tool, and signals the availability of the data. The Process object executing the tool calls this method for every line of text that the tool writes to stderr. This method is used as a System.Diagnostics.DataReceivedEventHandler delegate. Queues up the output from the stdout stream of the process executing the tool, and signals the availability of the data. The Process object executing the tool calls this method for every line of text that the tool writes to stdout. This method is used as a System.Diagnostics.DataReceivedEventHandler delegate. Queues up the output from either the stderr or stdout stream of the process executing the tool, and signals the availability of the data. This method is a helper for the () and () methods. Assign the importances that will be used for stdout/stderr logging of messages from this tool task. This takes into account (1 is highest precedence): 1. the override value supplied as a task parameter. 2. those overridden by any derived class and 3. the defaults given by tooltask Looks for the given file in the system path i.e. all locations in the %PATH% environment variable. The location of the file, or null if file not found. This method invokes the tool with the given parameters. true, if task executes successfully Replace backslashes with OS-specific path separators, except when likely that the backslash is intentional. Not a static method so that an implementation can override with more-specific knowledge of what backslashes are likely to be correct. Log a single environment variable that's about to be applied to the tool An object to hold the event shutdown lock Splitter for environment variables The actual importance at which standard out messages will be logged The actual importance at which standard error messages will be logged Holds the stderr output from the tool. This collection is NOT thread-safe. Holds the stdout output from the tool. This collection is NOT thread-safe. Used for signalling when the tool writes to stderr. Used for signalling when the tool writes to stdout. Used for signalling when the tool exits. Set to true if the tool process was terminated, either because the timeout was reached or it was canceled. Used for signalling when the tool times-out. Used for timing-out the tool. Used to support overriding the toolExe name. Set when the events are about to be disposed, so that tardy calls on the event handlers don't try to reset a disposed event List of name, value pairs to be passed to the spawned tool's environment. May be null. Enumeration which indicates what kind of queue is being passed Check that the given composite root contains all entries in the composite sub root The root to look for all sub roots in The root that is comprised of subroots to look for This method checks that the specified files exist. During the scan the most recent file write time of all the outputs is remembered. It will be the basis for up to date comparisons. The files being checked for existence. The TaskLoggingHelper used to log the nonexistent files. Name of the most recently modified file. Timestamp of the most recently modified file. True if all members of 'files' exist, false otherwise This method checks that the specified files exist. During the scan the least recent file write time of all the outputs is remembered. It will be the basis for up to date comparisons. The files being checked for existence. The TaskLoggingHelper used to log the nonexistent files. Name of the least recently modified file. Timestamp of the least recently modified file. True if all members of 'files' exist, false otherwise This class is the filetracking log interpreter for .read. tracking logs in canonical form or those that have been rooted (^) to make them canonical Gets the current dependency table. Constructor for multiple input source files The .read. tlog files to interpret The primary source files to interpret dependencies for The output files produced by compiling this set of sources WARNING: Minimal rebuild optimization requires 100% accurate computed outputs to be specified! True to keep composite rooting markers around (many-to-one case) or false to shred them (one-to-one or one-to-many case) Constructor for multiple input source files The .read. tlog files to interpret The primary source files to interpret dependencies for The set of paths that contain files that are to be ignored during up to date check The output files produced by compiling this set of sources WARNING: Minimal rebuild optimization requires 100% accurate computed outputs to be specified! True to keep composite rooting markers around (many-to-one case) or false to shred them (one-to-one or one-to-many case) Constructor for multiple input source files The task that is using file tracker The .read. tlog files to interpret The primary source files to interpret dependencies for The set of paths that contain files that are to be ignored during up to date check The output files produced by compiling this set of sources WARNING: Minimal rebuild optimization requires 100% accurate computed outputs to be specified! True to keep composite rooting markers around (many-to-one case) or false to shred them (one-to-one or one-to-many case) Constructor for multiple input source files The task that is using file tracker The .read. tlog files to interpret The primary source files to interpret dependencies for The set of paths that contain files that are to be ignored during up to date check The output files produced by compiling this set of sources WARNING: Minimal rebuild optimization requires 100% accurate computed outputs to be specified! True to keep composite rooting markers around (many-to-one case) or false to shred them (one-to-one or one-to-many case) Constructor for a single input source file The task that is using file tracker The .read. tlog files to interpret The primary source file to interpret dependencies for The set of paths that contain files that are to be ignored during up to date check The output files produced by compiling this source WARNING: Minimal rebuild optimization requires 100% accurate computed outputs to be specified! True to keep composite rooting markers around (many-to-one case) or false to shred them (one-to-one or one-to-many case) Common internal constructor The task that is using file tracker The .read. tlog files to interpret The primary source files to interpret dependencies for The output files produced by compiling this set of sources The output files. The set of paths that contain files that are to be ignored during up to date check WARNING: Minimal rebuild optimization requires 100% accurate computed outputs to be specified! True to keep composite rooting markers around (many-to-one case) or false to shred them (one-to-one or one-to-many case) This method computes the sources that need to be compiled based on the output files and the full dependency graph of inputs Array of files that need to be compiled This method computes the sources that need to be compiled based on the output files and the full dependency graph of inputs, optionally searching composite rooting markers for subroots that may contain input files Array of files that need to be compiled This method computes the sources that need to be compiled based on the output files and the full dependency graph of inputs, making the assumption that the source files are all primary files -- ie. there is either a one-to-one or a one-to-many correspondence between inputs and outputs Array of files that need to be compiled Check to see if the source specified needs compilation relative to its outputs A very simple comparer for TaskItems so that up to date check results can be sorted. This method computes the sources that need to be compiled based on the output files and the full dependency graph of inputs, making the assumption that the source files are the components of a composite rooting marker, as in the case where there is a many-to-one correspondence between inputs and outputs. Array of files that need to be compiled Given a composite output rooting marker, gathers up all the sources it depends on. Check if the source file needs to be compiled The primary dependency bool Test to see if the specified file is excluded from tracked dependency checking Full path of the file to test Construct our dependency table for our source files. This method will re-write the tlogs from the current output table new entries will be tracked. This method will re-write the tlogs from the current dependency. As the sources are compiled, new entries willbe tracked. Delegate used to determine whether a particular file should be included in the compacted tlog. Remove the output graph entries for the given sources and corresponding outputs Source that should be removed from the graph Remove the output graph entries for the given sources and corresponding outputs Sources that should be removed from the graph Remove the entry in the input dependency graph corresponding to the rooting marker passed in. The root to remove Remove the output graph entries for the given sources and corresponding outputs Sources that should be removed from the graph A to remove as a dependency. Remove the output graph entries for the given source and corresponding outputs Source that should be removed from the graph A to remove as a dependency. Remove the output graph entries for the given sources and corresponding outputs The rooting marker that should be removed from the graph A to remove as a dependency. Remove the output graph entries for the given sources and corresponding outputs Source that should be removed from the graph Remove the output graph entries for the given sources and corresponding outputs Source that should be removed from the graph Output that correspond ot the sources (used for same file processing) Remove the output graph entries for the given sources and corresponding outputs Sources that should be removed from the graph Remove the output graph entries for the given sources and corresponding outputs Sources that should be removed from the graph Outputs that correspond ot the sources (used for same file processing) Remove the output graph entries for the given rooting marker The cache used to store whether each file exists or not. This class is the filetracking log interpreter for .write. tracking logs in canonical form Canonical .write. logs need to be rooted, since the outputs need to be associated with an input. Gets the dependency table. Constructor The .write. tlog files to interpret Constructor The task that is using file tracker The .write. tlog files to interpret Constructor The task that is using file tracker The .write. tlog files to interpret The output graph is built from the .write. tlogs Internal constructor The task that is using file tracker The .write. tlog files to interpret The output graph is built from the .write. tlogs Construct our dependency table for our source files Given a set of sources, removes from the dependency graph any roots that share the same outputs as the rooting marker constructed from the given set of sources. Used when there's a possibility that more than one set of inputs may produce the same output -- this is a way to invalidate any other roots that produce that same outputs, so that the next time the task is run with that other set of inputs, it won't incorrectly believe that it is up-to-date. The set of sources that form the rooting marker whose outputs should not be shared by any other rooting marker. An array of the rooting markers that were removed. Remove the specified ouput from the dependency graph for the given source file The source file who's output is to be discarded The output path to be removed This method determines the outputs for a source root (as in the contents of a rooting marker) The sources to find outputs for Array of outputs for the source This method determines the outputs for a source root (as in the contents of a rooting marker) The sources to find outputs for Array of outputs for the source This method determines the outputs for a source root (as in the contents of a rooting marker) The sources to find outputs for When set true, this will consider using outputs found in rooting markers that are composed of the sub-root. Array of outputs for the source This method determines the outputs for a source root (as in the contents of a rooting marker) List of outputs to populate The source to gather outputs for This method adds computed outputs for the given source key to the output graph The source to add outputs for The computed outputs for this source key This method adds computed outputs for the given source key to the output graph The source to add outputs for The computed outputs for this source key This method adds computed outputs for the given source key to the output graph The source to add outputs for The computed outputs for this source key This method returns the output dictionary for the given source key if non exists, one is created The source to retrieve outputs for This method adds a computed output for the given source key to the dictionary specified The dictionary to add outputs to The computed outputs for this source key This method will re-write the tlogs from the current output table new entries will be tracked. This method will re-write the tlogs from the current output table new entries will be tracked. Remove the output graph entries for the given sources and corresponding outputs Sources that should be removed from the graph Remove the output graph entries for the given sources and corresponding outputs Sources that should be removed from the graph Outputs that correspond ot the sources (used for same file processing) Remove the output graph entries for the given sources and corresponding outputs Sources that should be removed from the graph Remove the output graph entries for the given sources and corresponding outputs Sources that should be removed from the graph Outputs that correspond ot the sources (used for same file processing) Remove the output graph entries for the given sources and corresponding outputs Sources that should be removed from the graph The dependency to remove. Remove the output graph entries for the given source and corresponding outputs Source that should be removed from the graph The dependency to remove. Remove the output graph entries for the given sources and corresponding outputs Sources that should be removed from the graph The dependency to remove. Remove the output graph entries for the given sources and corresponding outputs Source that should be removed from the graph Remove the output graph entries for the given sources and corresponding outputs Source that should be removed from the graph Output that correspond ot the sources (used for same file processing) Remove the output graph entries for the given sources and corresponding outputs Sources that should be removed from the graph Remove the output graph entries for the given sources and corresponding outputs Sources that should be removed from the graph Outputs that correspond ot the sources (used for same file processing) Remove the output graph entries for the given rooting marker The cache used to store whether each file exists or not. A static cache that will hold the dependency graph as built from tlog files. The cache is keyed on the root marker created from the full paths of the tlog files concerned. As an entry is added to the cache so is the datetime it was added. The dictionary that maps the root of the tlog filenames to the dependencytable built from their content Determine if a cache entry is up to date The cache entry to check true if up to date Get the cached entry for the given tlog set, if the table is out of date it is removed from the cache The rooting marker for the set of tlogs The cached table entry Given a set of TLog names, formats a rooting marker from them, that additionally replaces all PIDs and TIDs with "[ID]" so the cache doesn't get overloaded with entries that should be basically the same but have different PIDs or TIDs in the name. The set of tlogs to format The normalized rooting marker based on that set of tlogs Given a TLog path, replace all PIDs and TIDs with "[ID]" in the filename, where the typical format of a filename is "tool[.PID][-tool].read/write/command/delete.TID.tlog" The algorithm used finds all instances of .\d+. and .\d+- in the filename and translates them to .[ID]. and .[ID]- respectively, where "filename" is defined as the part of the path following the final '\' in the path. In the VS 2010 C++ project system, there are artificially constructed tlogs that instead follow the pattern "ProjectName.read/write.1.tlog", which means that one result of this change is that such tlogs, should the project name also contain this pattern (e.g. ClassLibrary.1.csproj), will also end up with [ID] being substituted for digits in the project name itself -- so the tlog name would end up being ClassLibrary.[ID].read.[ID].tlog, rather than ClassLibrary.1.read.[ID].tlog. This could potentially cause issues if there are multiple projects differentiated only by the digits in their names; however we believe this is not an interesting scenario to watch for and support, given that the resultant rooting marker is constructed from full paths, so either: - The project directories are also different, and are never substituted, leading to different full paths (e.g. C:\ClassLibrary.1\Debug\ClassLibrary.[ID].read.[ID].tlog and C:\ClassLibrary.2\Debug\ClassLibrary.[ID].read.[ID].tlog) - The project directories are the same, in which case there are two projects that share the same intermediate directory, which has a host of other problems and is explicitly NOT a supported scenario. The tlog path to normalize The normalized path EqualityComparer for ITaskItems that only looks at the itemspec Returns whether the two ITaskItems are equal, where they are judged to be equal as long as the itemspecs, compared case-insensitively, are equal. Returns the hashcode of this ITaskItem. Given that equality is judged solely based on the itemspec, the hash code for this particular comparer also only uses the itemspec to make its determination. A cache entry Construct a new entry The tlog files used to build this dependency table The dependency table to be cached Enumeration to express the type of executable being wrapped by Tracker.exe. 32-bit native executable. 64-bit native executable. A managed executable without a specified bitness. A managed executable specifically marked as 32-bit. A managed executable specifically marked as 64-bit. Use the same bitness as the currently running executable. 64-bit native ARM64 executable. 64-bit managed ARM64 executable. This class contains utility functions to encapsulate launching and logging for the Tracker The default path to temp, used to create explicitly short and long paths. This must be the base system-wide temp path because we use it to filter out I/O of tools outside of our control. Tools running under the tracker may put temp files in the temp base or in a sub-directory of their choosing. Stops tracking file accesses. Resume tracking file accesses in the current tracking context. Set the global thread count, and assign that count to the current thread. Starts tracking file accesses. The directory into which to write the tracking log files The name of the task calling this function, used to determine the names of the tracking log files Starts tracking file accesses, using the rooting marker in the response file provided. To automatically generate a response file given a rooting marker, call FileTracker.CreateRootingMarkerResponseFile. The directory into which to write the tracking log files The name of the task calling this function, used to determine the names of the tracking log files The path to the root marker response file. Stop tracking file accesses and get rid of the current tracking contexts. Temporarily suspend tracking of file accesses in the current tracking context. Write tracking logs for all contexts and threads. The directory into which to write the tracking log files The name of the task calling this function, used to determine the names of the tracking log files Write tracking logs corresponding to the current tracking context. The directory into which to write the tracking log files The name of the task calling this function, used to determine the names of the tracking log files Test to see if the specified file is excluded from tracked dependencies Full path of the file to test Test to see if the specified file is under the specified path Full path of the file to test Is the file under this full path? Construct a rooting marker string from the ITaskItem array of primary sources. An containing information about the primary source. Construct a rooting marker string from the ITaskItem array of primary sources. An containing information about the primary source. An containing information about the output. Construct a rooting marker string from the ITaskItem array of primary sources. ITaskItem array of primary sources. Construct a rooting marker string from the ITaskItem array of primary sources. ITaskItem array of primary sources. ITaskItem array of outputs. Given a set of source files in the form of ITaskItem, creates a temporary response file containing the rooting marker that corresponds to those sources. ITaskItem array of primary sources. The response file path. Given a rooting marker, creates a temporary response file with that rooting marker in it. The rooting marker to put in the response file. The response file path. Prepends the path to the appropriate FileTracker assembly to the PATH environment variable. Used for inproc tracking, or when the .NET Framework may not be on the PATH. The old value of PATH Prepends the path to the appropriate FileTracker assembly to the PATH environment variable. Used for inproc tracking, or when the .NET Framework may not be on the PATH. The root path for FileTracker.dll. Overrides the toolType if specified. The old value of PATH Searches %PATH% for the location of Tracker.exe, and returns the first path that matches. The full path to Tracker.exe, or if a matching path is not found. Determines whether we must track out-of-proc, or whether inproc tracking will work. The executable type for the tool being tracked True if we need to track out-of-proc, false if inproc tracking is OK Determines whether we must track out-of-proc, or whether inproc tracking will work. The executable type for the tool being tracked An optional assembly name. The name of the cancel event tracker should listen for, or null if there isn't one True if we need to track out-of-proc, false if inproc tracking is OK Given the ExecutableType of the tool being wrapped and information that we know about our current bitness, figures out and returns the path to the correct Tracker.exe. The of the tool being wrapped Given the ExecutableType of the tool being wrapped and information that we know about our current bitness, figures out and returns the path to the correct Tracker.exe. The of the tool being wrapped The root path for Tracker.exe. Overrides the toolType if specified. Given the ExecutableType of the tool being wrapped and information that we know about our current bitness, figures out and returns the path to the correct FileTracker.dll. The of the tool being wrapped Given the ExecutableType of the tool being wrapped and information that we know about our current bitness, figures out and returns the path to the correct FileTracker.dll. The of the tool being wrapped The root path for FileTracker.dll. Overrides the toolType if specified. Given a filename (only really meant to support either Tracker.exe or FileTracker.dll), returns the appropriate path for the appropriate file type. The root path for the file. Overrides the toolType if specified. Given a filename (currently only Tracker.exe and FileTracker.dll are supported), return the path to that file. This method constructs the correct Tracker.exe response file arguments from its parameters The name of the dll that will do the tracking Intermediate directory where tracking logs will be written Rooting marker The arguments as a string This method constructs the correct Tracker.exe response file arguments from its parameters The name of the dll that will do the tracking Intermediate directory where tracking logs will be written Rooting marker If a cancel event has been created that Tracker should be listening for, its name is passed here The arguments as a string This method constructs the correct Tracker.exe command arguments from its parameters The command to track The command to track's arguments The arguments as a string This method constructs the correct Tracker.exe arguments from its parameters The command to track The command to track's arguments The name of the dll that will do the tracking Intermediate directory where tracking logs will be written Rooting marker The arguments as a string This method constructs the correct Tracker.exe arguments from its parameters The command to track The command to track's arguments The name of the dll that will do the tracking Intermediate directory where tracking logs will be written Rooting marker If a cancel event has been created that Tracker should be listening for, its name is passed here The arguments as a string Start the process; tracking the command. The command to track The command to track's arguments The type of executable the wrapped tool is The name of the dll that will do the tracking Intermediate directory where tracking logs will be written Rooting marker If Tracker should be listening on a particular event for cancellation, pass its name here Process instance Start the process; tracking the command. The command to track The command to track's arguments The type of executable the wrapped tool is The name of the dll that will do the tracking Intermediate directory where tracking logs will be written Rooting marker Process instance Start the process; tracking the command. The command to track The command to track's arguments The type of executable the wrapped tool is Intermediate directory where tracking logs will be written Rooting marker Process instance Start the process; tracking the command. The command to track The command to track's arguments The type of executable the wrapped tool is Rooting marker Process instance Start the process; tracking the command. The command to track The command to track's arguments The type of executable the wrapped tool is Process instance Logs a message of the given importance using the specified resource string. To the specified Log. This method is not thread-safe. The Log to log to. The importance level of the message. The name of the string resource to load. Optional arguments for formatting the loaded string. Thrown when messageResourceName is null. Logs a message of the given importance using the specified string. This method is not thread-safe. The Log to log to. The importance level of the message. The message string. Optional arguments for formatting the message string. Thrown when message is null. Logs a warning using the specified resource string. The Log to log to. The name of the string resource to load. Optional arguments for formatting the loaded string. Thrown when messageResourceName is null. Dependency filter delegate. Used during TLog saves in order for tasks to selectively remove dependencies from the written graph. The full path to the dependency file about to be written to the compacted TLog If the file should actually be written to the TLog (true) or not (false) Class used to store and interrogate inputs and outputs recorded by tracking operations. Missing files have been detected in the TLog The path for the oldest file we have seen The time for the oldest file we have seen The time for the oldest file we have seen The path for the newest file we have seen The time for the newest file we have seen The time for the newest file we have seen Should root markers in the TLog be treated as file accesses, or only as markers? Should files in the TLog but no longer exist be skipped or recorded? The TLog files that back this structure The time of the newest Tlog The time of the newest Tlog The path of the newest TLog file Are all the TLogs that were passed to us actually available on disk? Constructor The .write. tlog files to interpret The DateTime that should be recorded for missing file. Constructor The .write. tlog files to interpret The .tlog files to ignore The DateTime that should be recorded for missing file. Constructor The .tlog files to interpret The .tlog files to ignore The DateTime that should be recorded for missing file. The set of paths that contain files that are to be ignored during up to date check, including any subdirectories. Cache to be used for all timestamp/exists comparisons, which can be shared between multiple FlatTrackingData instances. Constructor The .tlog files to interpret The .tlog files to ignore The DateTime that should be recorded for missing file. The set of paths that contain files that are to be ignored during up to date check, including any subdirectories. Cache to be used for all timestamp/exists comparisons, which can be shared between multiple FlatTrackingData instances. Add root markers as inputs. Constructor The task that is using file tracker The tlog files to interpret The DateTime that should be recorded for missing file. Constructor The .write. tlog files to interpret Ignore files that do not exist on disk Constructor The task that is using file tracker The tlog files to interpret Ignore files that do not exist on disk Internal constructor The task that is using file tracker The local .tlog files. The .tlog files to ignore Ignore files that do not exist on disk The DateTime that should be recorded for missing file. The set of paths that contain files that are to be ignored during up to date check Construct our dependency table for our source files Update the current state of entry details for the dependency table Test to see if the specified file is excluded from tracked dependency checking Full path of the file to test The file is excluded if it is within any of the specified excluded input paths or any subdirectory of the paths. It also assumes the file name is already converted to Uppercase Invariant. Record the time and missing state of the entry in the tlog This method will re-write the tlogs from the output table This method will re-write the tlogs from the current table Returns cached value for last write time of file. Update the cache if it is the first time someone asking for that file Checks to see if the tracking data indicates that everything is up to date according to UpToDateCheckType. Note: If things are not up to date, then the TLogs are compacted to remove all entries in preparation to re-track execution of work. The host UpToDateCheckType The array of read tlogs The array of write tlogs Simple check of up to date state according to the tracking data and the UpToDateCheckType. Note: No tracking log compaction will take place when using this overload TaskLoggingHelper from the host task UpToDateCheckType to use FlatTrackingData structure containing the inputs FlatTrackingData structure containing the outputs Once tracked operations have been completed then we need to compact / finalize the Tlogs based on the success of the tracked execution. If it fails, then we clean out the TLogs. If it succeeds then we clean temporary files from the TLogs and re-write them. The possible types of up to date check that we can support The input is newer than the output. The input or output are newer than the tracking file. The input is newer than the tracking file. This class contains utility functions to assist with tracking dependencies Expand wildcards in the item list. Array of items expanded This method checks that all the files exist bool Helper logging class - contains all the logging methods used by tasks. A TaskLoggingHelper object is passed to every task by MSBuild. For tasks that derive from the Task class, it is provided in the Log property. This class is thread safe: tasks can log from any threads. public constructor task containing an instance of this class Public constructor which can be used by task factories to assist them in logging messages. A client sponsor is a class which will respond to a lease renewal request and will increase the lease time allowing the object to stay in memory Object to make this class thread-safe. Gets the name of the parent task. Task name string. Gets the upper-case version of the parent task's name. Upper-case task name string. The build engine we are going to log against Shortcut property for getting our build engine - we retrieve it from the task instance Used to load culture-specific resources. Derived classes should register their resources either during construction, or via this property, if they have localized strings. Gets or sets the prefix used to compose help keywords from string resource names. The help keyword prefix string. Has the task logged any errors through this logging helper object? Extracts the message code (if any) prefixed to the given message string. Message code prefixes must match the following .NET regular expression in order to be recognized: ^\s*[A-Za-z]+\d+:\s* Thread safe. If this method is given the string "MYTASK1001: This is an error message.", it will return "MYTASK1001" for the message code, and "This is an error message." for the message. The message to parse. The message with the code prefix removed (if any). The message code extracted from the prefix, or null if there was no code. Thrown when message is null. Loads the specified resource string and optionally formats it using the given arguments. The current thread's culture is used for formatting. Requires the owner task to have registered its resources either via the Task (or TaskMarshalByRef) base class constructor, or the Task.TaskResources (or AppDomainIsolatedTask.TaskResources) property. Thread safe. The name of the string resource to load. Optional arguments for formatting the loaded string. The formatted string. Thrown when resourceName is null. Thrown when the string resource indicated by resourceName does not exist. Thrown when the TaskResources property of the owner task is not set. Formats the given string using the variable arguments passed in. The current thread's culture is used for formatting. Thread safe. The string to format. Arguments for formatting. The formatted string. Thrown when unformatted is null. Get the message from resource in task library. Thread safe. The resource name. The message from resource. Returns if the build is configured to log all task inputs. Returns true if a message of given importance should be logged because it is possible that a logger consuming it exists. The importance to check. True if messages of the given importance should be logged, false if it's guaranteed that such messages would be ignored. Logs a message using the specified string. Thread safe. The message string. Optional arguments for formatting the message string. Thrown when message is null. Logs a message of the given importance using the specified string. Thread safe. Take care to order the parameters correctly or the other overload will be called inadvertently. The importance level of the message. The message string. Optional arguments for formatting the message string. Thrown when message is null. Logs a message using the specified string and other message details. Thread safe. Description of the warning type (can be null). Message code (can be null) The help keyword for the host IDE (can be null). The path to the file causing the message (can be null). The line in the file causing the message (set to zero if not available). The column in the file causing the message (set to zero if not available). The last line of a range of lines in the file causing the message (set to zero if not available). The last column of a range of columns in the file causing the message (set to zero if not available). Importance of the message. The message string. Optional arguments for formatting the message string. Thrown when message is null. Logs a critical message using the specified string and other message details. Thread safe. Description of the warning type (can be null). Message code (can be null). The help keyword for the host IDE (can be null). The path to the file causing the message (can be null). The line in the file causing the message (set to zero if not available). The column in the file causing the message (set to zero if not available). The last line of a range of lines in the file causing the message (set to zero if not available). The last column of a range of columns in the file causing the message (set to zero if not available). The message string. Optional arguments for formatting the message string. Thrown when message is null. Logs a message using the specified resource string. Thread safe. The name of the string resource to load. Optional arguments for formatting the loaded string. Thrown when messageResourceName is null. Logs a message of the given importance using the specified resource string. Thread safe. Take care to order the parameters correctly or the other overload will be called inadvertently. The importance level of the message. The name of the string resource to load. Optional arguments for formatting the loaded string. Thrown when messageResourceName is null. Logs a file generated from the given data. The file path relative to the currecnt project. The content of the file. Flatten the inner exception message Exception to flatten. Small helper for logging the custom ExternalProjectStarted build event Thread safe. text message help keyword project name targets we are going to build (empty indicates default targets) Small helper for logging the custom ExternalProjectFinished build event. Thread safe. text message help keyword project name true indicates project built successfully Logs the command line for a task's underlying tool/executable/shell command. Thread safe. The command line string. Logs the command line for a task's underlying tool/executable/shell command, using the given importance level. Thread safe. The importance level of the command line. The command line string. Logs an error using the specified string. Thread safe. The message string. Optional arguments for formatting the message string. Thrown when message is null. Logs an error using the specified string and other error details. Thread safe. Description of the error type (can be null). The error code (can be null). The help keyword for the host IDE (can be null). The path to the file containing the error (can be null). The line in the file where the error occurs (set to zero if not available). The column in the file where the error occurs (set to zero if not available). The last line of a range of lines in the file where the error occurs (set to zero if not available). The last column of a range of columns in the file where the error occurs (set to zero if not available). The message string. Optional arguments for formatting the message string. Thrown when message is null. Logs an error using the specified string and other error details. Thread safe. Description of the error type (can be null). The error code (can be null). The help keyword for the host IDE (can be null). The path to the file containing the error (can be null). The line in the file where the error occurs (set to zero if not available). The column in the file where the error occurs (set to zero if not available). The last line of a range of lines in the file where the error occurs (set to zero if not available). The last column of a range of columns in the file where the error occurs (set to zero if not available). The message string. A link pointing to more information about the error. Optional arguments for formatting the message string. Thrown when message is null. Logs an error using the specified resource string. Thread safe. The name of the string resource to load. Optional arguments for formatting the loaded string. Thrown when messageResourceName is null. Logs an error using the specified resource string and other error details. Thread safe. The name of the string resource that describes the error type (can be null). The error code (can be null). The help keyword for the host IDE (can be null). The path to the file containing the error (can be null). The line in the file where the error occurs (set to zero if not available). The column in the file where the error occurs (set to zero if not available). The last line of a range of lines in the file where the error occurs (set to zero if not available). The last column of a range of columns in the file where the error occurs (set to zero if not available). The name of the string resource containing the error message. Optional arguments for formatting the loaded string. Thrown when messageResourceName is null. Logs an error using the specified resource string. If the message has an error code prefixed to it, the code is extracted and logged with the message. If a help keyword prefix has been provided, a help keyword for the host IDE is also logged with the message. The help keyword is composed by appending the string resource name to the prefix. A task can provide a help keyword prefix either via the Task (or TaskMarshalByRef) base class constructor, or the Task.HelpKeywordPrefix (or AppDomainIsolatedTask.HelpKeywordPrefix) property. Thread safe. The name of the string resource to load. Optional arguments for formatting the loaded string. Thrown when messageResourceName is null. Logs an error using the specified resource string and other error details. If the message has an error code prefixed, the code is extracted and logged with the message. If a help keyword prefix has been provided, a help keyword for the host IDE is also logged with the message. The help keyword is composed by appending the error message resource string name to the prefix. A task can provide a help keyword prefix either via the Task (or TaskMarshalByRef) base class constructor, or the Task.HelpKeywordPrefix (or AppDomainIsolatedTask.HelpKeywordPrefix) property. Thread safe. The name of the string resource that describes the error type (can be null). The path to the file containing the error (can be null). The line in the file where the error occurs (set to zero if not available). The column in the file where the error occurs (set to zero if not available). The last line of a range of lines in the file where the error occurs (set to zero if not available). The last column of a range of columns in the file where the error occurs (set to zero if not available). The name of the string resource containing the error message. Optional arguments for formatting the loaded string. Thrown when messageResourceName is null. Logs an error using the message from the given exception context. No callstack will be shown. Thread safe. Exception to log. Thrown when e is null. Logs an error using the message (and optionally the stack-trace) from the given exception context. Thread safe. Exception to log. If true, callstack will be appended to message. Thrown when exception is null. Logs an error using the message, and optionally the stack-trace from the given exception, and optionally inner exceptions too. Thread safe. Exception to log. If true, callstack will be appended to message. Whether to log exception types and any inner exceptions. File related to the exception, or null if the project file should be logged Thrown when exception is null. Logs a warning using the specified string. Thread safe. The message string. Optional arguments for formatting the message string. Thrown when message is null. Logs a warning using the specified string and other warning details. Thread safe. Description of the warning type (can be null). The warning code (can be null). The help keyword for the host IDE (can be null). The path to the file causing the warning (can be null). The line in the file causing the warning (set to zero if not available). The column in the file causing the warning (set to zero if not available). The last line of a range of lines in the file causing the warning (set to zero if not available). The last column of a range of columns in the file causing the warning (set to zero if not available). The message string. Optional arguments for formatting the message string. Thrown when message is null. Logs a warning using the specified string and other warning details. Thread safe. Description of the warning type (can be null). The warning code (can be null). The help keyword for the host IDE (can be null). A link pointing to more information about the warning (can be null). The path to the file causing the warning (can be null). The line in the file causing the warning (set to zero if not available). The column in the file causing the warning (set to zero if not available). The last line of a range of lines in the file causing the warning (set to zero if not available). The last column of a range of columns in the file causing the warning (set to zero if not available). The message string. Optional arguments for formatting the message string. Thrown when message is null. Logs a warning using the specified resource string. Thread safe. The name of the string resource to load. Optional arguments for formatting the loaded string. Thrown when messageResourceName is null. Logs a warning using the specified resource string and other warning details. Thread safe. The name of the string resource that describes the warning type (can be null). The warning code (can be null). The help keyword for the host IDE (can be null). The path to the file causing the warning (can be null). The line in the file causing the warning (set to zero if not available). The column in the file causing the warning (set to zero if not available). The last line of a range of lines in the file causing the warning (set to zero if not available). The last column of a range of columns in the file causing the warning (set to zero if not available). The name of the string resource containing the warning message. Optional arguments for formatting the loaded string. Thrown when messageResourceName is null. Logs a warning using the specified resource string. If the message has a warning code prefixed to it, the code is extracted and logged with the message. If a help keyword prefix has been provided, a help keyword for the host IDE is also logged with the message. The help keyword is composed by appending the string resource name to the prefix. A task can provide a help keyword prefix either via the Task (or TaskMarshalByRef) base class constructor, or the Task.HelpKeywordPrefix (or AppDomainIsolatedTask.HelpKeywordPrefix) property. Thread safe. The name of the string resource to load. Optional arguments for formatting the loaded string. Thrown when messageResourceName is null. Logs a warning using the specified resource string and other warning details. If the message has a warning code, the code is extracted and logged with the message. If a help keyword prefix has been provided, a help keyword for the host IDE is also logged with the message. The help keyword is composed by appending the warning message resource string name to the prefix. A task can provide a help keyword prefix either via the Task (or TaskMarshalByRef) base class constructor, or the Task.HelpKeywordPrefix (or AppDomainIsolatedTask.HelpKeywordPrefix) property. Thread safe. The name of the string resource that describes the warning type (can be null). The path to the file causing the warning (can be null). The line in the file causing the warning (set to zero if not available). The column in the file causing the warning (set to zero if not available). The last line of a range of lines in the file causing the warning (set to zero if not available). The last column of a range of columns in the file causing the warning (set to zero if not available). The name of the string resource containing the warning message. Optional arguments for formatting the loaded string. Thrown when messageResourceName is null. Logs a warning using the message from the given exception context. Thread safe. Exception to log. Thrown when exception is null. Logs a warning using the message (and optionally the stack-trace) from the given exception context. Thread safe. Exception to log. If true, the exception callstack is appended to the message. Thrown when exception is null. Logs errors/warnings/messages for each line of text in the given file. Errors/warnings are only logged for lines that fit a particular (canonical) format -- the remaining lines are treated as messages. Thread safe. The file to log from. true, if any errors were logged Thrown when filename is null. Logs errors/warnings/messages for each line of text in the given file. Errors/warnings are only logged for lines that fit a particular (canonical) format -- the remaining lines are treated as messages. Thread safe. The file to log from. The importance level for messages that are neither errors nor warnings. true, if any errors were logged Thrown when filename is null. Logs errors/warnings/messages for each line of text in the given stream. Errors/warnings are only logged for lines that fit a particular (canonical) format -- the remaining lines are treated as messages. Thread safe. The stream to log from. The importance level for messages that are neither errors nor warnings. true, if any errors were logged Thrown when stream is null. Logs an error/warning/message from the given line of text. Errors/warnings are only logged for lines that fit a particular (canonical) format -- all other lines are treated as messages. Thread safe. The line of text to log from. The importance level for messages that are neither errors nor warnings. true, if an error was logged Thrown when lineOfText is null. Logs telemetry with the specified event name and properties. The event name. The list of properties associated with the event. InitializeLifetimeService is called when the remote object is activated. This method will determine how long the lifetime for the object will be. Thread safe. However, InitializeLifetimeService and MarkAsInactive should only be called in that order, together or not at all, and no more than once. The lease object to control this object's lifetime. Notifies this object that its work is done. Thread safe. However, InitializeLifetimeService and MarkAsInactive should only be called in that order, together or not at all, and no more than once. Indicates to the TaskLoggingHelper that it is no longer needed. This class provides access to the assembly's resources. Loads the specified resource string, either from the assembly's primary resources, or its shared resources. This method is thread-safe. The resource string, or null if not found. Gets the assembly's primary resources i.e. the resources exclusively owned by this assembly. This property is thread-safe. ResourceManager for primary resources. Gets the assembly's shared resources i.e. the resources this assembly shares with other assemblies. This property is thread-safe. ResourceManager for shared resources. Formats the given string using the variable arguments passed in. The current thread's culture is used for formatting. This method is thread-safe. The string to format. Arguments for formatting. The formatted string. Loads the specified resource string and optionally formats it using the given arguments. The current thread's culture is used for formatting. 1) This method requires the owner task to have registered its resources either via the Task (or TaskMarshalByRef) base class constructor, or the Task.TaskResources (or AppDomainIsolatedTask.TaskResources) property. 2) This method is thread-safe. The name of the string resource to load. Optional arguments for formatting the loaded string. The formatted string. Factory for Implementation of file system operations directly over the dot net managed layer Implementation of file system operations on windows. Combination of native and managed implementations. TODO Remove this class and replace with WindowsFileSystem. Test perf to ensure no regressions. A possibly-recoverable exception wrapping a failed native call. The captures the associated recent error code (). The accounts for the native code as well as a human readable portion. This is much like , but the message field contains the caller-provided part in addition to the system-provided message (rather than replacing the system provided message). Creates an exception representing a native failure (with a corresponding Win32 error code). The exception's includes the error code, a system-provided message describing it, and the provided application-specific message prefix (e.g. "Unable to open log file"). Creates an exception representing a native failure (with a corresponding Win32 error code). The exception's includes the error code and a system-provided message describing it. Returns a human readable error string for a native error code, like Native: Can't access the log file (0x5: Access is denied). The message prefix (e.g. "Can't access the log file") is optional. Converts a Win32 error code to HResult Handle for a volume iteration as returned by WindowsNative.FindFirstVolumeW /> Private constructor for the PInvoke marshaller. The type of file artifact to search for Windows-specific implementation of file system operations using Windows native invocations. TODO For potential extra perf gains, provide native implementations for all IFileSystem methods and stop inheriting from ManagedFileSystem Native implementation of file system operations Maximum path length. ERROR_SUCCESS ERROR_FILE_NOT_FOUND ERROR_PATH_NOT_FOUND ERROR_DIRECTORY ERROR_ACCESS_DENIED ERROR_NO_MORE_FILES Modifies the search condition of PathMatchSpecEx The pszSpec parameter points to a single file name pattern to be matched. The pszSpec parameter points to a semicolon-delimited list of file name patterns to be matched. If PMSF_NORMAL is used, ignore leading spaces in the string pointed to by pszSpec. If PMSF_MULTIPLE is used, ignore leading spaces in each file type contained in the string pointed to by pszSpec. This flag can be combined with PMSF_NORMAL and PMSF_MULTIPLE. Status of attempting to enumerate a directory. Enumeration of an existent directory succeeded. One or more path components did not exist, so the search directory could not be opened. A path component in the search path refers to a file. Only directories can be enumerated. Directory enumeration could not complete due to denied access to the search directory or a file inside. Directory enumeration failed without a well-known status (see ). Represents the result of attempting to enumerate a directory. Enumerated directory. Overall status indication. Native error code. Note that an error code other than ERROR_SUCCESS may be present even on success. Indicates if enumeration succeeded. Throws an exception if the native error code could not be canonicalized (a fairly exceptional circumstance). This is allowed when is . This is a good default: case when switching on every possible Throws an exception if the native error code was corresponds to a known (and enumeration was not successful). Creates (but does not throw) an exception for this result. The result must not be successful. Win32FindData The file attributes of a file Specified when a file or directory was created Specifies when the file was last read from, written to, or for executable files, run. For a file, the structure specifies when the file was last written to, truncated, or overwritten. For a directory, the structure specifies when the directory is created. The high-order DWORD value of the file size, in bytes. The low-order DWORD value of the file size, in bytes. If the dwFileAttributes member includes the FILE_ATTRIBUTE_REPARSE_POINT attribute, this member specifies the reparse point tag. Reserved for future use. The name of the file. An alternative name for the file. A class to help with printline debugging in difficult environments like CI, or when debugging msbuild through other tools like VS or CLI. See example usages in PrintLineDebugger_Tests A collection of useful writers Implements the rules for finding component directories using the AssemblyFoldersEx scheme. This is the normal schema: [HKLM | HKCU]\SOFTWARE\MICROSOFT\.NetFramework\ v1.0.3705 AssemblyFoldersEx Infragistics.GridControl.1.0: @Default = c:\program files\infragistics\grid control\1.0\bin @Description = Infragistics Grid Control for .NET version 1.0 9466 @Default = c:\program files\infragistics\grid control\1.0sp1\bin @Description = SP1 for Infragistics Grid Control for .NET version 1.0 The root registry path is the following: [HKLM | HKCU]\{AssemblyFoldersBase}\{RuntimeVersion}\{AssemblyFoldersSuffix} Where: {AssemblyFoldersBase} = Software\Microsoft\[.NetFramework | .NetCompactFramework] {RuntimeVersion} = the runtime version property from the project file {AssemblyFoldersSuffix} = [ PocketPC | SmartPhone | WindowsCE]\AssemblyFoldersEx The list of directory names found from the registry. Set of unique paths to directories found from the registry Construct. Like Software\Microsoft\[.NetFramework | .NetCompactFramework] The runtime version property from the project file. Like [ PocketPC | SmartPhone | WindowsCE]\AssemblyFoldersEx Operating system version Current platform Used to find registry subkey names. Used to find registry key default values. Architecture to seek. Key object to open. Finds directories for a specific registry key. The registry view to examine. The registry hive to examine. Like Software\Microsoft\[.NetFramework | .NetCompactFramework] The runtime version property from the project file. Like [ PocketPC | SmartPhone | WindowsCE]\AssemblyFoldersEx Operating system version Current platform Used to find registry subkey names. Used to find registry key default values. Key object to open. The algorithm for gathering versions from the registry is as follows: 1) targetRuntimeVersion is the target framework version you are targeting 2) versions is a string list from reading the registry, this list is in what ever order the registry returns the keys to us in, this is usually alphabetical. We will go through each version string and do the following: 1) Check to see if the string is a version If the string is not a version we will check to see if the string starts with the framework we are targeting, if it does we will add it to a list which will be added at the end of the versions list, if not it gets ignored. We do this to stay compatible to what we have been doing since whidbey. If the string is a version We check to see if the version is a valid target framework version. Meaning. It has a Maj.Minor version and may have build, Build is less than or equal to 255 and there is no revision. The reason the build number needs to be less than 255 is because 255 is the largest build number for a target framework version that visual studio 2010 supports. The build number is supposed to represent a service pack on the 4.0 framework. If the string is a valid target framework version we check to see we already have a dictionary entry and if not we add one. If the string is not a valid target framework then we will ignore the part of the version which makes it invalid (either the build or the revision, or both) and see where that version would fit in the dictionary as a key and then put the original version string into the list for that entry. Since the dictionary is sorted in reverse order to generate the list to return we do the following: Go through the list of dictionary entries For each entry sort the list in reverse alphabetical order and add the entries in their internal list to the listToreturn. This way we have a reverse sorted list of all of the version keys. Given a candidate version we need to add it to the dictionary of targetFrameworkToRegistry versions. This involves determining if we need to add it to an existing entry or create a new one. Get Enumerator Get enumerator Deserialize the file into an AssemblyFolderCollection. Path to the AssemblyFolder.config file. New deserialized collection instance. Name of the Visual Studio (and Blend) process. VS ASP intellisense server fails without Microsoft.VisualStudio.Web.Host. Remove when issue fixed: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/574986 Name of the MSBuild process(es) Name of MSBuild executable files. Gets the cached Build Environment instance. Find the location of MSBuild.exe based on the current environment. This defines the order and precedence for various methods of discovering MSBuild and associated toolsets. At a high level, an install under Visual Studio is preferred as the user may have SDKs installed to a specific instance of Visual Studio and build will only succeed if we can discover those. See https://github.com/dotnet/msbuild/issues/1461 for details. Build environment. Returns true if processName appears in the processList Name of the process List of processes to check Resets the current singleton instance (for testing). Resets the current singleton instance (for testing). Enum which defines which environment / mode MSBuild is currently running. Running from Visual Studio directly or from MSBuild installed under an instance of Visual Studio. Toolsets and extensions will be loaded from the Visual Studio instance. Running in a standalone toolset mode. All toolsets and extensions paths are relative to the app running and not dependent on Visual Studio. (e.g. dotnet CLI, open source clone of our repo) Running without any defined toolsets. Most functionality limited. Likely will not be able to build or evaluate a project. (e.g. reference to Microsoft.*.dll without a toolset definition or Visual Studio instance installed). Defines the current environment for build tools. Gets the flag that indicates if we are running in a test harness. Returns true when the entry point application is MSBuild.exe. Returns true when the entry point application is Visual Studio. Path to the root of the MSBuild folder (in VS scenarios, MSBuild\Current\bin). Path to the MSBuild 32-bit tools directory. Path to the MSBuild 64-bit (AMD64) tools directory. Path to the ARM64 tools directory. if ARM64 tools are not installed. Path to the Sdks folder for this MSBuild instance. Full path to the current MSBuild configuration file. Full path to current MSBuild.exe. This path is likely not the current running process. We may be inside Visual Studio or a test harness. In that case this will point to the version of MSBuild found to be associated with the current environment. Full path to the current MSBuild tools directory. This will be 32-bit unless we're executing from the 'AMD64' folder. Path to the root Visual Studio install directory (e.g. 'C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise') MSBuild extensions path. On Standalone this defaults to the MSBuild folder. In VisualStudio mode this folder will be %VSINSTALLDIR%\MSBuild. Functions for dealing with the specially formatted errors returned by build tools. Various tools produce and consume CanonicalErrors in various formats. DEVENV Format When Clicking on Items in the Output Window (taken from env\msenv\core\findutil.cpp ParseLocation function) v:\dir\file.ext (loc) : msg \\server\share\dir\file.ext(loc):msg url loc: (line) (line-line) (line,col) (line,col-col) (line,col,len) (line,col,line,col) DevDiv Build Process (taken from tools\devdiv2.def) To echo warnings and errors to the build console, the "description block" must be recognized by build. To do this, add a $(ECHO_COMPILING_COMMAND) or $(ECHO_PROCESSING_COMMAND) to the first line of the description block, e.g. $(ECHO_COMPILING_CMD) Resgen_$< Errors must have the format: <text> : error [num]: <msg> Warnings must have the format: <text> : warning [num]: <msg> Represents the parts of a decomposed canonical message. Defines the error category\severity level. Value used for unspecified line and column numbers, which are 1-relative. Initializes a new instance of the class. Name of the file or tool (not localized) The line number. The column number. The ending line number. The ending column number. The category/severity level The sub category (localized) The error code (not localized) The error message text (localized) A small custom int conversion method that treats invalid entries as missing (0). This is done to work around tools that don't fully conform to the canonical message format - we still want to salvage what we can from the message. 'value' converted to int or 0 if it can't be parsed or is negative Decompose an error or warning message into constituent parts. If the message isn't in the canonical form, return null. This method is thread-safe, because the Regex class is thread-safe (per MSDN). Decomposed canonical message, or null. Contains information about entries in the AssemblyFoldersEx registry keys. Constructor The registry key to the component Target framework version for the registry key delegate for System.IO.Directory.GetFiles, used for testing Directory path to start search for files in pattern of files to match string array of files which match search pattern delegate for Directory.GetDirectories. The path to get directories for. The pattern to search for. An array of directories. Delegate for System.IO.Directory.Exists Directory path to check if it exists true if directory exists File exists delegate The path to check for existence. 'true' if the file exists. File.Copy delegate File.Delete delegate File create delegate The path to create. This class contains methods that are useful for error checking and validation. Throws InternalErrorException. This is only for situations that would mean that there is a bug in MSBuild itself. Throws InternalErrorException. This is only for situations that would mean that there is a bug in MSBuild itself. Throws InternalErrorException. Indicates the code path followed should not have been possible. This is only for situations that would mean that there is a bug in MSBuild itself. Throws InternalErrorException. Indicates the code path followed should not have been possible. This is only for situations that would mean that there is a bug in MSBuild itself. Throws InternalErrorException. Indicates the code path followed should not have been possible. This is only for situations that would mean that there is a bug in MSBuild itself. Helper to throw an InternalErrorException when the specified parameter is null. This should be used ONLY if this would indicate a bug in MSBuild rather than anything caused by user action. The value of the argument. Parameter that should not be null Helper to throw an InternalErrorException when a lock on the specified object is not already held. This should be used ONLY if this would indicate a bug in MSBuild rather than anything caused by user action. The object that should already have been used as a lock. Helper to throw an InternalErrorException when the specified parameter is null or zero length. This should be used ONLY if this would indicate a bug in MSBuild rather than anything caused by user action. The value of the argument. Parameter that should not be null or zero length Helper to throw an InternalErrorException when the specified parameter is not a rooted path. This should be used ONLY if this would indicate a bug in MSBuild rather than anything caused by user action. Parameter that should be a rooted path. This method should be used in places where one would normally put an "assert". It should be used to validate that our assumptions are true, where false would indicate that there must be a bug in our code somewhere. This should not be used to throw errors based on bad user input or anything that the user did wrong. Overload for one string format argument. Overload for two string format arguments. Overload for three string format arguments. Overload for four string format arguments. Throws an InvalidOperationException with the specified resource string Resource to use in the exception Formatting args. Throws an InvalidOperationException if the given condition is false. Overload for one string format argument. Overload for two string format arguments. Overload for three string format arguments. Overload for four string format arguments. Throws an ArgumentException that can include an inner exception. PERF WARNING: calling a method that takes a variable number of arguments is expensive, because memory is allocated for the array of arguments -- do not call this method repeatedly in performance-critical scenarios Throws an ArgumentException that can include an inner exception. PERF WARNING: calling a method that takes a variable number of arguments is expensive, because memory is allocated for the array of arguments -- do not call this method repeatedly in performance-critical scenarios This method is thread-safe. Can be null. Throws an ArgumentException if the given condition is false. Overload for one string format argument. Overload for two string format arguments. Overload for three string format arguments. Overload for four string format arguments. Throws an ArgumentException that includes an inner exception, if the given condition is false. Can be null. Overload for one string format argument. Overload for two string format arguments. Overload for three string format arguments. Overload for four string format arguments. Throws an argument out of range exception. Throws an ArgumentOutOfRangeException using the given parameter name if the condition is false. Throws an ArgumentNullException if the given string parameter is null and ArgumentException if it has zero length. Throws an ArgumentNullException if the given collection is null and ArgumentException if it has zero length. Throws an ArgumentException if the given collection is not null but of zero length. Throws an ArgumentNullException if the given string parameter is null and ArgumentException if it has zero length. Throws an ArgumentException if the string has zero length, unless it is null, in which case no exception is thrown. Throws an ArgumentNullException if the given parameter is null. Throws an ArgumentNullException if the given parameter is null. Verifies the given arrays are not null and have the same length A utility that verifies the parameters provided to a standard ICollection.CopyTo call. If is null. If falls outside of the bounds . If there is insufficient capacity to copy the collection contents into when starting at . This class implements static methods to assist with unescaping of %XX codes in the MSBuild file format. PERF: since we escape and unescape relatively frequently, it may be worth caching the last N strings that were (un)escaped Optional cache of escaped strings for use when needing to escape in performance-critical scenarios with significant expected string reuse. Replaces all instances of %XX in the input string with the character represented by the hexadecimal number XX. The string to unescape. If the string should be trimmed before being unescaped. unescaped string Adds instances of %XX in the input string where the char to be escaped appears XX is the hex value of the ASCII code for the char. Interns and caches the result. NOTE: Only recommended for use in scenarios where there's expected to be significant repetition of the escaped string. Cache currently grows unbounded. Adds instances of %XX in the input string where the char to be escaped appears XX is the hex value of the ASCII code for the char. The string to escape. escaped string Adds instances of %XX in the input string where the char to be escaped appears XX is the hex value of the ASCII code for the char. Caches if requested. The string to escape. True if the cache should be checked, and if the resultant string should be cached. Before trying to actually escape the string, it can be useful to call this method to determine if escaping is necessary at all. This can save lots of calls to copy around item metadata that is really the same whether escaped or not. Determines whether the string contains the escaped form of '*' or '?'. Convert the given integer into its hexadecimal representation. The number to convert, which must be non-negative and less than 16 The character which is the hexadecimal representation of . Append the escaped version of the given character to a . The to which to append. The character to escape. Append the escaped version of the given string to a . The to which to append. The unescaped string. Special characters that need escaping. It's VERY important that the percent character is the FIRST on the list - since it's both a character we escape and use in escape sequences, we can unintentionally escape other escape sequences if we don't process it first. Of course we'll have a similar problem if we ever decide to escape hex digits (that would require rewriting the algorithm) but since it seems unlikely that we ever do, this should be good enough to avoid complicating the algorithm at this point. Offers a default string format for Error and Warning events Format the error event message and all the other event data into a single string. Error to format true to show the project file which issued the event, otherwise false. Properties to Print along with message The formatted message string. Format the warning message and all the other event data into a single string. Warning to format true to show the project file which issued the event, otherwise false. Properties to Print along with message The formatted message string. Format the message and all the other event data into a single string. Message to format true to show the project file which issued the event, otherwise false. Properties to Print along with message The complete message (including property name) for an environment-derived property The formatted message string. Format the error event message and all the other event data into a single string. Error to format The formatted message string. Format the error event message and all the other event data into a single string. Error to format true to show the project file which issued the event, otherwise false. The formatted message string. Format the warning message and all the other event data into a single string. Warning to format The formatted message string. Format the warning message and all the other event data into a single string. Warning to format true to show the project file which issued the event, otherwise false. The formatted message string. Format the message and all the other event data into a single string. Message to format The formatted message string. Format the message and all the other event data into a single string. Message to format Show project file or not For an EnvironmentVariableReadEventArgs, adds an explanatory note and the name of the variable. The formatted message string. Format the event message and all the other event data into a single string. category ("error" or "warning") subcategory event message error or warning code number file name line number (0 if n/a) end line number (0 if n/a) column number (0 if n/a) end column number (0 if n/a) thread id The formatted message string. Format the event message and all the other event data into a single string. category ("error" or "warning") subcategory event message error or warning code number file name the project file name line number (0 if n/a) end line number (0 if n/a) column number (0 if n/a) end column number (0 if n/a) thread id log output properties The formatted message string. Splits strings on 'newLines' with tolerance for Everett and Dogfood builds. String to split. The kinds of newline breaks we expect. Currently we're not supporting "\r". Utility methods for classifying and handling exceptions. Gets the location of the directory used for diagnostic log files. The directory used for diagnostic log files. The filename that exceptions will be dumped to If the given exception is "ignorable under some circumstances" return false. Otherwise it's "really bad", and return true. This makes it possible to catch(Exception ex) without catching disasters. The exception to check. True if exception is critical. If the given exception is file IO related or expected return false. Otherwise, return true. The exception to check. True if exception is not IO related or expected otherwise false. Determine whether the exception is file-IO related. The exception to check. True if exception is IO related. Checks if the exception is an XML one. Exception to check. True if exception is related to XML parsing. Extracts line and column numbers from the exception if it is XML-related one. XML-related exception. Line and column numbers if available, (0,0) if not. This function works around the fact that XmlException and XmlSchemaException are not directly related. If the given exception is file IO related or Xml related return false. Otherwise, return true. The exception to check. If the given exception is reflection-related return false. Otherwise, return true. The exception to check. Serialization has been observed to throw TypeLoadException as well as SerializationException and IO exceptions. (Obviously it has to do reflection but it ought to be wrapping the exceptions.) Returns false if this is a known exception thrown by the registry API. Returns false if this is a known exception thrown by function evaluation Dump any unhandled exceptions to a file so they can be diagnosed Dump the exception information to a file Returns the content of any exception dump files modified since the provided time, otherwise returns an empty string. Line and column pair. Gets or sets line number. Gets or sets column position. This class contains utility methods for file IO. PERF\COVERAGE NOTE: Try to keep classes in 'shared' as granular as possible. All the methods in each class get pulled into the resulting assembly. This class contains utility methods for file IO. Partial class in order to reduce the amount of sharing into different assemblies This class contains utility methods for file IO. It is in a separate file so that it can be selectively included into an assembly. The directory where MSBuild stores cache information used during the build. FOR UNIT TESTS ONLY Clear out the static variable used for the cache directory so that tests that modify it can validate their modifications. Determines whether the file system is case sensitive. Copied from https://github.com/dotnet/runtime/blob/73ba11f3015216b39cb866d9fb7d3d25e93489f2/src/libraries/Common/src/System/IO/PathInternal.CaseSensitivity.cs#L41-L59 Copied from https://github.com/dotnet/corefx/blob/056715ff70e14712419d82d51c8c50c54b9ea795/src/Common/src/System/IO/PathInternal.Windows.cs#L61 MSBuild should support the union of invalid path chars across the supported OSes, so builds can have the same behaviour crossplatform: https://github.com/dotnet/msbuild/issues/781#issuecomment-243942514 Copied from https://github.com/dotnet/corefx/blob/387cf98c410bdca8fd195b28cbe53af578698f94/src/System.Runtime.Extensions/src/System/IO/Path.Windows.cs#L18 MSBuild should support the union of invalid path chars across the supported OSes, so builds can have the same behaviour crossplatform: https://github.com/dotnet/msbuild/issues/781#issuecomment-243942514 Retrieves the MSBuild runtime cache directory Get the hex hash string for the string Get the hash for the assemblyPaths Returns whether MSBuild can write to the given directory. Throws for PathTooLongExceptions but not other exceptions. Clears the MSBuild runtime cache If the given path doesn't have a trailing slash then add one. If the path is an empty string, does not modify it. The path to check. A path with a slash. Ensures the path does not have a leading or trailing slash after removing the first 'start' characters. Ensures the path does not have a leading slash after removing the first 'start' characters but does end in a slash. Ensures the path does not have a trailing slash. Ensures the path is enclosed within single quotes. The path to check. The path enclosed by quotes. Ensures the path is enclosed within double quotes. The path to check. The path enclosed by quotes. Ensures the path is enclosed within quotes. The path to check. Indicates if single or double quotes should be used The path enclosed by quotes. Indicates if the given file-spec ends with a slash. The file spec. true, if file-spec has trailing slash Indicates if the given character is a slash. true, if slash Trims the string and removes any double quotes around it. Get the directory name of a rooted full path Gets the canonicalized full path of the provided path. Guidance for use: call this on all paths accepted through public entry points that need normalization. After that point, only verify the path is rooted, using ErrorUtilities.VerifyThrowPathRooted. ASSUMES INPUT IS ALREADY UNESCAPED. If on Unix, convert backslashes to slashes for strings that resemble paths. The heuristic is if something resembles paths (contains slashes) check if the first segment exists and is a directory. Use a native shared method to massage file path. If the file is adjusted, that qualifies is as a path. @baseDirectory is just passed to LooksLikeUnixFilePath, to help with the check If on Unix, convert backslashes to slashes for strings that resemble paths. This overload takes and returns ReadOnlyMemory of characters. If on Unix, check if the string looks like a file path. The heuristic is if something resembles paths (contains slashes) check if the first segment exists and is a directory. If @baseDirectory is not null, then look for the first segment exists under that Extracts the directory from the given file-spec. The filespec. directory path Determines whether the given assembly file name has one of the listed extensions. The name of the file Array of extensions to consider. Get the currently executing assembly path Determines the full path for the given file-spec. ASSUMES INPUT IS STILL ESCAPED The file spec to get the full path of. full path A variation of Path.GetFullPath that will return the input value instead of throwing any IO exception. Useful to get a better path for an error message, without the risk of throwing if the error message was itself caused by the path being invalid! Compare if two paths, relative to the given currentDirectory are equal. Does not throw IO exceptions. See Normalizes a path for path comparison Does not throw IO exceptions. See A variation on File.Delete that will throw ExceptionHandling.NotExpectedException exceptions A variation on Directory.Delete that will throw ExceptionHandling.NotExpectedException exceptions Deletes a directory, ensuring that Directory.Delete does not get a path ending in a slash. This is a workaround for https://github.com/dotnet/corefx/issues/3780, which clashed with a common pattern in our tests. Gets a file info object for the specified file path. If the file path is invalid, or is a directory, or cannot be accessed, or does not exist, it returns null rather than throwing or returning a FileInfo around a non-existent file. This allows it to be called where File.Exists() (which never throws, and returns false for directories) was called - but with the advantage that a FileInfo object is returned that can be queried (e.g., for LastWriteTime) without hitting the disk again. FileInfo around path if it is an existing /file/, else null Returns if the directory exists Full path to the directory in the filesystem The file system Returns if the directory exists Full path to the file in the filesystem The file system If there is a directory or file at the specified path, returns true. Otherwise, returns false. Does not throw IO exceptions, to match Directory.Exists and File.Exists. Unlike calling each of those in turn it only accesses the disk once, which is faster. This method returns true if the specified filename is a solution file (.sln) or solution filter file (.slnf); otherwise, it returns false. Solution filters are included because they are a thin veneer over solutions, just with a more limited set of projects to build, and should be treated the same way. Returns true if the specified filename is a VC++ project file, otherwise returns false Returns true if the specified filename is a metaproject file (.metaproj), otherwise false. Given the absolute location of a file, and a disc location, returns relative file path to that disk location. Throws UriFormatException. The base path we want to be relative to. Must be absolute. Should not include a filename as the last segment will be interpreted as a directory. The path we need to make relative to basePath. The path can be either absolute path or a relative path in which case it is relative to the base path. If the path cannot be made relative to the base path (for example, it is on another drive), it is returned verbatim. If the basePath is an empty string, returns the path. relative path (can be the full path) Normalizes the path if and only if it is longer than max path, or would be if rooted by the current directory. This may make it shorter by removing ".."'s. A variation of Path.IsRooted that not throw any IO exception. Get the folder N levels above the given. Will stop and return current path when rooted. Path to get the folder above. Number of levels up to walk. Full path to the folder N levels above the path. Combine multiple paths. Should only be used when compiling against .NET 2.0. Only use in .NET 2.0. Otherwise, use System.IO.Path.Combine(...) Root path. Paths to concatenate. Combined path. Replace all backward slashes to forward slashes Ensure all slashes are the current platform's slash Locate a file in either the directory specified or a location in the directory structure above that directory. Searches for a file based on the specified starting directory. The file to search for. An optional directory to start the search in. The default location is the directory of the file containing the property function. The filesystem The full path of the file if it is found, otherwise an empty string. Clears the file existence cache. Encapsulates the definitions of the item-spec modifiers a.k.a. reserved item metadata. Indicates if the given name is reserved for an item-spec modifier. Indicates if the given name is reserved for one of the specific subset of itemspec modifiers to do with the defining project of the item. Indicates if the given name is reserved for a derivable item-spec modifier. Derivable means it can be computed given a file name. Name to check. true, if name of a derivable modifier Performs path manipulations on the given item-spec as directed. Does not cache the result. Performs path manipulations on the given item-spec as directed. Supported modifiers: %(FullPath) = full path of item %(RootDir) = root directory of item %(Filename) = item filename without extension %(Extension) = item filename extension %(RelativeDir) = item directory as given in item-spec %(Directory) = full path of item directory relative to root %(RecursiveDir) = portion of item path that matched a recursive wildcard %(Identity) = item-spec as given %(ModifiedTime) = last write time of item %(CreatedTime) = creation time of item %(AccessedTime) = last access time of item NOTES: 1) This method always returns an empty string for the %(RecursiveDir) modifier because it does not have enough information to compute it -- only the BuildItem class can compute this modifier. 2) All but the file time modifiers could be cached, but it's not worth the space. Only full path is cached, as the others are just string manipulations. Methods of the Path class "normalize" slashes and periods. For example: 1) successive slashes are combined into 1 slash 2) trailing periods are discarded 3) forward slashes are changed to back-slashes As a result, we cannot rely on any file-spec that has passed through a Path method to remain the same. We will therefore not bother preserving slashes and periods when file-specs are transformed. Never returns null. The root directory for relative item-specs. When called on the Engine thread, this is the project directory. When called as part of building a task, it is null, indicating that the current directory should be used. The item-spec to modify. The path to the project that defined this item (may be null). The modifier to apply to the item-spec. Full path if any was previously computed, to cache. The modified item-spec (can be empty string, but will never be null). Thrown when the item-spec is not a path. Indicates whether the given path is a UNC or drive pattern root directory. Note: This function mimics the behavior of checking if Path.GetDirectoryName(path) == null. Temporary check for something like http://foo which will end up like c:\foo\bar\http://foo We should either have no colon, or exactly one colon. UNDONE: This is a minimal safe change for Dev10. The correct fix should be to make GetFullPath/NormalizePath throw for this. Generates a unique directory name in the temporary folder. Caller must delete when finished. Generates a unique temporary file name with a given extension in the temporary folder. File is guaranteed to be unique. Extension may have an initial period. File will NOT be created. May throw IOException. Generates a unique temporary file name with a given extension in the temporary folder. File is guaranteed to be unique. Extension may have an initial period. File will NOT be created. May throw IOException. Generates a unique temporary file name with a given extension in the temporary folder. If no extension is provided, uses ".tmp". File is guaranteed to be unique. Caller must delete it when finished. Generates a unique temporary file name with a given extension in the temporary folder. File is guaranteed to be unique. Caller must delete it when finished. Generates a unique temporary file name with a given extension in the temporary folder. File is guaranteed to be unique. Extension may have an initial period. Caller must delete it when finished. May throw IOException. Creates a file with unique temporary file name with a given extension in the specified folder. File is guaranteed to be unique. Extension may have an initial period. If folder is null, the temporary folder will be used. Caller must delete it when finished. May throw IOException. Functions for matching file names with patterns. Cache of the list of invalid path characters, because this method returns a clone (for security reasons) which can cause significant transient allocations The Default FileMatcher does not cache directory enumeration. The type of entity that GetFileSystemEntries should return. Delegate defines the GetFileSystemEntries signature that GetLongPathName uses to enumerate directories on the file system. Files, Directories, or Files and Directories The path to search. The file pattern. An enumerable of filesystem entries. Determines whether the given path has any wild card characters. Determines whether the given path has any wild card characters, any semicolons or any property references. Determines whether the given path has any property references. Get the files and\or folders specified by the given path and pattern. Whether Files, Directories or both. The path to search. The pattern to search. The directory for the project within which the call is made If true the project directory should be stripped The file system abstraction to use that implements file system operations Returns an enumerable of file system entries matching the specified search criteria. Inaccessible or non-existent file system entries are skipped. The file system abstraction to use that implements file system operations An enumerable of matching file system entries (can be empty). Determine if the given search pattern will match loosely on Windows The search pattern to check Same as Directory.EnumerateFiles(...) except that files that aren't accessible are skipped instead of throwing an exception. Other exceptions are passed through. The path. The pattern. The project directory The file system abstraction to use that implements file system operations Files that can be accessed. Same as Directory.EnumerateDirectories(...) except that files that aren't accessible are skipped instead of throwing an exception. Other exceptions are passed through. The path. Pattern to match The file system abstraction to use that implements file system operations Accessible directories. Given a path name, get its long version. The short path. The long path. Given a path name, get its long version. The short path. Delegate. The long path. Given a filespec, split it into left-most 'fixed' dir part, middle 'wildcard' dir part, and filename part. The filename part may have wildcard characters in it. The filespec to be decomposed. Receives the fixed directory part. The wildcard directory part. The filename part. Do most of the grunt work of splitting the filespec into parts. Does not handle post-processing common to the different matching paths. The filespec to be decomposed. Receives the fixed directory part. The wildcard directory part. The filename part. Removes the leading ".\" from all of the paths in the array. Paths to remove .\ from. Checks if the char is a DirectorySeparatorChar or a AltDirectorySeparatorChar Removes the current directory converting the file back to relative path Paths to remove current directory from. The filespec. Holds the directory pattern for globs like **/{pattern}/**, i.e. when we're looking for a matching directory name regardless of where on the path it is. This field is used only if the wildcard directory part has this shape. In other cases such as **/{pattern1}/**/{pattern2}/**, we don't use this optimization and instead rely on to test if a file path matches the glob or not. Wild-card matching. If true, then recursion is required. The directory to search in The remaining, wildcard part of the directory. True if SearchData.DirectoryPattern is non-null and we have descended into a directory that matches the pattern. Data about a search that does not change as the search recursively traverses directories True if a SearchData.DirectoryPattern is specified but we have not descended into a matching directory. Get all files that match either the file-spec or the regular expression. List of files that gets populated. Information about the search Patterns to exclude from the results exclude patterns that might activate farther down the directory tree. Keys assume paths are normalized with forward slashes and no trailing slashes Options for tuning the parallelization of subdirectories Given a split file spec consisting of a directory without wildcard characters, a sub-directory containing wildcard characters, and a filename which may contain wildcard characters, create a regular expression that will match that file spec. PERF WARNING: this method is called in performance-critical scenarios, so keep it fast and cheap The fixed directory part. The wildcard directory part. The filename part. The regular expression string. Determine if the filespec is legal according to the following conditions: (1) It is not legal for there to be a ".." after a wildcard. (2) By definition, "**" must appear alone between directory slashes.If there is any remaining "**" then this is not a valid filespec. True if both parts meet all conditions for a legal filespec. Append the regex equivalents for character sequences in the fixed directory part of a filespec: (1) The leading \\ in UNC paths, so that the doubled slash isn't reduced in the last step (2) Common filespec characters Append the regex equivalents for character sequences in the wildcard directory part of a filespec: (1) The leading **\ if existing (2) Each occurrence of recursive wildcard \**\ (3) Common filespec characters Append the regex equivalents for character sequences in the filename part of a filespec: (1) Trailing dots in file names have to be treated specially. We want: *. to match foo but 'foo' doesn't have a trailing '.' so we need to handle this while still being careful not to match 'foo.txt' by modifying the generated regex for wildcard characters * and ? (2) Common filespec characters (3) Ignore the .* portion of any *.* sequence when no trailing dot exists Append the regex equivalents for characters common to all filespec parts. Given an index at a directory separator, iteratively skip to the end of two sequences: (1) \.\ -> \ This is an identity, so for example, these two are equivalent, dir1\.\dir2 == dir1\dir2 (2) \\ -> \ Double directory separators are treated as a single directory separator, so, for example, this is an identity: f:\dir1\\dir2 == f:\dir1\dir2 The single exemption is for UNC path names, like this: \\server\share != \server\share This case is handled by isUncPath in a prior step. The last index of a directory sequence. Given an index at a directory separator or start of a recursive operator, iteratively skip to the end of three sequences: (1), (2) Both sequences handled by IndexOfNextNonCollapsibleChar (3) \**\**\ -> \**\ This is an identity, so for example, these two are equivalent, dir1\**\**\ == dir1\**\ ] If starting at a recursive operator, the last index of a recursive sequence. Otherwise, the last index of a directory sequence. Given a filespec, get the information needed for file matching. The filespec. Receives the regular expression. Receives the flag that is true if recursion is required. Receives the flag that is true if the filespec is legal. Given a filespec, parse it and construct the regular expression string. The filespec. Receives the fixed directory part. Receives the wildcard directory part. Receives the filename part. Receives the flag that is true if recursion is required. Receives the flag that is true if the filespec is legal. hook method to further change the parts The results of a match between a filespec and a file name. Default constructor. A wildcard (* and ?) matching algorithm that tests whether the input path file name matches against the pattern. The path whose file name is matched against the pattern. The pattern. A wildcard (* and ?) matching algorithm that tests whether the input string matches against the pattern. String which is matched against the pattern. Pattern against which string is matched. A wildcard (* and ?) matching algorithm that tests whether the input string matches against the pattern. String which is matched against the pattern. Pattern against which string is matched. Given a pattern (filespec) and a candidate filename (fileToMatch) return matching information. The filespec. The candidate to match against. The result class. The maximum number of tasks that are allowed to run concurrently The number of currently available tasks The maximum number of tasks that Parallel.ForEach may use Given a filespec, find the files that match. Will never throw IO exceptions: if there is no match, returns the input verbatim. The project directory. Get files that match the given file spec. Exclude files that match this file spec. The search action, array of files, and Exclude file spec (if applicable). Replace all slashes to the OS slash, collapse multiple slashes into one, trim trailing slashes A string The normalized string Returns true if drive enumerating wildcard patterns are detected using the directory and wildcard parts. Fixed directory string, portion of file spec info. Wildcard string, portion of file spec info. Returns true if given characters follow a drive pattern without the slash (ex: C:). First char from directory part of file spec string. Second char from directory part of file spec string. Returns true if selected characters from the fixed directory and wildcard pattern make up the "{any number of slashes}**" pattern. Starting index to begin detecting slashes in directory part of file spec string. Length of directory part of file spec string. Fixed directory string, portion of file spec info. Wildcard string, portion of file spec info. Returns true if the given character is a valid drive letter. Copied from https://github.com/dotnet/corefx/blob/b8b81a66738bb10ef0790023598396861d92b2c4/src/Common/src/System/IO/PathInternal.Windows.cs#L53-L59 Skips slash characters in a string. The working string Offset in string to start the search in First index that is not a slash. Returns the string's length if end of string is reached Given a filespec, find the files that match. Will never throw IO exceptions: if there is no match, returns the input verbatim. The project directory. Get files that match the given file spec. Exclude files that match this file spec. The search action, array of files, and Exclude file spec (if applicable). Returns true if the last component of the given directory path (assumed to not have any trailing slashes) matches the given pattern. The path to test. The pattern to test against. True in case of a match (e.g. directoryPath = "dir/subdir" and pattern = "s*"), false otherwise. Returns true if is * or *.*. The filename pattern to check. This class contains utility methods for file IO. Separate from FileUtilities because some assemblies may only need the patterns. PERF\COVERAGE NOTE: Try to keep classes in 'shared' as granular as possible. All the methods in each class get pulled into the resulting assembly. Indicates whether the specified string follows the pattern drive pattern (for example "C:", "D:"). Input to check for drive pattern. true if follows the drive pattern, false otherwise. Indicates whether the specified string follows the pattern drive pattern (for example "C:/" or "C:\"). Input to check for drive pattern with slash. true if follows the drive pattern with slash, false otherwise. Indicates whether the specified string starts with the drive pattern (for example "C:"). Input to check for drive pattern. true if starts with drive pattern, false otherwise. Indicates whether the specified string starts with the drive pattern (for example "C:/" or "C:\"). Input to check for drive pattern. true if starts with drive pattern with slash, false otherwise. Indicates whether the specified file-spec comprises exactly "\\server\share" (with no trailing characters). Input to check for UNC pattern. true if comprises UNC pattern. Indicates whether the specified file-spec begins with "\\server\share". Input to check for UNC pattern. true if starts with UNC pattern. Indicates whether the file-spec begins with a UNC pattern and how long the match is. Input to check for UNC pattern. length of the match, -1 if no match. Indicates whether or not the file-spec meets the minimum requirements of a UNC pattern. Input to check for UNC pattern minimum requirements. true if the UNC pattern is a minimum length of 5 and the first two characters are be a slash, false otherwise. Used to specify the targeted bitness of the .NET Framework for some methods of FrameworkLocationHelper Indicates the .NET Framework that is currently being run under. Indicates the 32-bit .NET Framework Indicates the 64-bit .NET Framework FrameworkLocationHelper provides utility methods for locating .NET Framework and .NET Framework SDK directories and files Path to the ToolsVersion definitions in the registry By default when a root path is not specified we would like to use the program files directory \ reference assemblies\framework as the root location to generate the reference assembly paths from. List the supported .net versions. List the supported visual studio versions. The items must be ordered by the version, because some methods depend on that fact to find the previous visual studio version. Define explicit fallback rules for the request to get path of .net framework sdk tools folder. The default rule is fallback to previous VS. However, there are some special cases that need explicit rules, i.e. v4.5.1 on VS12 fallbacks to v4.5 on VS12. The rules are maintained in a 2-dimensions array. Each row defines a rule. The first column defines the trigger condition. The second column defines the fallback .net and VS versions. Because there is no longer a strong 1:1 mapping between FX versions and SDK versions, if we're unable to locate the desired SDK version, we will try to use whichever SDK version is installed by looking at the key pointing to the "latest" version. This isn't ideal, but it will allow our tasks to function on any of several related SDKs even if they don't have exactly the same versions. NOTE: This returns the path to the root of the fallback SDK Because there is no longer a strong 1:1 mapping between FX versions and SDK versions, if we're unable to locate the desired SDK version, we will try to use whichever SDK version is installed by looking at the key pointing to the "latest" version. This isn't ideal, but it will allow our tasks to function on any of several related SDKs even if they don't have exactly the same versions. NOTE: This explicitly returns the path to the 3.5 tools (bin) under the fallback SDK, to match the data we're pulling from the registry now. Because there is no longer a strong 1:1 mapping between FX versions and SDK versions, if we're unable to locate the desired SDK version, we will try to use whichever SDK version is installed by looking at the key pointing to the "latest" version. This isn't ideal, but it will allow our tasks to function on any of several related SDKs even if they don't have exactly the same versions. NOTE: This explicitly returns the path to the 4.X tools (bin\NetFX 4.0 Tools) under the fallback SDK, to match the data we're pulling from the registry now. Check the registry key and value to see if the .net Framework is installed on the machine. Registry path to look for the value Key to retrieve the value from True if the registry key is 1 false if it is not there. This method also return true if the complus enviornment variables are set. Heuristic that first considers the current runtime path and then searches the base of that path for the given frameworks version. The path to the runtime that is currently executing. Should be something like 'v1.2' that indicates the runtime version we want. Function that checks if directory exists. Delegate to method that can return filesystem entries. .NET framework architecture Will return 'null' if there is no target frameworks on this machine. Determine the 32 bit program files directory, this is used for finding where the reference assemblies live. Determine the 64-bit program files directory, used as the basis for MSBuildExtensionsPath64. Returns null if we're not on a 64-bit machine Generate the path to the program files reference assembly location by taking in the program files special folder and then using that path to generate the path to the reference assemblies location. Given a ToolsVersion, find the path to the build tools folder for that ToolsVersion. The ToolsVersion to look up Target build tools architecture. The path to the build tools folder for that ToolsVersion, if it exists, or null otherwise Take the parts of the Target framework moniker and formulate the reference assembly path based on the following pattern: For a framework and version: $(TargetFrameworkRootPath)\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion) For a subtype: $(TargetFrameworkRootPath)\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\SubType\$(TargetFrameworkSubType) e.g.NET Framework v4.0 would locate its reference assemblies in: \Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0 e.g.Silverlight v2.0 would locate its reference assemblies in: \Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v2.0 e.g.NET Compact Framework v3.5, subtype PocketPC would locate its reference assemblies in: \Program Files\Reference Assemblies\Microsoft\Framework\.NETCompactFramework\v3.5\SubType\PocketPC The path to the reference assembly location Given a path, subtracts the requested number of directories and returns the result. Internal only so that I can have the unit tests use it too, instead of duplicating the same code Look up the path to the build tools directory for the requested ToolsVersion in the .exe.config file of this executable Look up the path to the build tools directory in the registry for the requested ToolsVersion and requested architecture Will return the path to the dot net framework reference assemblies if they exist under the program files\reference assembies\microsoft\framework directory or null if the directory does not exist. Look for the given registry value under the given key. Helper method to create an instance of for .net v4.x, because most of attributes are the same for v4.x versions. .net framework version. Version of Visual Studio The key in registry to indicate the corresponding .net framework in this visual studio. i.e. 'v8.0A' for VS11. The version of this visual studio. The list of supported .net framework versions in this visual studio. The key in registry to indicate the corresponding windows sdk, i.e. "v8.0" for VS11. The name in registry to indicate the sdk installation folder path, i.e. "InstallationFolder" for windows v8.0. The key in the registry to indicate the corresponding .net framework in this visual studio. i.e. 'v8.0A' for VS11. The registry key of this .net framework, i.e. "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" for .net v4.5. The name in registry to indicate that this .net framework is installed, i.e. "Install" for .net v4.5. The key in registry to indicate the sdk tools folder, i.e. "WinSDK-NetFx40Tools-x86" for .net v4.5. The version of visual studio that shipped with this .net framework. Does this .net framework include MSBuild? Cached paths of .net framework on different architecture. Cached paths of .net framework sdk tools folder path on different visual studio version. Cached path of the corresponding windows sdk. Cached path of .net framework reference assemblies. The version of this .net framework. The name in registry to indicate the sdk installation folder path, i.e. "InstallationFolder" for .net v4.5. Folder prefix, i.e. v4.0 for .net v4.5. Get the FrameworkName for this version of the .NET Framework. Gets the full registry key of this .net framework Sdk for the given visual studio version. i.e. "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx40Tools-x86" for .net v4.5 on VS11. Gets the full path of .net framework for the given architecture. Gets the full path of .net framework sdk tools for the given visual studio version. i.e. "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\" for .net v4.5 on VS11. Gets the full path of .net framework sdk. i.e. "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\" for .net v4.5 on VS11. Gets the full path of reference assemblies folder. i.e. "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\" for .net v4.5. Gets the full path of the corresponding windows sdk shipped with this .net framework. i.e. "C:\Program Files (x86)\Windows Kits\8.0\" for v8.0 (shipped with .net v4.5 and VS11). Specialized implementation for legacy .net framework v1.1 and v2.0. Gets the full registry key of this .net framework Sdk for the given visual studio version. i.e. "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework" for v1.1 and v2.0. Gets the full path of .net framework sdk tools for the given visual studio version. Gets the full path of .net framework sdk, which is the full path of .net framework sdk tools for v1.1 and v2.0. Gets the full path of reference assemblies folder, which is the full path of .net framework for v1.1 and v2.0. Specialized implementation for legacy .net framework v3.0 and v3.5. Gets the full path of .net framework sdk. i.e. "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\" for .net v3.5 on VS11. Gets the full path of reference assemblies folder. i.e. "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\" for v3.5. Methods that are invoked on FileTracker.dll in order to handle inproc tracking We want to P/Invoke to the FileTracker methods, but FileTracker.dll is not guaranteed to be on PATH (since it's in the MSBuild directory), and there is no DefaultDllImportSearchPath that explicitly points to us. Thus, we are sneaking around P/Invoke by manually acquiring the method pointers and calling them ourselves. The vast majority of this code was lifted from ndp\fx\src\CLRCompression\ZLibNative.cs, which does the same thing for that assembly. Loads FileTracker.dll into a handle that we can use subsequently to grab the exported methods we're interested in. Generic code to grab the function pointer for a function exported by FileTracker.dll, given that function's name, and transform that function pointer into a callable delegate. Actually generate all of the delegates that will be called by our public (or rather, internal) surface area methods. Static constructor -- generates the delegates for all of the export methods from FileTracker.dll that we care about. Given a registry hive and a request view open the base key for that registry location. Simplified registry access delegate. Given a baseKey and a subKey, get all of the subkey names. The base registry key. The subkey An enumeration of strings. Simplified registry access delegate. Given a baseKey and subKey, get the default value of the subKey. The base registry key. The subkey A string containing the default value. Helper methods that simplify registry access. Given a baseKey and a subKey, get all of the subkeys names. The base registry key. The subkey An enumeration of strings. Given a baseKey and subKey, get the default value of the subKey. The base registry key. The subkey A string containing the default value. Given a hive and a hive view open the base key RegistryKey baseKey = RegistryKey.OpenBaseKey(hive, view); The hive. The hive view A registry Key for the given baseKey and view This class contains utility methods for dealing with resources. Extracts the message code (if any) prefixed to the given string. MSB\d\d\d\d):\s*(?.*)$" Arbitrary codes match "^\s*(?[A-Za-z]+\d+):\s*(?.*)$" ]]> Thread safe. Whether to match only MSBuild error codes, or any error code. The string to parse. [out] The message code, or null if there was no code. The string without its message code prefix, if any. Retrieves the MSBuild F1-help keyword for the given resource string. Help keywords are used to index help topics in host IDEs. Resource string to get the MSBuild F1-keyword for. The MSBuild F1-help keyword string. Retrieves the contents of the named resource string. Resource string name. Resource string contents. Loads the specified string resource and formats it with the arguments passed in. If the string resource has an MSBuild message code and help keyword associated with it, they too are returned. PERF WARNING: calling a method that takes a variable number of arguments is expensive, because memory is allocated for the array of arguments -- do not call this method repeatedly in performance-critical scenarios This method is thread-safe. [out] The MSBuild message code, or null. [out] The MSBuild F1-help keyword for the host IDE, or null. Resource string to load. Optional arguments for formatting the resource string. The formatted resource string. Looks up a string in the resources, and formats it with the arguments passed in. If the string resource has an MSBuild message code and help keyword associated with it, they are discarded. PERF WARNING: calling a method that takes a variable number of arguments is expensive, because memory is allocated for the array of arguments -- do not call this method repeatedly in performance-critical scenarios This method is thread-safe. Resource string to load. Optional arguments for formatting the resource string. The formatted resource string. Formats the resource string with the given arguments. Ignores error codes and keywords Formats the given string using the variable arguments passed in. PERF WARNING: calling a method that takes a variable number of arguments is expensive, because memory is allocated for the array of arguments -- do not call this method repeatedly in performance-critical scenarios Thread safe. The string to format. Optional arguments for formatting the given string. The formatted string. Verifies that a particular resource string actually exists in the string table. This will only be called in debug builds. It helps catch situations where a dev calls VerifyThrowXXX with a new resource string, but forgets to add the resource string to the string table, or misspells it! This method is thread-safe. Resource string to check. Set of methods to deal with versions in the tasks Convert a version number like 0.0.0.0 to a Version instance. The method will return null if the string is not a valid value Version string to convert to a version object Go though an enumeration and create a sorted list of strings which can be parsed as versions. Keep around the original string because it may contain a v and this would be required to create the correct path on disk if the string was part of a path. Convert a version number like 0.0.0.0 to a Version instance. Should we use Parse to TryParse (parse means we throw an exception, tryparse means we will not). Static accessor for a ReverseVersionGenericComparer The Compare implements a reverse comparison Static accessor for a ReverseVersionGenericComparer The Compare implements a reverse comparison The list of directory names found from the config file. Construct. The path to the config file. The runtime version property from the project file. The to target. Get Enumerator Get enumerator A dictionary that has copy-on-write semantics. KEYS AND VALUES MUST BE IMMUTABLE OR COPY-ON-WRITE FOR THIS TO WORK. The value type. Thread safety: for all users, this class is as thread safe as the underlying Dictionary implementation, that is, safe for concurrent readers or one writer from EACH user. It achieves this by locking itself and cloning before any write, if it is being shared - i.e., stopping sharing before any writes occur. This class must be serializable as it is used for metadata passed to tasks, which may be run in a separate appdomain. Empty dictionary with a , used as the basis of new dictionaries with that comparer to avoid allocating new comparers objects. Empty dictionary with , used as the basis of new dictionaries with that comparer to avoid allocating new comparers objects. The backing dictionary. Lazily created. Constructor. Consider supplying a comparer instead. Constructor taking a specified comparer for the keys Serialization constructor, for crossing appdomain boundaries Cloning constructor. Defers the actual clone. Returns the collection of keys in the dictionary. Returns the collection of values in the dictionary. Returns the number of items in the collection. Returns true if the collection is read-only. IDictionary implementation IDictionary implementation IDictionary implementation IDictionary implementation IDictionary implementation IDictionary implementation IDictionary implementation Comparer used for keys Accesses the value for the specified key. IDictionary implementation Adds a value to the dictionary. Adds several value to the dictionary. Returns true if the dictionary contains the specified key. Removes the entry for the specified key from the dictionary. Attempts to find the value for the specified key in the dictionary. Adds an item to the collection. Clears the collection. Returns true ff the collection contains the specified item. Copies all of the elements of the collection to the specified array. Remove an item from the dictionary. Implementation of generic IEnumerable.GetEnumerator() Implementation of IEnumerable.GetEnumerator() IDictionary implementation. IDictionary implementation. IDictionary implementation. IDictionary implementation. IDictionary implementation. IDictionary implementation. Clone, with the actual clone deferred Returns true if these dictionaries have the same backing. Defines methods to support the comparison of objects for equality over constrained inputs. Determines whether the specified objects are equal, factoring in the specified bounds when comparing . Returns a hash code for the specified object factoring in the specified bounds. Interface allowing items and metadata and properties to go into keyed collections This can be internal as it is a constraint only on internal collections. Returns some value useful for a key in a dictionary This is a custom string comparer that has three advantages over the regular string comparer: 1) It can generate hash codes and perform equivalence operations on parts of a string rather than a whole 2) It uses "unsafe" pointers to maximize performance of those operations 3) It takes advantage of limitations on MSBuild Property/Item names to cheaply do case insensitive comparison. The processor architecture on which we are running, but default it will be x86 The default immutable comparer instance. Performs the "Equals" operation on two MSBuild property, item or metadata names Getting a case insensitive hash code for the msbuild property, item or metadata name A read-only wrapper over an empty collection. Thus this is an omission from the BCL. Type of element in the collection Backing live collection Private default constructor as this is a singleton Get the instance Pass through for underlying collection Returns true. Whether collection is synchronized Sync root Prohibited on read only collection: throws Prohibited on read only collection: throws Pass through for underlying collection Pass through for underlying collection Prohibited on read only collection: throws Get an enumerator over an empty collection Get an enumerator over an empty collection ICollection version of CopyTo A special singleton enumerable that enumerates a read-only empty dictionary Key Value The single instance The single instance Private default constructor as this is a singleton Get the instance Empty returns zero Returns true Gets empty collection Gets empty collection Is it fixed size Not synchronized No sync root Keys Values Keys Values Indexer Get returns null as read-only Set is prohibited and throws. Pass through for underlying collection Empty returns false Prohibited on read only collection: throws Empty returns false Prohibited on read only collection: throws Prohibited on read only collection: throws Empty returns false Empty does nothing Prohibited on read only collection: throws Get empty enumerator Get empty enumerator Add Contains Enumerator Remove CopyTo A debug only helper class for tracing A dictionary of named counters Last time logging happened How often to log A place callers can put something worth logging later Short name of the current assembly - to distinguish statics when this type is shared into different assemblies Put something in the slot Put something in the slot The key type. The value type. Increment the named counter, and dump if it's time to do so Log the provided items The item type. Dump all the named counters, if any Helper class for reading toolsets out of the configuration file. Lock for process wide ToolsetConfigurationSection section cache Process wide ToolsetConfigurationSection section cache Class representing the Toolset element Internal for unit testing only ToolsVersion attribute of the element Property element collection Collection of all the search paths for project imports, per OS Class representing all the per-OS search paths for MSBuildExtensionsPath* We use this dictionary to track whether or not we've seen a given searchPaths definition before, since the .NET configuration classes won't perform this check without respect for case. Type of the collection This has to be public as cannot change access modifier when overriding Throw exception if an element with a duplicate key is added to the collection Name of the element Gets an element with the specified name OS of the element element Gets an element based at the specified position position element Returns the key value for the given element element whose key is returned key Creates a new element of the collection Created element overridden so we can track previously seen elements overridden so we can track previously seen elements Stores the name of the OS in a case-insensitive map so we can detect if it is specified more than once but with different case Class representing searchPaths element for a single OS OS attribute of the element Property element collection Class representing collection of property elements We use this dictionary to track whether or not we've seen a given property definition before, since the .NET configuration classes won't perform this check without respect for case. Collection type This has to be public as cannot change access modifier when overriding Throw exception if an element with a duplicate is added name of the element Gets an element with the specified name name of the element element Gets an element at the specified position position element Creates a new element element overridden so we can track previously seen property names overridden so we can track previously seen property names Gets the key for the element element key Stores the name of the tools version in a case-insensitive map so we can detect if it is specified more than once but with different case This class represents property element name attribute value attribute Class representing the collection of toolset elements Internal for unit testing only We use this dictionary to track whether or not we've seen a given toolset definition before, since the .NET configuration classes won't perform this check without respect for case. Type of the collection This has to be public as cannot change access modifier when overriding Throw exception if an element with a duplicate key is added to the collection Name of the element Gets an element with the specified name toolsVersion of the element element Gets an element based at the specified position position element Returns the key value for the given element element whose key is returned key Creates a new element of the collection Created element overridden so we can track previously seen tools versions overridden so we can track previously seen tools versions Stores the name of the tools version in a case-insensitive map so we can detect if it is specified more than once but with different case This class is used to programmatically read msbuildToolsets section in from the configuration file. An example of application config file: <configuration> <msbuildToolsets default="2.0"> <toolset toolsVersion="2.0"> <property name="MSBuildBinPath" value="D:\windows\Microsoft.NET\Framework\v2.0.x86ret\"/> <property name="SomeOtherProperty" value="SomeOtherPropertyValue"/> </toolset> <toolset toolsVersion="3.5"> <property name="MSBuildBinPath" value="D:\windows\Microsoft.NET\Framework\v3.5.x86ret\"/> </toolset> </msbuildToolsets> </configuration> Internal for unit testing only toolsVersion element collection default attribute on msbuildToolsets element, specifying the default ToolsVersion MsBuildOverrideTasksPath attribute on msbuildToolsets element, specifying the path to find msbuildOverrideTasks files DefaultOverrideToolsVersion attribute on msbuildToolsets element, specifying the toolsversion that should be used by default to build projects with this version of MSBuild.