Microsoft.Build.Tasks.Core
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.
IKeyComparer implementation that compares AssemblyNames for using in Hashtables.
Comparer for two assembly name extensions
Comparer for two assembly name extensions
Comparer for two assembly name extensions
Comparer for two assembly name extensions
Should the comparer consider the retargetable flag when doing comparisons
Private construct so there's only one instance.
Compare o1 and o2 as AssemblyNames.
Treat o1 and o2 as AssemblyNames. Are they equal?
Get a hashcode for AssemblyName.
Determine if the assembly name extensions are equal
Get a hashcode for AssemblyName.
Compare the version numbers only for an AssemblyNameExtension and make sure they are in reverse order. This assumes the names are the same.
A static instance of the comparer for use in a sort method
Compare x and y by version only.
Change the return value to sort the values in reverse order.
If x is greater than y return -1 indicating x is less than y.
If x is less than y return 1 indicating x is greater than y.
If x and y are equal return 0.
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.
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 file IO.
It is in a separate file so that it can be selectively included into an assembly.
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
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.
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.
This class contains only static methods, which are useful throughout many
of the XMake classes and don't really belong in any specific class.
Convert a task item metadata to bool. Throw an exception if the string is badly formed and can't
be converted.
If the metadata is not found, then set metadataFound to false and then return false.
The item that contains the metadata.
The name of the metadata.
Receives true if the metadata was found, false otherwise.
The resulting boolean value.
Convert a task item metadata to bool. Throw an exception if the string is badly formed and can't
be converted.
If the attribute is not found, then return false.
The item that contains the metadata.
The name of the metadata.
The resulting boolean value.
A class with string-like semantics mapped over a Stream.
The raw binary stream that's being read.
The reader on top of binaryStream. This is what interprets the encoding.
When false, try to guess the encoding of binaryStream. When true, force the
encoding to ANSI.
The page number that 'currentPage' is pointing to.
The final page number of the whole stream.
The number of characters read into currentPage.
The page before currentPage.
The most recently read page.
Count of the total number of pages allocated.
Size of pages to use for reading from source file.
Construct.
The raw binary stream that's being read.
When false, try to guess the encoding of binaryStream. When true, force the encoding to ANSI.
Construct.
The raw binary stream that's being read.
When false, try to guess the encoding of binaryStream. When true, force the encoding to ANSI.
Size of pages to use for reading from source file.
Restart the stream reader at the beginning.
Get the total number of pages allocated.
The pagesize in characters that will be used if not specified.
Return a particular character within the file.
Get the page that contains offset. Otherwise, null.
Read the next page.
Read characters from the file, and strip out any 1A characters.
Add one character to the end of the stream.
Retrieve the last character in the stream.
Swap the current page for the last page.
True if this stream is zero length.
COnvert from absolute offset to relative offset within a particular page.
Convert from offset to page number.
Returns true of the given position is passed the end of the file.
Extract a substring.
Returns the number of characters on the page given by offset.
Utility functions for classifying characters that might be found in a sources file.
Determine whether a given character is a newline character
Determine whether a given character is a letter character
Determine whether a given character is a decimal digit character
Determine whether a given character is a connecting character
Determine whether a given character is a combining character
Determine whether a given character is a C# formatting character
Determine whether a given character is a hex digit character
Determine whether a given character is an octal digit character
See if the next characters match the given string. If they do, sink this string.
Construct.
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 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.
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.
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
Shared Visual Studio related constants
This is the version number of the most recent solution file format
we will read. It will be the version number used in solution files
by the latest version of Visual Studio.
This is the version number of the latest version of Visual Studio.
We use it for the version of the VC PIA we try to load and to find
Visual Studio registry hive that we use to find where vcbuild.exe might be.
Specifies the parts of the assembly name to partially match
Compare SimpleName A.PartialCompare(B,SimpleName) match the simple name on A and B if the simple name on A is not null.
Compare Version A.PartialCompare(B, Version) match the Version on A and B if the Version on A is not null.
Compare Culture A.PartialCompare(B, Culture) match the Culture on A and B if the Culture on A is not null.
Compare PublicKeyToken A.PartialCompare(B, PublicKeyToken) match the PublicKeyToken on A and B if the PublicKeyToken on A is not null.
When doing a comparison A.PartialCompare(B, Default) compare all fields of A which are not null with B.
A replacement for AssemblyName that optimizes calls to FullName which is expensive.
The assembly name is represented internally by an AssemblyName and a string, conversion
between the two is done lazily on demand.
Set of assemblyNameExtensions that THIS assemblyname was remapped from.
Construct an unnamed assembly.
Private because we want only one of these.
Construct with AssemblyName.
Construct with string.
Construct from a string, but immediately construct a real AssemblyName.
This will cause an exception to be thrown up front if the assembly name
isn't well formed.
The string version of the assembly name.
Used when the assembly name comes from a user-controlled source like a project file or config file.
Does extra checking on the assembly name and will throw exceptions if something is invalid.
Ctor for deserializing from state file (binary serialization).
This is required because AssemblyName is not Serializable on .NET Core.
Ctor for deserializing from state file (custom binary serialization) using translator.
To be used as a delegate. Gets the AssemblyName of the given file.
Run after the object has been deserialized
Initialize the remapped from structure.
Create remappedFrom HashSet. Used by deserialization as well.
Assume there is a string version, create the AssemblyName version.
Assume there is a string version, create the AssemblyName version.
The base name of the assembly.
Gets the backing AssemblyName, this can be None.
The assembly's version number.
Is the assembly a complex name or a simple name. A simple name is where only the name is set
a complex name is where the version, culture or publickeytoken is also set
Does the fullName have the processor architecture defined
Replace the current version with a new version.
The assembly's Culture
The assembly's retargetable bit
The full name of the original extension we were before being remapped.
Add an assemblyNameExtension which represents an assembly name which was mapped to THIS assemblyName.
As an AssemblyName
The assembly's full name.
Get the assembly's public key token.
A special "unnamed" instance of AssemblyNameExtension.
Compare one assembly name to another.
Compare one assembly name to another.
Get a hash code for this assembly name.
Compare two base names as quickly as possible.
An implementation of compare that compares two base
names as quickly as possible.
Compare two basenames.
Clone this assemblyNameExtension
Clone the object but mark and mark the cloned object as immutable
Is this object immutable
Mark this object as immutable
Compare two assembly names for equality.
Interface method for IEquatable<AssemblyNameExtension>
Compare two assembly names for equality ignoring version.
Compare two assembly names and consider the retargetable flag during the comparison
Compare two assembly names for equality.
Allows the comparison of the culture.
Allows the comparison of just the PublicKeyToken
Compare two public key tokens.
Only the unnamed assembly has both null assemblyname and null string.
Given a display name, construct an assembly name.
The display name.
The assembly name.
Return a string that has AssemblyName special characters escaped.
Those characters are Equals(=), Comma(,), Quote("), Apostrophe('), Backslash(\).
WARNING! This method is not meant as a general purpose escaping method for assembly names.
Use only if you really know that this does what you need.
Convert to a string for display.
Compare the fields of this with that if they are not null.
Compare the fields of this with that if they are not null.
Do a partial comparison between two assembly name extensions.
Compare the fields of A and B on the following conditions:
1) A.Field has a non null value
2) The field has been selected in the comparison flags or the default comparison flags are passed in.
If A.Field is null then we will not compare A.Field and B.Field even when the comparison flag is set for that field unless skipNullFields is false.
Do a partial comparison between two assembly name extensions.
Compare the fields of A and B on the following conditions:
1) A.Field has a non null value
2) The field has been selected in the comparison flags or the default comparison flags are passed in.
If A.Field is null then we will not compare A.Field and B.Field even when the comparison flag is set for that field unless skipNullFields is false.
Reads/writes this class
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 contains only static methods, which are useful throughout many
of the MSBuild classes and don't really belong in any specific class.
Converts a string to a bool. We consider "true/false", "on/off", and
"yes/no" to be valid boolean representations in the XML.
The string to convert.
Boolean true or false, corresponding to the string.
Returns a hex representation of a byte array.
The bytes to convert
A string byte types formated as X2.
Returns true if the string can be successfully converted to a bool,
such as "on" or "yes"
Returns true if the string represents a valid MSBuild boolean true value,
such as "on", "!false", "yes"
Returns true if the string represents a valid MSBuild boolean false value,
such as "!on" "off" "no" "!true"
Converts a string like "123.456" into a double. Leading sign is allowed.
Converts a hex string like "0xABC" into a double.
Converts a string like "123.456" or "0xABC" into a double.
Tries decimal conversion first.
Returns true if the string is a valid hex number, like "0xABC"
Returns true if the string is a valid decimal number, like "-123.456"
Returns true if the string is a valid decimal or hex number
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.
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.
This class contains only static methods, which are used in both the
tasks and graph projects in order for two projects to negotiate which platform a projectreference
should be built as.
Contains the names of the known attributes in the XML project file.
Returns true if and only if the specified attribute is one of the attributes that the engine specifically recognizes
on a task and treats in a special way.
true, if given attribute is a reserved task attribute
Checks if the specified attribute is a reserved task attribute with incorrect casing.
true, if the given attribute is reserved and badly cased
Indicates if the specified attribute cannot be used for batching targets.
true, if a target cannot batch on the given attribute
Returns true if the given string is a valid member of the MSBuildRuntimeValues set
Returns true if the given string is a valid member of the MSBuildArchitectureValues set
Compares two members of MSBuildRuntimeValues, returning true if they count as a match, and false otherwise.
Given two MSBuildRuntime values, returns the concrete result of merging the two. If the merge fails, the merged runtime
string is returned null, and the return value of the method is false. Otherwise, if the merge succeeds, the method returns
true with the merged runtime value. E.g.:
"CLR4" + "CLR2" = null (false)
"CLR2" + "don't care" = "CLR2" (true)
"current runtime" + "CLR4" = "CLR4" (true)
"current runtime" + "don't care" = "CLR4" (true)
If both specify "don't care", then defaults to the current runtime -- CLR4.
A null or empty string is interpreted as "don't care".
Compares two members of MSBuildArchitectureValues, returning true if they count as a match, and false otherwise.
Given an MSBuildRuntime value that may be non-explicit -- e.g. "CurrentRuntime" or "Any" --
return the specific MSBuildRuntime value that it would map to in this case. If it does not map
to any known runtime, just return it as is -- maybe someone else knows what to do with it; if
not, they'll certainly have more context on logging or throwing the error.
Given two MSBuildArchitecture values, returns the concrete result of merging the two. If the merge fails, the merged architecture
string is returned null, and the return value of the method is false. Otherwise, if the merge succeeds, the method returns
true with the merged architecture value. E.g.:
"x86" + "x64" = null (false)
"x86" + "don't care" = "x86" (true)
"current architecture" + "x86" = "x86" (true) on a 32-bit process, and null (false) on a 64-bit process
"current architecture" + "don't care" = "x86" (true) on a 32-bit process, and "x64" (true) on a 64-bit process
A null or empty string is interpreted as "don't care".
If both specify "don't care", then defaults to whatever the current process architecture is.
Returns the MSBuildArchitecture value corresponding to the current process' architecture.
Revisit if we ever run on something other than Intel.
Returns the MSBuildRuntime value corresponding to the current process' runtime.
Given an MSBuildArchitecture value that may be non-explicit -- e.g. "CurrentArchitecture" or "Any" --
return the specific MSBuildArchitecture value that it would map to in this case. If it does not map
to any known architecture, just return it as is -- maybe someone else knows what to do with it; if
not, they'll certainly have more context on logging or throwing the error.
Contains the names of the known elements in the XML project file.
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.
Replacement for BinaryReader which attempts to intern the strings read by ReadString.
The maximum size, in bytes, to read at once.
A cache of recently used buffers. This is a pool of size 1 to avoid allocating moderately sized
objects repeatedly. Used in scenarios that don't have a good context to attach
a shared buffer to.
Shared buffer saves allocating these arrays many times.
True if is owned by this instance, false if it was passed by the caller.
The decoder used to translate from UTF8 (or whatever).
Comment about constructing.
Read a string while checking the string precursor for intern opportunities.
Taken from ndp\clr\src\bcl\system\io\binaryreader.cs-ReadString()
A shared buffer to avoid extra allocations in InterningBinaryReader.
The caller is responsible for managing the lifetime of the returned buffer and for passing it to .
A placeholder instructing InterningBinaryReader to use pooled buffer (to avoid extra allocations).
Lifetime of the pooled buffer is managed by InterningBinaryReader (tied to BinaryReader lifetime wrapping the buffer)
Gets a buffer from the pool or creates a new one.
The . Should be returned to the pool after we're done with it.
Returns our buffer to the pool if we were not passed one by the caller.
Create a BinaryReader. It will either be an interning reader or standard binary reader
depending on whether the interning reader is possible given the buffer and stream.
Holds thepreallocated buffer.
Yes, we are constructing.
The char buffer.
The byte buffer.
This class provides helper methods to adapt from to
.
Translates an object implementing which does not expose a
public parameterless constructor.
The reference type.
The translator
The value to be translated.
The factory method used to instantiate values of type T.
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
Contains information about entries in the AssemblyFoldersEx registry keys.
Set of files in ALL AssemblyFolderFromConfig directories
File exists delegate we are replacing
Should we use the original on or use our own
Constructor
AssemblyfoldersEx object which contains the set of directories in assmblyfoldersFromConfig
Fast file exists for AssemblyFoldersFromConfig.
Resolve search path type {AssemblyFolderFromConfig: *}
Regex for breaking up the search path pieces.
Whether or not the search path could be cracked.
From the search path.
Whether regex initialization has happened.
List of assembly folders to search for keys in.
BuildEngine
Task log context.
Path to the assembly folder config file.
If it is not initialized then just return the null object, that would mean the resolver was not called.
Construct.
Initialize this class if it hasn't been initialized yet.
Collection of assembly attributes.
Information about a managed assembly.
After initial construction, this object is readonly and data-only,
allowing it to be safely cached.
Combines items that represent properties and values into an XML representation.
The root element name to use for the generated XML string
Items to include in the XML. The ItemSpec should be the property name, and it should have Value metadata for its value.
Opts into or out of using the new schema with Property Name=... rather than just specifying the RootElementName.
The generated XML representation of the properties and values.
Combines multiple XML elements
The root element name to use for the generated XML string
The XML elements to include as children of the root element
The generated XML
Task to call Path.GetFullPath
The list of paths to convert to absolute paths.
This is the output of the task, a list of absolute paths for the items passed in
Calls Path.GetFullPath for each of the inputs. Preserves metadata.
true on success, false on failure
Given a string of semi-colon delimited name=value pairs, this method parses it and creates
a hash table containing the property names as keys and the property values as values.
true on success, false on failure.
Given a string of semi-colon delimited name=value pairs, this method parses it and creates
a hash table containing the property names as keys and the property values as values.
This method escapes any special characters found in the property values, in case they
are going to be passed to a method (such as that expects the appropriate escaping to have happened
already.
true on success, false on failure.
A very simple class that holds two strings, a property name and property value.
Property name
Property value fragments. Join with semicolon to get the final value.
Helper logging class for tasks, used for dealing with two resource streams.
public constructor
Used to load culture-specific resources. Derived classes should register their resources either during construction, or
via this property, if they have localized strings.
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.
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.
Read information from application .config files.
Read the .config from a file.
Read the .config from an XmlReader
Access the Runtime section of the application .config file.
App.config files seem to come with mixed casing for element and attribute names.
If the fusion loader can handle this then this code should too.
An exception thrown while parsing through an app.config.
The name of the app.config file.
The line number with the error. Is initialized to zero
The column with the error. Is initialized to zero
Construct the exception.
Construct the exception.
Represents a single <bindingRedirect> from the app.config file.
The low end of the old version range.
The high end of the old version range.
The new version number.
The reader is positioned on a <bindingRedirect> element--read it.
Represents a single <dependentassembly> from the app.config file.
The partial , there should be no version.
Setter and Getter clone the incoming / outgoing assembly
The full . It is not cloned. Callers should not mutate this object.
The reader is positioned on a <dependentassembly> element--read it.
The binding redirects.
Wraps the <runtime> section of the .config file.
The reader is positioned on a <runtime> element--read it.
Return the collection of dependent assemblies for this runtime element.
Resolve searchpath type {Registry: *}
Regex for breaking up the searchpath pieces.
Delegate.
Delegate
Open the base registry key given a hive and a view
Whether or not the search path could be cracked.
From the search path.
From the search path.
From the search path.
From the search path.
From the search path.
Whether regex initialization has happened.
List of assembly folders to search for keys in.
BuildEngine
If it is not initialized then just return the null object, that would mean the resolver was not called.
Construct.
Initialize this class if it hasn't been initialized yet.
Contains information about entries in the AssemblyFoldersEx registry keys.
Set of files in ALL assemblyfoldersEx directories
File exists delegate we are replacing
Should we use the original on or use our own
Constructor
AssemblyfoldersEx object which contains the set of directories in assmblyfoldersex
Fast file exists for assemblyfoldersex.
Resolve searchpath type {AssemblyFolders}
Construct.
The corresponding element from the search path.
Delegate that gets the assembly name.
Delegate that returns if the file exists.
Delegate that returns the clr runtime version for the file.
The targeted runtime version.
Collection of methods used to discover assembly metadata.
Primarily stolen from manifestutility.cs AssemblyMetaDataImport class.
Construct an instance for a source file.
The assembly.
Get the dependencies.
Get the scatter files from the assembly metadata.
What was the framework name that the assembly was built against.
Given an assembly name, crack it open and retrieve the list of dependent
assemblies and the list of scatter files.
Path to the assembly.
Cache of pre-extracted assembly metadata.
Receives the list of dependencies.
Receives the list of associated scatter files.
Gets the assembly name.
Given an assembly name, crack it open and retrieve the TargetFrameworkAttribute
assemblies and the list of scatter files.
Determine if an file is a winmd file or not.
Collects the metadata and attributes for specified assembly.
The requested properties are used by legacy project system.
Get the framework name from the assembly.
Release interface pointers on Dispose().
Given a path get the CLR runtime version of the file
path to the file
The CLR runtime version or empty if the path does not exist.
Import assembly dependencies.
The array of assembly dependencies.
Import extra files. These are usually consituent members of a scatter assembly.
The extra files of assembly dependencies.
Allocate assembly metadata structure buffer.
Pointer to structure
Construct assembly name.
Assembly metadata structure
Buffer containing the name
Length of that buffer
Pointer to public key
Count of bytes in public key.
Extra flags
The assembly name.
Free the assembly metadata structure.
The pointer.
Free the assembly metadata structure.
The pointer.
Marshaled assembly metadata to the managed type.
Managed implementation of a reader for getting the runtime version of an assembly
Given a path get the CLR runtime version of the file.
path to the file
The CLR runtime version or empty if the path does not exist or the file is not an assembly.
Given a get the CLR runtime version of the underlying file.
A positioned at the first byte of the file.
The CLR runtime version or empty if the data does not represent an assembly.
An assembly name coupled with reference information.
Display as string.
Compare by assembly name.
Construct a new AssemblyNameReference.
Compare the two AssemblyNameReferences by version number.
Private construct so there's only one instance.
Compare the two AssemblyNameReferences by version number.
Utility class encapsulates steps to resolve assembly references.
For example, this class has the code that will take:
System.Xml
and turn it into:
[path-to-frameworks]\System.Xml.dll
Implementation guts for ResolveReference.
The array of resolvers to search with.
The assembly name to look up.
The file name to match if {RawFileName} is seen. (May be null).
True if this is a primary reference directly from the project file.
True if is immutable and guaranteed to exist.
The filename extension of the assembly. Must be this or its no match.
This reference's hintpath
Like "hklm\Vendor RegKey" as provided to a reference by the <AssemblyFolderKey> on the reference in the project.
Receives the list of locations that this function tried to find the assembly. May be "null".
Receives the searchPath that the reference was resolved at. Empty if not resolved.
This will be true if the user requested a specific file.
The resolved path
Compile search paths into an array of resolvers.
Paths to assembly files mentioned in the project.
Like x86 or IA64\AMD64, the processor architecture being targetted.
Paths to FX folders.
Build a resolver array from a set of directories to resolve directly from.
Constants used for assembly resolution.
Special hintpath indicator. May be passed in where SearchPaths are taken.
Special AssemblyFolders indicator. May be passed in where SearchPaths are taken.
Special CandidateAssemblyFiles indicator. May be passed in where SearchPaths are taken.
Special GAC indicator. May be passed in where SearchPaths are taken.
Special Framework directory indicator. May be passed in where SearchPaths are taken.
Special SearchPath indicator that means: match against the assembly item's Include as
if it were a file.
Special AssemblyFoldersEx indicator. May be passed in where SearchPaths are taken.
Special AssemblyFoldersFromConfig indicator. May be passed in where SearchPaths are taken.
The reference points to a bad image.
Construct
Construct
Gets a message that describes the exception.
Resolve searchpath type {CandidateAssemblyFiles}
The candidate assembly files.
Construct.
List of literal assembly file names to be considered when SearchPaths has {CandidateAssemblyFiles}.
The corresponding element from the search path.
Delegate that gets the assembly name.
Delegate that returns if the file exists.
Delegate that returns the clr runtime version for the file.
The targeted runtime version.
If this reference lost in a conflict with another reference, this reason explains
why.
This reference didn't lose a conflict.
This reference matched another assembly that had a higher version number.
The two assemblies cannot be reconciled.
In this case, this reference was a dependency and the other reference was
primary (specified in the project file).
The two references were equivalent according to fusion and also have the same version.
Its hard to see how this could happen, but handle it.
The value of the copyLocal flag and why it was set that way.
The copy local state is undecided right now.
The Reference should be CopyLocal='true' because it wasn't 'no' for any reason.
The Reference should be CopyLocal='true' because its source item has Private='true'
The Reference should be CopyLocal='false' because it is a framework file.
The Reference should be CopyLocal='false' because it is a prerequisite file.
The Reference should be CopyLocal='false' because the Private attribute is set to 'false' in the project.
The Reference should be CopyLocal='false' because it was resolved from the GAC.
Legacy behavior, CopyLocal='false' when the assembly is found in the GAC (even when it was resolved elsewhere).
The Reference should be CopyLocal='false' because it lost a conflict between an same-named assembly file.
The reference was unresolved. It can't be copied to the bin directory because it wasn't found.
The reference was embedded. It shouldn't be copied to the bin directory because it won't be loaded at runtime.
The property copyLocalDependenciesWhenParentReferenceInGac is set to false and all the parent source items were found in the GAC.
The "assembly" should not be copied because it is a bad image—possibly not managed, possibly not an assembly at all.
Helper methods for dealing with CopyLocalState enumeration.
Returns the true or false from a CopyLocalState.
Exception indicates a problem finding dependencies of a reference.
Construct
Construct
Resolve when the searchpath type is a simple directory name.
The parent assembly that was used for the SearchPath.
Construct.
Resolve searchpath type {TargetFrameworkDirectory}
Construct.
If the version is not set for an assembly reference, go through the redist list and find the highest version for that assembly.
Make sure when matching the assembly in the redist that we take into account the publicKeyToken and the Culture.
Take suggested redirects (from the ResolveAssemblyReference and GenerateOutOfBandAssemblyTables tasks)
and add them to an intermediate copy of the App.config file.
Sugested redirects as output from the ResolveAssemblyReference task.
Path to the app.config source file.
Name of the output application config file: $(TargetFileName).config
Path to an intermediate file where we can write the input app.config plus the generated binding redirects.
Execute the task.
Determins whether the name, culture, and public key token of the given assembly name "suggestedRedirect"
matches the name, culture, and publicKeyToken strings.
Determines whether string "s" is the hexdecimal representation of the byte array "a".
Going through all the binding redirects in the runtime node, if anyone overlaps with a RAR suggested redirect,
we update the existing redirect and output warning.
Load or create App.Config
Parse the suggested redirects from RAR and return a dictionary containing all those suggested redirects
in the form of AssemblyName-MaxVersion pairs.
Resolve searchpath type {HintPathFromItem}
Construct.
Utility methods that encapsulate well-known assemblies.
Construct.
Unify an assembly name according to the fx retarget rules.
The unify-from assembly name.
The new version number.
Whether this assembly will be available on target machines.
May be true, false or null. Null means there was no IsRedistRoot in the redist list.
Name of the corresponding Resist specified in the redist list.
We need to check to see if an assembly name is in our remapping list, if it is we should return a new assemblyNameExtension which has been remapped.
Remapping is usually used for portable libraries where we need to turn one assemblyName that is retargetable to another assemblyname.
Find the highest version of the assemblyName in the redist list for framework assemblies taking into account the simplename, culture and public key.
The name of the assembly we would like to find the highest version for
Key value pair, K: Assembly entry of highest value in the redist list. V: AssemblyNameExtension with the version information or null if the name could not be found
Given an assemblyNameExtension, is that assembly name in the redist list and does that redist name start with Microsoft-Windows-CLRCoreComp which indicates
the redist entry is a framework redist list rather than a 3rd part redist list.
Find every assembly full name in the redist list that matches the given simple name.
The array of assembly names.
There reference is not a well-formed fusion name *and* its not a file
that exists on disk.
Construct
Construct
The item spec of the item that is the source fo the problem.
Reasons why a resolution might fail.
The default state.
There was no file found.
The file was found, but its fusion name didn't match.
The file was found, but it didn't have a fusion name.
The file is not in the GAC.
If treated as a filename, the file doesn't exist on disk.
The processor architecture does not match the targeted processor architecture.
Resolve searchpath type {RawFileName}
Construct.
A reference to an assembly along with information about resolution.
dictionary where ITaskItem.ItemSpec (a string) is the key and ITaskItem is the value.
A hash table is used to remove duplicates.
All source items that inspired this reference (possibly indirectly through a dependency chain).
A list of unique dependencies.
Hashset of Reference which depend on this reference
A list of unique dependencies.
Scatter files associated with this reference.
Any errors that occurred while resolving or finding dependencies on this item.
Contains any file extension that are related to this file. Pdbs and xmls are related.
This is an extension string starting with "."
Contains satellite files for this reference.
This file path is relative to the location of the reference.
Contains serialization assembly files for this reference.
This file path is relative to the location of the reference.
AssemblyNames of references that lost collision conflicts with this reference.
These are the versions (type UnificationVersion) that were unified from.
The original source item, as passed into the task that is directly associated
with this reference. This only applies to "primary" references.
The full path to the assembly. If this is "", then that means that this reference
has not been resolved.
The directory that this reference lives in.
The reference's filename without extension.
The full path to the file name but without the extension.
The list of expected extensions.
Is the file a managed winmd file. That means it has both windows runtime and CLR in the imageruntime string.
The imageruntime version for this reference.
Set containing the names the reference was remapped from
Delegate to determine if the file is a winmd file or not
Delegate to check to see if the file exists on disk
Delegate to get the imageruntime version from a file.
Add items that caused (possibly indirectly through a dependency chain) this Reference.
Add items that caused (possibly indirectly through a dependency chain) this Reference.
We have had our source item list updated, we need to propagate this change to any of our dependencies so they have the new information.
Get the source items for this reference.
This is collection of ITaskItems.
Add a reference which this reference depends on
Add a reference that caused (possibly indirectly through a dependency chain) this Reference.
A dependee may be removed because it or its dependee's are in the deny list
A dependency may be removed because it may not be referenced any more due this reference being in the deny list or being removed due to it depending on something in the deny list
Get the dependee references for this reference.
This is collection of References.
Scatter files associated with this assembly.
Scatter files associated with this assembly.
Set one expected extension for this reference.
Get the list of expected extensions.
Whether the name needs to match exactly or just the simple name part needs to match.
Whether types need to be embedded into the target assembly
This will be true if the user requested a specific file. We know this when the file was resolved
by hintpath or if it was resolve as a raw file name for example.
The version number of this reference
True if the assembly was found to be in the GAC.
True if the assembly was resolved through the GAC. Otherwise, false.
Set of properties for this reference used to log why this reference could not be resolved.
Determines if a given reference or its parent primary references have specific version metadata set to true.
If anyParentHasMetadata is set to true then we will return true if any parent primary reference has the specific version metadata set to true,
if the value is false we will return true ONLY if all parent primary references have the metadata set to true.
Add a dependency or resolution error to this reference's list of errors.
The error.
Return the list of dependency or resolution errors for this item.
The collection of resolution errors.
Add a new related file to this reference.
Related files always live in the same directory as the reference.
Examples include, MyAssembly.pdb and MyAssembly.xml
This is the filename extension.
Return the list of related files for this item.
The collection of related file extensions.
Add a new satellite file
This is the filename relative the this reference.
Add a new serialization assembly file.
This is the filename relative the this reference.
Return the list of satellite files for this item.
The collection of satellit files.
Return the list of serialization assembly files for this item.
The collection of serialization assembly files.
The full path to the assembly. If this is "", then that means that this reference
has not been resolved.
The full path to this assembly.
The directory that this assembly lives in.
The file name without extension.
The full path to the assembly but without an extension on the file namee
This is the HintPath from the source item. This is used to resolve the assembly.
The hint path to this assembly.
This is the key that was passed in to the reference through the <AssemblyFolderKey> metadata.
The <AssemblyFolderKey> value.
Whether this assembly came from the project. If 'false' then this reference was deduced
through the reference resolution process.
'true' if this reference is a primary assembly.
Whether or not this reference will be installed on the target machine.
Whether or not this reference is a redist root.
The redist name for this reference (if any)
The original source item, as passed into the task that is directly associated
with this reference. This only applies to "primary" references.
If 'true' then the path that this item points to is known to be a bad image.
This item shouldn't be passed to compilers and so forth.
'true' if this reference points to a bad image.
If true, then this item conflicted with another item and lost.
Add a conflict victim to this reference
Return the list of conflict victims.
The name of the assembly that won over this reference.
The reason why this reference lost to another reference.
Is the file a WinMDFile.
Is the file a Managed.
For winmd files there may be an implementation file sitting beside the winmd called the assemblyName.dll
We need to attach a piece of metadata to if this is the case.
ImageRuntime Information
Return the list of versions that this reference is unified from.
Return the list of versions that this reference is unified from.
Add a new version number for a version of this reference
Add the AssemblyNames name we were remapped from
Whether or not this reference is unified from a different version or versions.
Whether this reference should be copied to the local 'bin' dir or not and the reason this flag
was set that way.
The current copy-local state.
Whether the reference should be CopyLocal. For the reason, see CopyLocalState.
'true' if this reference should be copied.
Whether this reference has already been resolved.
Resolved means that the actual filename of the assembly has been found.
'true' if this reference has been resolved.
Whether this reference can't be resolve.
References are usually unresolvable because they weren't found anywhere in the defined search paths.
'true' if this reference is unresolvable.
Whether or not we still need to find dependencies for this reference.
If the reference has an SDK name metadata this will contain that string.
Add some records to the table of assemblies that were considered and then rejected.
Returns a collection of strings. Each string is the full path to an assembly that was
considered for resolution but then rejected because it wasn't a complete match.
The searchpath location that the reference was found at.
FrameworkName attribute on this reference
Indicates that the reference is primary and has ExternallyResolved=true metadata to denote that
it was resolved by an external system (commonly from nuget). Such a system has already provided a
resolved closure as primary references and therefore we can skip the expensive closure walk.
Make this reference an assembly that is a dependency of 'sourceReference'
For example, if 'sourceReference' is MyAssembly.dll then a dependent assembly file
might be en\MyAssembly.resources.dll
Assembly references do not have their own dependencies, therefore they are
The source reference that this reference will be dependent on
Make this reference a primary assembly reference.
This is a refrence that is an assembly and is primary.
The source item.
Whether the version needs to match exactly or loosely.
The filename extension that the resulting assembly must have.
Determine whether the given assembly is an FX assembly.
The full path to the assembly.
The path to the frameworks.
True if this is a frameworks assembly.
Figure out the what the CopyLocal state of given assembly should be.
The name of the assembly.
The framework paths.
Like x86 or IA64\AMD64.
Delegate to get runtime version.
The targeted runtime version.
Delegate to check if a file exists.
Delegate to get the path to an assembly in the system GAC.
if set to true, copy local dependencies when only parent reference in gac.
If set to true, do not copy local a reference that exists in the GAC (legacy behavior).
The reference table.
Produce a string representation.
There are a number of properties which are set when we generate exclusion lists and it is useful to have this information on the references so that
the correct reasons can be logged for these references being in the deny list.
Is this reference in an exclusion list
What is the highest version of this assembly in the current redist list
What is the highest versioned redist list on the machine
Delegate which logs the reason for not resolving a reference
There was a problem resolving this reference into a full file name.
Construct
Implement required constructors for serialization
A table of references.
version 4.0
A mapping of a framework identifier to the most current redist list on the system based on the target framework identifier on the moniker.
This is used to determine if an assembly is in a redist list for the framework targeted by the moniker.
Reference simple names that were resolved by an external entity to RAR.
The keys are normalized full paths of primary references resolved by an external entity to RAR and considered immutable, the values are assembly names or null if not known.
The table of remapped assemblies. Used for Unification.
If true, then search for dependencies.
Should version be ignored for framework primary references
If true, then search for satellite files.
If true, then search for serialization assembly files.
If true, then search for related files.
If true, then force framework assembly version check against the target framework version
If false, the default behavior is to disable version checks for target framework versions 4.5 and above.
Path to the FX.
The allowed assembly extensions.
These are companion files that typically travel with assemblies
Locations where sdks are installed. K:SDKName v: Resolved Reference item
Path to installed assembly XML tables.
Like x86 or IA64\AMD64, the processor architecture being targetted.
Delegate used for checking for the existence of a file.
Delegate used for checking for the existence of a directory.
Delegate used for getting directories.
Delegate used for getting assembly names.
Delegate used for finding dependencies of a file.
Delegate used to get the image runtime version of a file
Delegate to get the base registry key for AssemblyFoldersEx
Version of the runtime we are targeting
Delegate used to get the machineType from the PE header of the dll.
Is the file a winMD file
Version of the framework targeted by this project.
Target framework moniker we are targeting.
Logging helper to allow the logging of meessages from the Reference Table.
List of framework directories which are the highest on the machine
Should dependencies be set to copy local if the parent reference is in the GAC
Shoould the framework attribute version mismatch be ignored.
Delegate to determine if an assembly name is in the GAC.
Should a warning or error be emitted on architecture mismatch
When we exclude an assembly from resolution because it is part of out exclusion list we need to let the user know why this is.
There can be a number of reasons each for un-resolving a reference, these reasons are encapsulated by a different deny list. We need to log a specific message
depending on which deny list we have found the offending assembly in. This delegate allows one to tie a set of logging messages to a deny list so that when we
discover an assembly in the deny list we can log the correct message.
Construct.
If true, then search for dependencies.
If true, then search for satellite files.
If true, then search for serialization assembly files.
If true, then search for related files.
Paths to search for dependent assemblies on.
List of literal assembly file names to be considered when SearchPaths has {CandidateAssemblyFiles}.
Resolved sdk items
Path to the FX.
Installed assembly XML tables.
Like x86 or IA64\AMD64, the processor architecture being targetted.
Delegate used for checking for the existence of a file.
Delegate used for files.
Delegate used for getting directories.
Delegate used for getting assembly names.
Delegate used for finding dependencies of a file.
Used to get registry subkey names.
Used to get registry default values.
Cache of metadata already read from paths.
Version of the runtime to target.
Version of the framework targeted by the project.
Target framework moniker we are targeting.
Logging helper to allow the logging of meessages from the Reference Table.
Set of resolvers the reference table uses.
Get a table of all vertices.
If assemblies have been marked for exclusion this contains the list of their full names
This may be null
Indicates that at least one reference was and
we skipped finding its dependencies as a result.
This is currently used to perform a shallow search for System.Runtime/netstandard usage
within the externally resolved graph.
Force dependencies to be walked even when a reference is marked with ExternallyResolved=true
metadata.
This is currently used to ensure that we suggest appropriate binding redirects for
assembly version conflicts within an externally resolved graph.
Adds a reference to the table.
The assembly name to be used as a key.
The reference to add.
Find the reference that corresponds to the given path.
The assembly name to find the reference for.
'null' if no reference existed.
Give an assembly file name, adjust a Reference to match it.
The reference to work on
The path to the assembly file.
The AssemblyName of assemblyFileName
Given a list of task items, add them all to this table and make them the only primary items.
The task items which contain file names to add.
The task items which contain fusion names to add.
Exceptions encountered while setting primary items. Exceptions are logged, but it doesn't stop the resolution process.
Given an item that refers to a assembly name, make it a primary reference.
The task item which contain fusion names to add.
Resulting exception containing resolution failure details, if any: too costly to throw it.
Attempts to convert an itemSpec and fusionName into an assembly name.
AssemblyName is left unchanged if conversion wasn't possible.
Given a string that may be a fusion name, try to gather the four essential properties:
Name
Version
PublicKeyToken
Culture
Attempt to get one field out of an assembly name.
Tries to create an out of a primary reference metadata.
Given an item that refers to a file name, make it a primary reference.
Find related files like .pdbs and .xmls
The reference to the parent assembly.
Find satellite assemblies.
The reference to the parent assembly.
Find serialization assemblies.
The reference to the parent assembly.
Get unified dependencies and scatter files for a reference.
Given an enumerator of pre-unified assembly names, return an enumerator of unified
assembly names.
Find references and scatter files defined for the given assembly.
The reference to the parent assembly.
New references are added to this list.
Mscorlib is not a real managed assembly. It is seen both with and without metadata.
We assume that the correct mscorlib is on the target platform.
Based on the set of parent assemblies we want to add their directories to the list of resolvers so that
if the dependency is sitting beside the assembly which requires it then we will resolve the assembly from that location first.
The only time we do not want to do this is if the parent assembly came from the GAC or AssemblyFoldersEx then we want the assembly
to be found using those resolvers so that our GAC and AssemblyFolders checks later on will work on those assemblies.
Given an unresolved reference (one that we don't know the full name for yet), figure out the
full name. Should only be called on references that haven't been resolved yet--otherwise, its
a perf problem.
The fusion name for this reference.
The file name to match if {RawFileName} is seen. (May be null).
The reference object.
This method will remove references from the reference table which are contained in the denylist.
References which are primary references but are in the deny list will be placed in the invalidResolvedFiles list.
References which are dependency references but are in the deny list will be placed in the invalidResolvedDependencyFiles list.
References usually only contains who they depend on, they do not know who depends on them. Given a reference
A we cannot inspect A to find out that B,C,D depend on it. This method will traverse the references and build up this other direction of the graph,
therefore we will be able to know given reference A, that B,C,D depend on it.
We have determined the given assembly reference is in the deny list, we now need to find the primary references which caused it and make sure those are removed from the list of references.
A primary references has been determined to be in the deny list, it needs to be removed from the list of references by not being added to the list of good references
and added to the list of removed references.
Get the primary reference based on the Itemspec
Go through the dependency graph and make sure that for a reference to remove that we get rid of all dependency assemblies which are not referenced by any other
assembly. The remove reference list should contain ALL primary references which should be removed because they, or one of their dependencies is in the deny list.
Reference to remove dependencies for
Reference list which contains reference to be used in unification and returned as resolved items
A dictionary (Key: Reference Value: List of dependencies and their assembly name)
Searches the table for references that haven't been resolved to their full file names and
for dependencies that haven't yet been found.
If any are found, they're resolved and then dependencies are found. Then the process is repeated
until nothing is left unresolved.
The table of remapped assemblies.
The task items which contain file names to add.
The task items which contain fusion names to add.
Errors encountered while computing closure.
Implementation of ComputeClosure.
Find associates for references that we haven't found associates for before.
Returns true if new dependent assemblies were found.
Resolve all references that have not been resolved yet to real files on disk.
This methods looks for conflicts between assemblies and attempts to
resolve them.
Based on the closure, get a table of ideal remappings needed to
produce zero conflicts.
If a reference is a higher version than what exists in the redist list of the target framework then
this reference needs to be marked as excluded so that it is not allowed to be referenced.
If the user needs this reference then they need to set specific version to true.
Is the assembly in the latest framework redist list as either passed into RAR on the lastestFrameworkDirectories property or determined by inspecting the file system.
Get the redist list which corresponds to the highest target framework for a given target framework moniker.
This is done in two ways:
First, if the latestTargetFrameworkDirectories parameter is passed into RAR those directories will be used to get the redist list
regardless of the target framework moniker.
Second, if latest Target Framework Directories is not passed in then we ask the ToollocationHelper for the highest target framework which has
a TargetFrameworkIdentifier which matches the passed in TargetFrameworkMoniker.
Based on a target framework moniker, get the set of reference assembly directories which
correspond to the highest version of the target framework identifier property on the target framework moniker.
Is the assemblyName in the current redist list and does it have a version number which is higher than what is in the current redist list.
This may happen if someone passes in a p2p reference whcih is a framework assembly which is a higher version than what is in the redist list.
Is the assemblyName in the current redist list and does it have a version number which is higher than what is in the current redist list.
This may happen if someone passes in a p2p reference whcih is a framework assembly which is a higher version than what is in the redist list.
Does the assembly have a targetFrameworkAttribute which has a higher framework version than what the project is currently targeting.
This may happen for example if a p2p is done between two projects with built against different target frameworks.
Build a table of simple names mapped to assemblyname+reference.
Compares two assembly identities to determine whether or not they are equivalent.
Textual identity of the first assembly to be compared.
Flag to indicate user-specified unification for assemblyIdentity1.
Textual identity of the second assembly to be compared.
Flag to indicate user-specified unification for assemblyIdentity2.
Boolean indicating whether the identities are equivalent.
Given two references along with their fusion names, resolve the filename conflict that they
would have if both assemblies need to be copied to the same directory.
Returns true if an assembly has been removed from the .NET framework
Get unification information for the given assembly name.
The assembly name.
The new version of the assembly to use.
The reason this reference was unified.
True if this is a prereq assembly.
May be true, false or null. Null means there was no IsRedistRoot in the redist list.
Name of the corresponding Resist specified in the redist list.
True if there was a unification.
Used to avoid extra allocations from cloning AssemblyNameExtension and AssemblyName
Return the resulting reference items, dependencies and other files.
Primary references fully resolved.
Dependent references fully resolved.
Related files like .xmls and .pdbs.
Satellite files.
Serialization assembly files.
Receives the list of associated scatter files.
All copy-local files out of primaryFiles+dependencyFiles+relatedFiles+satelliteFiles.
Set metadata on the items which will be output from RAR.
Verify that the implementation dll has a matching architecture to what the project is targeting.
Read the PE header to get the machine type
Some metadata should not be forwarded between the parent and child items.
The metadata that were removed.
Given a list of items, find all that have CopyLocal==true and add it to the list.
The reference was determined to have a version which is higher than what is in the currently targeted redist list.
The reference was determined to have a version which is higher than what is in the currently targeted using the framework attribute.
The reference was determined to not be in the current redist list but in fact are from another framework.
The reference was found to be resolved from a full framework while we are actually targeting a profile.
Provide a class which has a key value pair for references and their assemblyNameExtensions.
This is used to prevent JIT'ing when using a generic list.
Rather than have exclusion lists float around, we may as well just mark the reference themselves. This allows us to attach to a reference
whether or not it is excluded and why. This method will do a number of checks in a specific order and mark the reference as being excluded or not.
Returns true if the full path passed in represents a file that came from an external trusted
entity and is guaranteed to be immutable.
The path to check.
True if known to be immutable, false otherwise.
Returns the assembly name of a file if the file came from an external trusted entity and is considered immutable.
The file path.
Assembly name or null if not known.
A place the resolver tried to look for an assembly along with some information
that can be used to provide a good error message.
The name of the file that was attempted to match.
The literal searchpath element that was used to discover this location.
The parent assembly that was used for the SearchPath.
The name of the assembly found at that location. Will be null if there was no assembly there.
The reason there was no macth.
Base class for all resolver types.
The corresponding element from the search path.
Delegate.
Delegate.
Delegate
Runtime we are targeting
Processor architecture we are targeting.
Should the processor architecture we are targeting match the assembly we resolve from disk.
Construct.
Resolve a reference to a specific file name.
The assemblyname of the reference.
The name of the sdk to resolve.
The reference's 'include' treated as a raw file name.
Whether or not this reference was directly from the project file (and therefore not a dependency)
True if is guaranteed to exist on disk and never change.
Whether an exact version match is requested.
Allowed executable extensions.
The item's hintpath value.
Like "hklm\Vendor RegKey" as provided to a reference by the <AssemblyFolderKey> on the reference in the project.
Receives the list of locations that this function tried to find the assembly. May be "null".
The path where the file was found.
Whether or not the user wanted a specific file (for example, HintPath is a request for a specific file)
True if the file was resolved.
The search path element that this resolver is based on.
Resolve a single file.
True if the file was a match, false otherwise.
Determines whether an assembly name matches the assembly pointed to by pathToCandidateAssembly
The assembly name to look up.
True if this is a primary reference directly from the project file.
Whether the version needs to match exactly or loosely.
Whether to allow naming mismatch.
Path to a possible file.
Information about why the candidate file didn't match
Given a strong name, which may optionally have Name, Version and Public Key,
return a fully qualified directory name.
The assembly name to look up.
True if this is a primary reference directly from the project file.
Whether an exact version match is requested.
The possible filename extensions of the assembly. Must be one of these or its no match.
the directory to look in
Receives the list of locations that this function tried to find the assembly. May be "null".
'null' if the assembly wasn't found.
Given a list of assemblyFiles, determine the closure of all assemblyFiles that
depend on those assemblyFiles including second and nth-order dependencies too.
key assembly used to trigger inclusion of facade references.
additional key assembly used to trigger inclusion of facade references.
The well-known CLR 4.0 metadata version used in all managed assemblies.
Delegate to a method that takes a targetFrameworkDirectory and returns an array of redist or subset list paths
TargetFramework directory to search for redist or subset list
String array of redist or subset lists
Cache of system state information, used to optimize performance.
Construct
If set to true, it forces to unresolve framework assemblies with versions higher or equal the version of the target framework, regardless of the target framework
If there is a mismatch between the targetprocessor architecture and the architecture of a primary reference.
When this is error, an error will be logged.
When this is warn, if there is a mismatch between the targetprocessor architecture and the architecture of a primary reference a warning will be logged.
When this is none, no error or warning will be logged.
A list of fully qualified paths-to-assemblyFiles to find dependencies for.
Optional attributes are:
bool Private [default=true] -- means 'CopyLocal'
string FusionName -- the simple or strong fusion name for this item. If this
attribute is present it can save time since the assembly file won't need
to be opened to get the fusion name.
bool ExternallyResolved [default=false] -- indicates that the reference and its
dependencies are resolved by an external system (commonly from nuget assets) and
so several steps can be skipped as an optimization: finding dependencies,
satellite assemblies, etc.
The list of directories which contain the redist lists for the most current
framework which can be targeted on the machine. If this is not set
Then we will looks for the highest framework installed on the machine
for a given target framework identifier and use that.
Should the framework attribute be ignored when checking to see if an assembly is compatible with the targeted framework.
Force dependencies to be walked even when a reference is marked with ExternallyResolved=true
metadata.
This is used to ensure that we suggest appropriate binding redirects for assembly version
conflicts within an externally resolved graph.
If true, outputs any unresolved assembly conflicts (MSB3277) in UnresolvedAssemblyConflicts.
List of target framework subset names which will be searched for in the target framework directories
These can either be simple fusion names like:
System
or strong names like
System, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
These names will be resolved into full paths and all dependencies will be found.
Optional attributes are:
bool Private [default=true] -- means 'CopyLocal'
string HintPath [default=''] -- location of file name to consider as a reference,
used when {HintPathFromItem} is one of the paths in SearchPaths.
bool SpecificVersion [default=absent] --
when true, the exact fusionname in the Include must be matched.
when false, any assembly with the same simple name will be a match.
when absent, then look at the value in Include.
If its a simple name then behave as if specific version=false.
If its a strong name then behave as if specific version=true.
string ExecutableExtension [default=absent] --
when present, the resolved assembly must have this extension.
when absent, .dll is considered and then .exe for each directory looked at.
string SubType -- only items with empty SubTypes will be considered. Items
with non-empty subtypes will be ignored.
string AssemblyFolderKey [default=absent] -- supported for legacy AssemblyFolder
resolution. This key can have a value like 'hklm\vendor folder'. When set, only
this particular assembly folder key will be used.
This is to support the scenario in VSWhidey#357946 in which there are multiple
side-by-side libraries installed and the user wants to pick an exact version.
bool EmbedInteropTyeps [default=absent] --
when true, we should treat this assembly as if it has no dependencies and should
be completely embedded into the target assembly.
A list of assembly files that can be part of the search and resolution process.
These must be absolute filenames, or project-relative filenames.
Assembly files in this list will be considered when SearchPaths contains
{CandidateAssemblyFiles} as one of the paths to consider.
A list of resolved SDK references which contain the sdk name, sdk location and the targeted configuration.
These locations will only be searched if the reference has the SDKName metadata attached to it.
Path to the target frameworks directory. Required to figure out CopyLocal status
for resulting items.
If not present, then no resulting items will be deemed CopyLocal='true' unless they explicity
have a Private='true' attribute on their source item.
A list of XML files that contain assemblies that are expected to be installed on the target machine.
Format of the file is like:
etc.
When present, assemblies from this list will be candidates to automatically "unify" from prior versions up to
the version listed in the XML. Also, assemblies with InGAC='true' will be considered prerequisites and will be CopyLocal='false'
unless explicitly overridden.
Items in this list may optionally specify the "FrameworkDirectory" metadata to associate an InstalledAssemblyTable
with a particular framework directory. However, this setting will be ignored unless the Redist name begins with
"Microsoft-Windows-CLRCoreComp".
If there is only a single TargetFrameworkDirectories element, then any items in this list missing the
"FrameworkDirectory" metadata will be treated as though this metadata is set to the lone (unique) value passed
to TargetFrameworkDirectories.
A list of XML files that contain assemblies that are expected to be in the target subset
Format of the file is like:
etc.
Items in this list may optionally specify the "FrameworkDirectory" metadata to associate an InstalledAssemblySubsetTable
with a particular framework directory.
If there is only a single TargetFrameworkDirectories element, then any items in this list missing the
"FrameworkDirectory" metadata will be treated as though this metadata is set to the lone (unique) value passed
to TargetFrameworkDirectories.
A list of XML files that contain the full framework for the profile.
Normally nothing is passed in here, this is for the cases where the location of the xml file for the full framework
is not under a RedistList folder.
Format of the file is like:
etc.
Items in this list must specify the "FrameworkDirectory" metadata to associate an redist list
with a particular framework directory. If the association is not made an error will be logged. The reason is,
The logic in rar assumes if a FrameworkDirectory is not set it will use the target framework directory.
[default=false]
Boolean property to control whether or not the task should look for and use additional installed
assembly tables (a.k.a Redist Lists) found in the RedistList directory underneath the provided
TargetFrameworkDirectories.
[default=false]
Boolean property to control whether or not the task should look for and use additional installed
assembly subset tables (a.k.a Subset Lists) found in the SubsetList directory underneath the provided
TargetFrameworkDirectories.
If the primary reference is a framework assembly ignore its version information and actually resolve the framework assembly from the currently targeted framework.
The preferred target processor architecture. Used for resolving {GAC} references.
Should be like x86, IA64 or AMD64.
This is the order of preference:
(1) Assemblies in the GAC that match the supplied ProcessorArchitecture.
(2) Assemblies in the GAC that have ProcessorArchitecture=MSIL
(3) Assemblies in the GAC that have no ProcessorArchitecture.
If absent, then only consider assemblies in the GAC that have ProcessorArchitecture==MSIL or
no ProcessorArchitecture (these are pre-Whidbey assemblies).
What is the runtime we are targeting, is it 2.0.57027 or anotherone, It can have a v or not prefixed onto it.
If not null, serializes information about inputs to the named file.
This overrides the usual outputs, so do not use this unless you are building an SDK with many references.
If not null, uses this set of caches as inputs if RAR cannot find the usual cache in the obj folder. Typically
used for demos and first-run scenarios.
List of locations to search for assemblyFiles when resolving dependencies.
The following types of things can be passed in here:
(1) A plain old directory path.
(2) {HintPathFromItem} -- Look at the HintPath attribute from the base item.
This attribute must be a file name *not* a directory name.
(3) {CandidateAssemblyFiles} -- Look at the files passed in through the CandidateAssemblyFiles
parameter.
(4) {Registry:_AssemblyFoldersBase_,_RuntimeVersion_,_AssemblyFoldersSuffix_}
Where:
_AssemblyFoldersBase_ = Software\Microsoft\[.NetFramework | .NetCompactFramework]
_RuntimeVersion_ = the runtime version property from the project file
_AssemblyFoldersSuffix_ = [ PocketPC | SmartPhone | WindowsCE]\AssemblyFoldersEx
Then look in the registry for keys with the following schema:
[HKLM | HKCU]\SOFTWARE\MICROSOFT\.NetFramework\
v1.0.3705
AssemblyFoldersEx
ControlVendor.GridControl.1.0:
@Default = c:\program files\ControlVendor\grid control\1.0\bin
@Description = Grid Control for .NET version 1.0
9466
@Default = c:\program files\ControlVendor\grid control\1.0sp1\bin
@Description = SP1 for Grid Control for .NET version 1.0
The based registry key is composed as:
[HKLM | HKCU]\_AssemblyFoldersBase_\_RuntimeVersion_\_AssemblyFoldersSuffix_
(5) {AssemblyFolders} -- Use the VisualStudion 2003 .NET finding-assemblies-from-registry scheme.
(6) {GAC} -- Look in the GAC.
(7) {RawFileName} -- Consider the Include value to be an exact path and file name.
[default=.exe;.dll]
These are the assembly extensions that will be considered during references resolution.
[default=.pdb;.xml]
These are the extensions that will be considered when looking for related files.
If this file name is passed in, then we parse it as an app.config file and extract bindingRedirect mappings. These mappings are used in the dependency
calculation process to remap versions of assemblies.
If this parameter is passed in, then AutoUnify must be false, otherwise error.
This is true if the project type supports "AutoGenerateBindingRedirects" (currently only for EXE projects).
[default=false]
This parameter is used for building assemblies, such as DLLs, which cannot have a normal
App.Config file.
When true, the resulting dependency graph is automatically treated as if there were an
App.Config file passed in to the AppConfigFile parameter. This virtual
App.Config file has a bindingRedirect entry for each conflicting set of assemblies such
that the highest version assembly is chosen. A consequence of this is that there will never
be a warning about conflicting assemblies because every conflict will have been resolved.
When true, each distinct remapping will result in a high priority comment indicating the
old and new versions and the fact that this was done automatically because AutoUnify was true.
When true, the AppConfigFile parameter should be empty. Otherwise, it's an
error.
When false, no assembly version remapping will occur automatically. When two versions of an
assembly are present, there will be a warning.
When false, each distinct conflict between different versions of the same assembly will
result in a high priority comment. After all of these comments are displayed, there will be
a single warning with a unique error code and text that reads "Found conflicts between
different versions of reference and dependent assemblies".
When determining if a dependency should be copied locally one of the checks done is to see if the
parent reference in the project file has the Private metadata set or not. If that metadata is set then
We will use that for the dependency as well.
However, if the metadata is not set then the dependency will go through the same checks as the parent reference.
One of these checks is to see if the reference is in the GAC. If a reference is in the GAC then we will not copy it locally
as it is assumed it will be in the gac on the target machine as well. However this only applies to that specific reference and not its dependencies.
This means a reference in the project file may be copy local false due to it being in the GAC but the dependencies may still be copied locally because they are not in the GAC.
This is the default behavior for RAR and causes the default value for this property to be true.
When this property is false we will still check project file references to see if they are in the GAC and set their copy local state as appropriate.
However for dependencies we will not only check to see if they are in the GAC but we will also check to see if the parent reference from the project file is in the GAC.
If the parent reference from the project file is in the GAC then we will not copy the dependency locally.
NOTE: If there are multiple parent reference and ANY of them does not come from the GAC then we will set copy local to true.
[default=false]
Enables legacy mode for CopyLocal determination. If true, referenced assemblies will not be copied locally if they
are found in the GAC. If false, assemblies will be copied locally unless they were found only in the GAC.
An optional file name that indicates where to save intermediate build state
for this task. If not specified, then no inter-build caching will occur.
If set, then dependencies will be found. Otherwise, only Primary references will be
resolved.
Default is true.
If set, then satellites will be found.
Default is true.
If set, then serialization assemblies will be found.
Default is true.
If set, then related files (.pdbs and .xmls) will be found.
Default is true.
If set, then don't log any messages to the screen.
Default is false.
The project target framework version.
Default is empty. which means there will be no filtering for the reference based on their target framework.
The target framework moniker we are targeting if any. This is used for logging purposes.
Default is empty.
The display name of the target framework moniker, if any. This is only for logging.
Provide a set of names which if seen in the TargetFrameworkSubset list will cause the ignoring
of TargetFrameworkSubsets.
Full, Complete
Name of the target framework profile we are targeting.
Eg. Client, Web, or Network
Set of folders which containd a RedistList directory which represent the full framework for a given client profile.
An example would be
%programfiles%\reference assemblies\microsoft\framework\v4.0
This is a list of all primary references resolved to full paths.
bool CopyLocal - whether the given reference should be copied to the output directory.
string FusionName - the fusion name for this dependency.
string ResolvedFrom - the literal search path that this file was resolved from.
bool IsRedistRoot - Whether or not this assembly is the representative for an entire redist.
'true' means the assembly is representative of an entire redist and should be indicated as
an application dependency in an application manifest.
'false' means the assembly is internal to a redist and should not be part of the
application manifest.
string Redist - The name (if any) of the redist that contains this assembly.
A list of all n-th order paths-to-dependencies with the following attributes:
bool CopyLocal - whether the given reference should be copied to the output directory.
string FusionName - the fusion name for this dependency.
string ResolvedFrom - the literal search path that this file was resolved from.
bool IsRedistRoot - Whether or not this assembly is the representative for an entire redist.
'true' means the assembly is representative of an entire redist and should be indicated as
an application dependency in an application manifest.
'false' means the assembly is internal to a redist and should not be part of the
application manifest.
string Redist - The name (if any) of the redist that contains this assembly.
Does not include first order primary references--this list is in ResolvedFiles.
Related files are files like intellidoc (.XML) and symbols (.PDB) that have the same base
name as a reference.
bool Primary [always false] - true if this assembly was passed in with Assemblies.
bool CopyLocal - whether the given reference should be copied to the output directory.
Any satellite files found. These will be CopyLocal=true iff the reference or dependency
that caused this item to exist is CopyLocal=true.
bool CopyLocal - whether the given reference should be copied to the output directory.
string DestinationSubDirectory - the relative destination directory that this file
should be copied to. This is mainly for satellites.
Any XML serialization assemblies found. These will be CopyLocal=true iff the reference or dependency
that caused this item to exist is CopyLocal=true.
bool CopyLocal - whether the given reference should be copied to the output directory.
Scatter files associated with one of the given assemblies.
bool CopyLocal - whether the given reference should be copied to the output directory.
Returns every file in ResolvedFiles+ResolvedDependencyFiles+RelatedFiles+SatelliteFiles+ScatterFiles+SatelliteAssemblyFiles
that have CopyLocal flags set to 'true'.
Regardless of the value of AutoUnify, returns one item for every distinct conflicting assembly
identity--including culture and PKT--that was found that did not have a suitable bindingRedirect
entry in the ApplicationConfigurationFile.
Each returned ITaskItem will have the following values:
ItemSpec - the full fusion name of the assembly family with empty version=0.0.0.0
MaxVersion - the maximum version number.
Storage for names of all files writen to disk.
The names of all files written to disk.
Whether the assembly or any of its primary references depends on system.runtime. (Aka needs Facade references to resolve duplicate types)
Whether the assembly or any of its primary references depends on netstandard
If OutputUnresolvedAssemblyConflicts then a list of information about unresolved conflicts that normally would have
been outputted in MSB3277. Otherwise empty.
Log the results.
Reference table.
Array of ideal assembly remappings.
Array of identities of ideal assembly remappings.
List of exceptions that were not attributable to a particular fusion name.
Used to generate the string representation of a public key token.
Log the source items and dependencies which lead to a given item.
Log the dependee and the item specs which caused the dependee reference to be resolved.
The means by which messages should be logged.
Display the information about how a reference was resolved.
The reference information
The fusion name of the reference.
Choose an importance level for reporting information about this reference.
The reference.
Log all task inputs.
Log a specific item metadata.
Describes whether this reference is primary or not
The reference.
The fusion name for this reference.
The importance of the message.
Log any errors for a reference.
The reference.
The importance of the message.
Show the full name of a reference.
The reference.
The importance of the message.
If there is a list of assemblyFiles that was considered but then rejected,
show information about them.
The reference.
The fusion name.
The importance of the message.
Show the files that made this dependency necessary.
The reference.
The importance of the message.
Log related files.
The reference.
The importance of the message.
Log the satellite files.
The reference.
The importance of the message.
Log scatter files.
The reference.
The importance of the message.
Log a message about the CopyLocal state of the reference.
The reference.
The importance of the message.
Log a message about the imageruntime information.
Log a conflict.
The reference.
The fusion name of the reference.
StringBuilder holding information to be logged.
Reads the state file (if present) into the cache.
Write out the state file if a state name was supplied and the cache is dirty.
Read the app.config and get any assembly remappings from it.
Execute the task.
Delegate used for checking for the existence of a file.
Delegate used for checking for the existence of a directory.
Delegate used for finding directories.
Delegate used for finding fusion names of assemblyFiles.
Delegate used for finding dependencies of a file.
Used to get registry subkey names.
Used to get registry default values.
Delegate used to get the last write time.
Delegate used to get the runtime version.
Key object to open.
Delegate to get assembly path in the GAC.
Delegate used for checking whether it is a WinMD file.
Delegate use to read machine type from PE Header
True if there was success.
Returns the raw list of direct dependent assemblies from assembly's metadata.
reference we are interested
the delegate to check for the existence of a file.
the delegate to access assembly metadata
Cache of pre-extracted assembly metadata.
list of dependencies
Combines two DependentAssembly arrays into one.
If a targeted runtime is passed in use that, if none is passed in then we need to use v2.0.50727
since the common way this would be empty is if we were using RAR as an override task.
The targered runtime
For a given profile generate the exclusion list and return the list of redist list files read in so they can be logged at the end of the task execution.
Installed assembly info of the profile redist lists
Installed assemblyInfo for the full framework redist lists
Generated exclusion list
Redist list which will contain the full framework redist list.
Given the names of the targetFrameworkSubset lists passed in generate a single name which can be used for logging.
Make sure certain combinations of properties are validated before continuing with the execution of rar.
Log the target framework subset information.
Determine if an exclusion list should be used or not
The exclusion list should only be used if there are TargetFrameworkSubsets to use or TargetFrameworkProfiles.
1) If we find a Full or equivalent marker in the list of subsets passed in we do not want to generate an exclusion list even if installedAssemblySubsets are passed in
2) If we are ignoring the default installed subset tables and we have not passed in any additional subset tables, we do not want to generate an exclusion list
3) If no targetframework subsets were passed in and no additional subset tables were passed in, we do not want to generate an exclusion list
True if we should generate an exclusion list
Populates the suggested redirects output parameter.
The list of ideal remappings.
The list of references to ideal assembly remappings.
Process TargetFrameworkDirectories and an array of InstalledAssemblyTables.
The goal is this: for each installed assembly table (whether found on disk
or given as an input), we wish to determine the target framework directory
it is associated with.
Array of AssemblyTableInfo objects (Describe the path and framework directory of a redist or subset list xml file)
Converts the string target framework value to a number.
Accepts both "v" prefixed and no "v" prefixed formats
if format is bad will log a message and return 0.
Target framework version value
Check if the assembly is available for on project's target framework.
- Assuming the russian doll model. It will be available if the projects target framework is higher or equal than the assembly target framework
True if the assembly is available for the project's target framework.
Validate and filter the Assemblies that were passed in.
- Check for assemblies that look like file names.
- Check for assemblies where subtype!=''. These are removed.
- Check for assemblies that have target framework higher than the project. These are removed.
Take a processor architecure and get the string representation back.
Checks to see if the assemblyName passed in is in the GAC.
Execute the task.
True if there was success.
Compare two ITaskItems by the file name in their ItemSpec.
Private construct so there's only one instance.
Compare the two AssemblyNameReferences by file name, and if that is equal, by item spec.
Sorting by item spec allows these to be ordered consistently:
c:\Regress315619\A\MyAssembly.dll
c:\Regress315619\B\MyAssembly.dll
The reason that a unification happened
This reference was not unified.
Unified because this was a framework assembly and it the current fusion
loader rules would unify to a different version.
Unified because of a binding redirect coming from either an explicit
app.config file or implicitly because AutoUnify was true.
A version number coupled with a reason why this version number
was chosen.
A unified assembly name.
Enum describing the behavior when a a primary reference has an architecture different from the project
Print an error
Print a warning
Do nothing
Contains utility functions for dealing with assembly folders found in the registry.
Key -- Like "hklm\Vendor RegKey" as provided to a reference by the <AssemblyFolderKey> on the reference in the project
Value -- Directory
Synchronize the creation of assemblyFolders
Given a registry key, find all of the registered assembly folders and add them to the list.
Like 'hklm' or 'hkcu'
The registry key to examine
The object to populate
For the given key name, look for registered assembly folders in HKCU then HKLM.
Populates the internal tables.
Returns the list of assembly folders that we're interested in.
Like "hklm\Vendor RegKey" as provided to a reference by the <AssemblyFolderKey> on the reference in the project.
Describes a remapping entry pair
Constructor
The assemblyName we mapped from
The assemblyName we mapped to
Compare two Assembly remapping objects
Get the hash code
We only compare the from because in terms of what is in the redist list unique from's are expected
Task to assign a reasonable "Link" metadata to the provided items.
The set of items to assign metadata to
The set of items to which the Link metadata has been set
Sets "Link" metadata on any item where the project file in which they
were defined is different from the parent project file to a sane default:
the relative directory compared to the defining file.
Does NOT overwrite Link metadata if it's already defined.
A special XML string containing a project configuration for each project - we need to simply
match the projects and assign the appropriate configuration names to them
Whether to use the solution dependency information passed in the solution blob
to add synthetic project references for the purposes of build ordering
String containing a semicolon-delimited list of mappings from the platform names used
by most VS types to those used by .vcxprojs.
E.g. "AnyCPU=Win32"
String containing a semicolon-delimited list of mappings from .vcxproj platform names
to the platform names use by most other VS project types.
E.g. "Win32=AnyCPU"
The current project's full path
The current project's platform.
The current project's platform.
Should we build references even if they were disabled in the project configuration
Whether to set the GlobalPropertiesToRemove metadata on the project reference such that
on an MSBuild call, the Configuration and Platform metadata will be unset, allowing the
child project to build in its default configuration / platform.
The output type for the project
True if we should use the default mappings to resolve the configuration/platform
of the passed in project references, false otherwise.
The list of resolved reference paths (preserving the original project reference attributes)
The list of project reference items that could not be resolved using the pre-resolved list of outputs.
Since VS only pre-resolves non-MSBuild projects, this means that project references in this list
are in the MSBuild format.
Main task method
Given a project reference task item and an XML document containing project configurations,
find the configuration for that task item.
true if resolved successfully
Given the project configuration blob and the project reference item, set the BuildInProject metadata and the ReferenceOutputAssembly metadata
based on the contents of the blob.
Given the contents of VcxToDefaultPlatformMapping and DefaultToVcxPlatformMapping properties,
fill out the maps that will be used to translate between the two.
Given a dictionary to populate and a string of the format "a=b;c=d", populate the
dictionary with the given pairs.
Create a new list of items that have <TargetPath> attributes if none was present in
the input.
The folder to make the links relative to.
The incoming list of files.
The resulting list of files.
Execute the task.
This class is the top-level object for the bootstrapper system.
Creates a new BootstrapperBuilder.
Creates a new BootstrapperBuilder.
The version of Visual Studio that is used to build this bootstrapper.
Specifies the location of the required bootstrapper files.
Path to bootstrapper files.
Returns all products available at the current bootstrapper Path
Generates a bootstrapper based on the specified settings.
The properties used to build this bootstrapper.
The results of the bootstrapper generation
Returns the directories bootstrapper component files would be copied to when built given the specified settings
The productCodes of the selected components
The culture used to build the bootstrapper
The fallback culture used to build the bootstrapper
How the bootstrapper would package the selected components
Represents messages that occur during the BootstrapperBuilder's Build operation.
This severity of this build message
A text string describing the details of the build message
The MSBuild F1-help keyword for the host IDE, or null
The MSBuild help id for the host IDE
Represents the results of the Build operation of the BootstrapperBuilder.
Returns true if the bootstrapper build was successful, false otherwise
The file path to the generated primary bootstrapper file
Path to setup.exe
File paths to copied component installer files
Path to component files
The build messages generated from a bootstrapper build
This class defines the settings for the bootstrapper build operation.
The name of the application to be installed after the bootstrapper has installed all required components. If no application is to be installed, this parameter may be null
The file to be installed after the bootstrapper has installed the required components. It is assumed that this file path is relative to the bootstrapper source path. If no application is to be installed, this parameter may be null
A value of true indicates that the application should require elevation to install on Vista.
The expected source location if the bootstrapper is published to a website. It is expected that the ApplicationFile, if specified, will be published to the location consistent to this value. If ComponentsLocation is Relative, required component files will also be published in a manner consistent with this value. This value may be null if setup.exe is not to be published to the web
Specifies the install time location for bootstrapper components
The location the bootstrapper install time will use for components if ComponentsLocation is "Absolute"
If true, the bootstrapper components will be copied to the build output directory. If false, the files will not be copied
The culture identifier for the bootstrapper to be built
The culture identifier to use if the LCID identifier is not available
The file location to copy output files to
The product builders to use for generating the bootstrapper
Specifies a URL for the Web site containing support information for the bootstrapper
True if the bootstrapper will perform XML validation on the component manifests
This interface exposes functionality necessary to build a bootstrapper.
Specifies the location of the required bootstrapper files.
Path to bootstrapper files.
Returns all products available at the current bootstrapper Path
Generates a bootstrapper based on the specified settings.
The properties used to build this bootstrapper.
The results of the bootstrapper generation
This interface defines the settings for the bootstrapper build operation.
The name of the application to be installed after the bootstrapper has installed all required components. If no application is to be installed, this parameter may be null
The file to be installed after the bootstrapper has installed the required components. It is assumed that this file path is relative to the bootstrapper source path. If no application is to be installed, this parameter may be null
The expected source location if the bootstrapper is published to a website. It is expected that the ApplicationFile, if specified, will be published to the location consistent to this value. If ComponentsLocation is Relative, required component files will also be published in a manner consistent with this value. This value may be null if setup.exe is not to be published to the web
The location the bootstrapper install time will use for components if ComponentsLocation is "Absolute"
If true, the bootstrapper components will be copied to the build output directory. If false, the files will not be copied
The culture identifier for the bootstrapper to be built
The culture identifier to use if the LCID identifier is not available
The file location to copy output files to
The product builders to use for generating the bootstrapper
True if the bootstrapper will perform XML validation on the component manifests
Specifies the install time location for bootstrapper components
Specifies a URL for the Web site containing support information for the bootstrapper
A value of true indicates that the application should require elevation to install on Windows Vista.
This interface represents a product in the found by the BootstrapperBuilder in the Path property.
The ProductBuilder representation of this Product
A human-readable name for this product
A string specifying the unique identifier of this product
All products which this product also installs
This interface describes a collection of Product objects. This collection is a closed set that is generated by the BootstrapperBuilder based on the Path property. The client cannot add or remove items from this collection.
Gets the number of elements actually contained in the ProductCollection
Gets the Product at the specified index.
The zero-based index of the element to get
The Product at the specified index
Gets the product with the specified product code
The product with the given name, null if the spercified product code is not found
This interface represents a buildable version of a Product. Used for the BootstrapperBuilder's Build method.
The product corresponding to this builder
This class contains a collection of ProductBuilder objects. Used for the BootstrapperBuilder's Build method.
Adds a builder to the collection
The ProductBuilder to add to the collection
Represents the results of the build operation of the BootstrapperBuilder.
Returns true if the bootstrapper build was successful, false otherwise
The file path to the generated primary bootstrapper file
Path to setup.exe
File paths to copied component installer files
Path to component files
The build messages generated from a bootstrapper build
Represents messages that occur during the BootstrapperBuilder's Build operation.
This severity of this build message
A text string describing the details of the build message
The MSBuild F1-help keyword for the host IDE, or null
The MSBuild help id for the host IDE
This enumeration provides three levels of importance for build messages.
Indicates that the message corresponds to build information
Indicates that the message corresponds to a build warning
Indicates that the message corresponds to a build error
This enumeration describes the way required components will be published
Products will be found according to the redist vendor's designated URL
Products will be located relative to generated bootstrapper
All products will be located at s specific location
This class represents a product in the found by the BootstrapperBuilder in the Path property.
The ProductBuilder representation of this Product
A string specifying the unique identifier of this product
A human-readable name for this product
All products which this product also installs
A buildable version of a Product. Used for the BootstrapperBuilder's Build method.
The Product corresponding to this ProductBuilder
This class contains a collection of ProductBuilder objects. Used for the BootstrapperBuilder's Build method.
Adds a ProductBuilder to the ProductBuilderCollection
The ProductBuilder to add to this collection
Returns an enumerator that can iterate through the ProductBuilderCollection
An enumerator that can iterate through the ProductBuilderCollection
This class contains a collection of Product objects. This collection is a closed set that is generated by the BootstrapperBuilder based on the Path property. The client cannot add or remove items from this collection.
Gets the Product at the specified index.
The zero-based index of the element to get
The Product at the specified index
Gets the product with the specified product code
The product with the given name, null if the spercified product code is not found
Gets the number of elements actually contained in the ProductCollection
Returns an enumerator that can iterate through the ProductCollection
An enumerator that can iterate through the ProductCollection
Handles and stores xml validation events for a product, and contains the XmlValidationResults of a package.
Adds the validation results of a package of the specified culture into the ProductValidationResults.
The culture of the XmlValidationResults to add.
The vaue of the results to add.
Gets the XmlValidationResults for the specified culture.
The culture of the XmlValidationResults to get.
The XmlValidationResults associated with the specified culture.
Handles and stores XML validation events.
Constructor which includes the path to the file being validated.
The file which is being validated.
Gets a string containing the name of the file being validated.
The name of the file being validated.
The delegate which will handle validation events.
Gets all of the validation errors of the file being validated.
An array of type string, containing all of the validation errors.
Gets a value indicating if there were no validation errors or warnings.
true if there were no validation errors or warnings; otherwise false. The default value is false.
Gets all of the validation warnings of the file being validated.
An array of type string, containing all of the validation warnings.
Provides a unique identifier for a ClickOnce application.
Initializes a new instance of the ApplicationIdentity class.
The deployment provider URL for the ClickOnce deployment manifest.
Path to ClickOnce deployment manifest. The assembly identity will be obtained from the specified file.
Path to ClickOnce application manifest. The assembly identity will be obtained from the specified file.
Initializes a new instance of the ApplicationIdentity class.
The deployment provider URL for the ClickOnce deployment manifest.
Assembly identity of the ClickOnce deployment manifest.
Assembly identity of the ClickOnce application manifest.
Returns the full ClickOnce application identity.
A string containing the ClickOnce application identity.
Describes a ClickOnce or native Win32 application manifest.
This is a serialization format, don't remove the private fields.
Initializes a new instance of the ApplicationManifest class.
Initializes a new instance of the ApplicationManifest class.
Gets or sets the application configuration file.
For a Win32 native manifest, this input is ignored.
Gets or sets the target framework version
Gets or sets the link to use if there is a failure launching the application.
The specified value should be a fully qualified URL or UNC path.
Gets or sets a value that indicates whether the application will run in IE using WPF's XBAP application model.
if the application will run in IE using WPF's XBAP application model; otherwise, .
Gets or sets the application icon file.
The application icon is expressed in the generated application manifest and is used for the start menu and Add/Remove Programs dialog.
If this input is not specified then a default icon is used.
For a Win32 native manifest, this input is ignored.
Gets or sets a value that indicates whether the manifest is a ClickOnce application manifest or a native Win32 application manifest.
Gets or sets the maximum allowable length of a file path in a ClickOnce application deployment.
If this value is specified, then the length of each file path in the application is checked against this limit.
Any items that exceed the limit will result in a warning message.
If this input is not specified or is zero, then no checking is performed.
For a Win32 native manifest, this input is ignored.
Gets or sets a textual description for the OS dependency.
Gets or sets a support URL for the OS dependency.
Gets or sets the minimum OS version required by the application.
An example value is "5.1.2600.0" for Windows XP.
If you don't specify a value, a default value is used.
The default value is the minimum supported OS of the .NET Framework, which is "4.10.0.0" for Windows 98 Second Edition.
However, if the application contains any native or Reg-Free COM references, then the default is the Windows XP version, which is "5.1.2600.0".
For a Win32 native manifest, this input is ignored.
Gets or sets the name of the application.
If this input is not specified then the Product is not written into the Application Manifest
This name is used for the shortcut name on the Start menu and is part of the name that appears in the Add/Remove Programs dialog.
Gets or sets the publisher of the application.
If this input is not, specified then the Publisher is not written into the Application Manifest
This name is used for the folder name on the Start menu and is part of the name that appears in the Add/Remove Programs dialog.
Gets or sets the suite name of the application.
This name is used for the sub-folder name on the Start menu (as a child of the publisher)
Gets or sets the link that appears in the Add/Remove Programs dialog for the application.
The specified value should be a fully qualified URL or UNC path.
Gets or sets a trust object defining the application security.
Gets or sets a value that indicates whether the install will use the settings in the application manifest in the trust prompt.
to use the settings in the application manifest in the trust prompt; otherwise, .
Describes the identity of an assembly.
This is a serialization format, do not remove or change the private fields.
Specifies which attributes are to be returned by the GetFullName function.
Include the Name, Version, Culture, and PublicKeyToken attributes.
Include the Name, Version, Culture, PublicKeyToken, and ProcessorArchitecture attributes.
Include the Name, Version, Culture, PublicKeyToken, and Type attributes.
Include all attributes.
Initializes a new instance of the AssemblyIdentity class.
Initializes a new instance of the AssemblyIdentity class.
Specifies the simple name of the assembly.
Initializes a new instance of the AssemblyIdentity class.
Specifies the simple name of the assembly.
Specifies the version of the assembly.
Initializes a new instance of the AssemblyIdentity class.
Specifies the simple name of the assembly.
Specifies the version of the assembly.
Specifies the public key token of the assembly, which is the last 8 bytes of the SHA-1 hash of the public key under which the assembly is signed.
Specifies the culture of the assembly. A blank string indicates the invariant culture.
Initializes a new instance of the AssemblyIdentity class.
Specifies the simple name of the assembly.
Specifies the version of the assembly.
Specifies the public key token of the assembly, which is the last 8 bytes of the SHA-1 hash of the public key under which the assembly is signed.
Specifies the culture of the assembly. A blank string indicates the invariant culture.
Specifies the processor architecture of the assembly. Valid values are "msil", "x86", "ia64", "amd64".
Initializes a new instance of the AssemblyIdentity class.
Specifies the simple name of the assembly.
Specifies the version of the assembly.
Specifies the public key token of the assembly, which is the last 8 bytes of the SHA-1 hash of the public key under which the assembly is signed.
Specifies the culture of the assembly. A blank string indicates the invariant culture.
Specifies the processor architecture of the assembly. Valid values are "msil", "x86", "ia64", "amd64".
Specifies the type attribute of the assembly. Valid values are "win32" or a blank string.
Initializes a new instance of the AssemblyIdentity class.
Specifies another instance to duplicate.
Parses string to obtain an assembly identity.
Returns null if identity could not be obtained.
The full name of the assembly, also known as the display name.
The resulting assembly identity.
Obtains identity of the specified manifest file.
File must be a stand-alone xml manifest file.
Returns null if identity could not be obtained.
The name of the file from which the identity is to be obtained.
The assembly identity of the specified file.
Obtains identity of the specified .NET assembly.
File must be a .NET assembly.
Returns null if identity could not be obtained.
The name of the file from which the identity is to be obtained.
The assembly identity of the specified file.
Obtains identity of the specified native assembly.
File must be either a PE with an embedded xml manifest, or a stand-alone xml manifest file.
Returns null if identity could not be obtained.
The name of the file from which the identity is to be obtained.
The assembly identity of the specified file.
Obtains identity of the specified assembly.
File can be a PE with an embedded xml manifest, a stand-alone xml manifest file, or a .NET assembly.
Returns null if identity could not be obtained.
The name of the file from which the identity is to be obtained.
The assembly identity of the specified file.
Returns true if this assembly is part of the .NET Framework.
Returns true if this assembly is part of the given framework.
identifier is “.NETFramework” or “Silverlight”, etc. and the version string looks like this: “4.5” or “v4.5”, or “v4.0.30319"
If frameworkVersion is null or empty, return true if this assembly is present in any of the given framework versions
If both arguments are null or empty strings, return true if this assembly is present in any of the frameworks
Specifies the culture of the assembly. A blank string indicates the invariant culture.
Returns the full name of the assembly.
Specifies which attributes to be included in the full name.
A string representation of the full name.
Specifies whether the assembly identity represents a neutral platform assembly.
Specifies whether the assembly identity is a strong name.
Specifies the simple name of the assembly.
Specifies the processor architecture of the assembly. Valid values are "msil", "x86", "ia64", "amd64".
Specifies the public key token of the assembly, which is the last 8 bytes of the SHA-1 hash of the public key under which the assembly is signed.
Specifies the type attribute of the assembly. Valid values are "win32" or a blank string.
Specifies the version of the assembly.
Describes a Win32 assembly manifest.
This is a serialization format, do not remove or rename private fields.
Specifies the set of external proxy stubs referenced by the manifest for isolated applications and Reg-Free COM.
Describes the type of an assembly reference.
Assembly type is unspecified and will be determined by the UpdateFileInfo method.
Specifies a ClickOnce manifest.
Specifies a .NET assembly.
Specifies a Win32 native assembly.
Describes a manifest assembly reference.
Initializes a new instance of the AssemblyReference class.
Initializes a new instance of the AssemblyReference class.
The specified source path of the file.
Specifies the identity of the assembly reference.
Specifies whether the assembly reference is a prerequisite.
Specifies the type of the assembly reference.
True if the reference is specified in the project file, false if it is added to the manifest as a result
of computing the closure of all project references.
Provides a collection for manifest assembly references.
Gets the element at the specified index.
The zero-based index of the entry to get.
The assembly reference instance.
Adds the specified assembly reference to the collection.
The specified assembly reference to add.
The added assembly reference instance.
Adds the specified assembly reference to the collection.
The specified assembly reference to add.
The added assembly reference instance.
Removes all objects from the collection.
Gets the number of objects contained in the collection.
Finds an assembly reference in the collection by simple name.
The specified assembly simple name.
The found assembly reference.
Finds an assembly reference in the collection by the specified assembly identity.
The specified assembly identity.
The found assembly reference.
Finds an assembly reference in the collection by the specified target path.
The specified target path.
The found assembly reference.
Returns an enumerator that can iterate through the collection.
The enumerator.
Removes the specified assembly reference from the collection.
The specified assembly reference to remove.
Describes base functionality common to both file and assembly references.
Note derived classes are serialization formats. Do not rename or remove private members.
Specifies the group for on-demand download functionality. A blank string indicates a primary file.
Specifies the SHA1 hash of the file.
Specifies whether the file is optional for on-deman download functionality.
Specifies the resolved path to the file. This path is determined by the Resolve method, and is used to compute the file information by the UpdateFileInfo method.
Specifies the file size in bytes.
Specifies the source path of the file.
Specifies the target path of the file. This is the path that is used for specification in the generated manifest.
Describes a CompatibleFramework for an deployment manifest
Specifies how the application checks for updates.
Check for updates in the background, after the application starts.
Check for updates in the foreground, before the application starts.
Specifies the units for the update interval.
Update interval is in hours.
Update interval is in days.
Update interval is in weeks.
Describes a ClickOnce deployment manifest.
Initializes a new instance of the DeployManifest class.
Initializes a new instance of the DeployManifest class.
codes from GetInstallableFrameworkForTargetFxInternal in
env/vscore/package/FxMultiTargeting/FrameworkMultiTargetingInternal.cs
Gets the InstallableFramework by reading the 'InstallableFramework' attribute in the redist file of the target framework
the path to the redistlist file
InstallableFramework
conver (MajorVersion).(MinorVersion).(Build).(Revision) to (MajorVersion).(MinorVersion).(Build)
Specifies whether the application install will create a shortcut on the desktop
If True, the installation will create a shortcut to the application on the desktop.
The default is False
If Install is False, this value will be ignored
Specifies the target framework moniker of this project.
A collection of CompatibleFrameworks
Specifies the update location for the application.
If this input is not specified then no update location will be defined for the application.
However, if application updates are specified then the update location must be specified.
The specified value should be a fully qualified URL or UNC path.
Specifies whether the application should be blocked from being activated via a URL.
If this option is True then application can only be activated from the user's Start menu.
The default is False.
This option is ignored if the Install property is False.
Specifies the link to use if there is a failure launching the application.
The specified value should be a fully qualified URL or UNC path.
Specifies whether the application is an installed application or an online only application.
If this flag is True the application will be installed on the user's Start menu, and can be removed from the Add/Remove Programs dialog.
If this flag is False then the application is intended for online use from a web page.
The default is True.
Specifies whether or not the ".deploy" file extension mapping is used.
If this flag is true then every application file is published with a ".deploy" file extension.
This option is useful for web server security to limit the number of file extensions that need to be unblocked to enable ClickOnce application deployment.
The default is false.
Specifies whether or not the user can skip the update.
If the user has a version less than the minimum required, he or she will not have the option to skip the update.
The default is to have no minimum required version.
This input only applies when Install is True.
Specifies the name of the application.
If this input is not specified then the name is inferred from the identity of the generated manifest.
This name is used for the shortcut name on the Start menu and is part of the name that appears in the Add/Remove Programs dialog.
Specifies the publisher of the application.
If this input is not specified then the name is inferred from the registered user, or the identity of the generated manifest.
This name is used for the folder name on the Start menu and is part of the name that appears in the Add/Remove Programs dialog.
Specifies the suite name of the application.
This name is used for the sub-folder name on the Start menu (as a child of the publisher)
Specifies the link that appears in the Add/Remove Programs dialog for the application.
The specified value should be a fully qualified URL or UNC path.
Specifies whether or not URL query-string parameters should be made available to the application.
The default is False indicating that parameters will not be available to the application.
Indicates whether or not the application is updatable.
The default is False.
This input only applies when Install is True.
Specifies the update interval for the application.
The default is zero.
This input only applies when Install and UpdateEnabled are both True.
Specifies whether updates should be checked in the foreground before starting the application, or in the background as the application is running.
The default is "Background".
This input only applies when Install and UpdateEnabled are both True.
Specifies the units for UpdateInterval input.
This input only applies when Install and UpdateEnabled are both True.
Describes a fileAssociation for an application manifest
Describes a manifest file reference.
Initializes a new instance of the FileReference class.
Initializes a new instance of the FileReference class.
The specified source path of the file.
Specifies the set of COM classes referenced by the manifest for isolated applications and Reg-Free COM.
Specifies whether the file is a data file.
Specifies the set of proxy stubs referenced by the manifest for isolated applications and Reg-Free COM.
Specifies the set of type libraries referenced by the manifest.
Provides a collection for manifest file references.
Gets the element at the specified index.
The zero-based index of the entry to get.
The file reference instance.
Adds the specified assembly reference to the collection.
The specified file reference to add.
The added file reference instance.
Adds the specified assembly reference to the collection.
The specified file reference to add.
The added file reference instance.
Removes all objects from the collection.
Gets the number of objects contained in the collection.
Finds a file reference in the collection by the specified target path.
The specified target path.
The found file reference.
Returns an enumerator that can iterate through the collection.
The enumerator.
Removes the specified file reference from the collection.
The specified file reference to remove.
Adds Launcher and updates its resource
Specifies the location of the required Launcher files.
Path to Launcher files.
Describes base functionality common to all supported manifest types.
Specifies the identity of the manifest.
Specifies the set of assemblies referenced by the manifest.
Assembly name passed to the manifest generation task
Indicates if manifest is part of Launcher-based deployment, which requires
somewhat different manifest generation and validation.
Specifies a textual description for the manifest.
Identifies an assembly reference which is the entry point of the application.
Specifies the set of files referenced by the manifest.
The input stream from which the manifest was read.
Used by ManifestWriter to reconstitute input which is not represented in the object representation.
Contains a collection of current error and warning messages.
Specifies whether the manifest is operating in read-only or read-write mode.
If only using to read a manifest then set this flag to true.
If using to write a new manifest then set this flag to false.
The default is false.
This flag provides additional context for the manifest generator, and affects how some error messages are reported.
Locates all specified assembly and file references by searching in the same directory as the loaded manifest, or in the current directory.
The location of each referenced assembly and file is required for hash computation and assembly identity resolution.
Any resulting errors or warnings are reported in the OutputMessages collection.
Locates all specified assembly and file references by searching in the specified directories.
The location of each referenced assembly and file is required for hash computation and assembly identity resolution.
Any resulting errors or warnings are reported in the OutputMessages collection.
An array of strings specify directories to search.
Specifies the location where the manifest was loaded or saved.
Updates file information for each referenced assembly and file.
The file information includes a hash computation and a file size for each referenced file and assembly.
Also, the assembly identity is obtained for any referenced assemblies with an unspecified assembly identity.
Any resulting errors or warnings are reported in the OutputMessages collection.
Implementation of UpdateFileInfo
null, if not TFV. If no TFV, it will use sha256 signature algorithm.
Performs various checks to verify the validity of the manifest.
Any resulting errors or warnings are reported in the OutputMessages collection.
Reads an XML manifest file into an object representation.
Reads the specified manifest XML and returns an object representation.
The name of the input file.
Specifies whether to preserve the input stream in the InputStream property of the resulting manifest object. Used by ManifestWriter to reconstitute input which is not represented in the object representation. This option is not honored if the specified input file is an embedded manfiest in a PE.
A base object representation of the manifest. Can be cast to AssemblyManifest, ApplicationManifest, or DeployManifest to access more specific functionality.
Reads the specified manifest XML and returns an object representation.
Specifies the expected type of the manifest. Valid values are "AssemblyManifest", "ApplicationManifest", or "DepoyManifest".
The name of the input file.
Specifies whether to preserve the input stream in the InputStream property of the resulting manifest object. Used by ManifestWriter to reconstitute input which is not represented in the object representation. This option is not honored if the specified input file is an embedded manfiest in a PE.
A base object representation of the manifest. Can be cast to AssemblyManifest, ApplicationManifest, or DeployManifest to access more specific functionality.
Reads the specified manifest XML and returns an object representation.
Specifies an input stream.
Specifies whether to preserve the input stream in the InputStream property of the resulting manifest object. Used by ManifestWriter to reconstitute input which is not represented in the object representation.
A base object representation of the manifest. Can be cast to AssemblyManifest, ApplicationManifest, or DeployManifest to access more specific functionality.
Reads the specified manifest XML and returns an object representation.
Specifies the expected type of the manifest. Valid values are "AssemblyManifest", "ApplicationManifest", or "DepoyManifest".
Specifies an input stream.
Specifies whether to preserve the input stream in the InputStream property of the resulting manifest object. Used by ManifestWriter to reconstitute input which is not represented in the object representation.
A base object representation of the manifest. Can be cast to AssemblyManifest, ApplicationManifest, or DeployManifest to access more specific functionality.
Writes object representation of a manifest to XML.
Writes the specified object representation of a manifest to XML.
The name of the output file is inferred from the SourcePath property of the manifest.
The object representation of the manifest.
Writes the specified object representation of a manifest to XML.
The object representation of the manifest.
The name of the output file.
Writes the specified object representation of a manifest to XML.
The object representation of the manifest.
The name of the output file.
The target framework version.
Writes the specified object representation of a manifest to XML.
The object representation of the manifest.
Specifies an output stream.
it will always use sha256 as signature algorithm if TFV is null
Specifies the type of output message as either an error, warning, or informational.
Indicates an informational message.
Indicates a warning.
Indicates an error.
Describes an error, warning, or informational output message for the manifest generator.
Returns a string array of arguments for the message.
Specifies an identifier for the message.
Contains the text of the message.
Indicates whether the message is an error, warning, or informational message.
Provides a collection for output messages.
Gets the element at the specified index.
The zero-based index of the entry to get.
The file reference instance.
Removes all objects from the collection.
Gets the number of error messages in the collecction.
Returns an enumerator that can iterate through the collection.
The enumerator.
Gets the number of warning messages in the collecction.
Provides a set of utility functions for manipulating security permision sets and signing.
Generates a permission set by computed the zone default permission set and adding any included permissions.
Specifies a zone default permission set, which is obtained from machine policy. Valid values are "Internet", "LocalIntranet", or "Custom". If "Custom" is specified, the generated permission set is based only on the includedPermissionSet parameter.
A PermissionSet object containing the set of permissions to be explicitly included in the generated permission set. Permissions specified in this parameter will be included verbatim in the generated permission set, regardless of targetZone parameter.
This property is no longer used.
The generated permission set.
Converts an array of permission identity strings to a permission set object.
An array of permission identity strings.
The converted permission set.
Converts a permission set object to an array of permission identity strings.
The input permission set to be converted.
An array of permission identity strings.
Converts an XmlElement into a PermissionSet object.
An XML representation of the permission set.
The converted permission set.
Signs a ClickOnce manifest or PE file.
Hexadecimal string that contains the SHA-1 hash of the certificate.
URL that specifies an address of a time stamping server.
Path of the file to sign with the certificate.
Signs a ClickOnce manifest or PE file.
Hexadecimal string that contains the SHA-1 hash of the certificate.
URL that specifies an address of a time stamping server.
Path of the file to sign with the certificate.
Version of the .NET Framework for the target.
Signs a ClickOnce manifest or PE file.
Hexadecimal string that contains the SHA-1 hash of the certificate.
URL that specifies an address of a time stamping server.
Path of the file to sign with the certificate.
Version of the .NET Framework for the target.
.NET Framework identifier for the target.
Signs a ClickOnce manifest or PE file.
Hexadecimal string that contains the SHA-1 hash of the certificate.
URL that specifies an address of a time stamping server.
Path of the file to sign with the certificate.
Version of the .NET Framework for the target.
.NET Framework identifier for the target.
Disallow fallback to legacy timestamping when RFC3161 timestamping fails during manifest signing
Signs a ClickOnce manifest.
The certificate to be used to sign the file.
The certificate password.
URL that specifies an address of a time stamping server.
Path of the file to sign with the certificate.
This function is only for signing a manifest, not a PE file.
Signs a ClickOnce manifest or PE file.
The certificate to be used to sign the file.
URL that specifies an address of a time stamping server.
Path of the file to sign with the certificate.
This function can only sign a PE file if the X509Certificate2 parameter represents a certificate in the
current user's personal certificate store.
Describes the application security trust information.
Resets the object to its default state.
Determines whether the application has permission to call unmanaged code.
Determines whether the application is full trust or partial trust.
Gets or sets the permission set object for the application trust.
Determines whether to preserve partial trust permission when the full trust flag is set.
If this option is false with full trust specified, then any permissions defined in the permission set object will be dropped on save.
Reads the application trust from an XML file.
The name of the input file.
Reads the application trust from an XML file.
Specifies an input stream.
Reads the application trust from a ClickOnce application manifest.
The name of the input file.
Reads the application trust from a ClickOnce application manifest.
Specifies an input stream.
Describes the level of "same site" access permitted, specifying whether the application has permission to communicate with the server from which it was deployed.
Writes the application trust to an XML file.
The name of the output file.
Writes the application trust to an XML file.
Writes the application trust to a ClickOnce application manifest.
If the file exists, the trust section will be updated.
If the file does not exist, a new template manifest with the specified trust will be created.
The name of the output file.
Writes the application trust to a new template ClickOnce application manifest.
Specifies an output stream.
Updates an existing ClickOnce application manifest with the specified trust.
Specifies an input stream.
Specifies an output stream.
Return a CLRVersion from a given target framework version.
Gets a Version object corresponding to the given target framework version string.
This class implements the "CallTarget" task, which invokes other targets within the same
project file. Marked RunInMTA because we do not want this task to ever be invoked explicitly
on the STA if the RequestBuilder is running on another thread, as this will cause thread
id validation checks to fail.
The targets to build.
Array of target names.
This is a required parameter. If you want to build the
default targets, use the <MSBuild> task and pass in Projects=$(MSBuildProjectFile).
Outputs of the targets built in each project.
Array of output items.
When this is true, instead of calling the engine once to build all the targets (for each project),
we would call the engine once per target (for each project). The benefit of this is that
if one target fails, you can still continue with the remaining targets.
Deprecated. Does nothing.
Instructs the MSBuild engine to build one or more targets in the current project.
true if all targets built successfully; false if any target fails
Task to call Path.Combine.
The base path, the first parameter into Path.Combine. Can be a relative path,
absolute path, or (blank).
The list of paths to combine with the base path. These can be relative paths
or absolute paths.
This is the output of the task, a list of paths produced by combining the base
path with each of the paths passed in.
Calls Path.Combine for each of the inputs. Preserves metadata.
true on success, false on failure
CommandLineBuilder derived class for specialized logic specific to MSBuild tasks
Initializes a new instance of the CommandLineBuilderExtension class.
Initializes a new instance of the CommandLineBuilderExtension class.
Set a boolean switch iff its value exists and its value is 'true'.
Set a boolean switch only if its value exists.
Set a boolean switch only if its value exists.
Set a switch if its value exists by choosing from the input choices
Set an integer switch only if its value exists.
Adds an aliased switch, used for ResGen:
/reference:Foo=System.Xml.dll
Adds a nested switch, used by SGen.exe. For example:
/compiler:"/keyfile:\"c:\some folder\myfile.snk\""
Returns a quoted string appropriate for appending to a command line.
Escapes any double quotes in the string.
Appends a command-line switch that takes a compound string parameter. The parameter is built up from the item-spec and
the specified attributes. The switch is appended as many times as there are parameters given.
Append a switch if 'parameter' is not null.
Split on the characters provided.
Returns true if the parameter is empty in spirits,
even if it contains the separators and white space only
Split on the characters provided.
Designed to handle the /link and /embed swithes:
/embed[resource]:<filename>[,<name>[,Private]]
/link[resource]:<filename>[,<name>[,Private]]
Where the last flag--Private--is either present or not present
depending on whether the ITaskItem has a Private="True" attribue.
Appends a switch if the specified value is true.
BinaryFormatter byte arrays contain the type name, but it is not directly accessible from the resx.
BinaryFormatter byte arrays contain the type name, but it is not directly accessible from the resx.
Construct a new linked resource.
The resource's name
The assembly-qualified type name of the resource (at runtime).
The absolute path of the file to be embedded as a resource.
The absolute path of the file that defined the ResXFileRef to this resource.
Name of the resource, as specified in the source.
The resource's type's assembly-qualified name. May be null when the type is not knowable from the source.
The resource's type's full name. May be null when the type is not knowable from the source.
Adds the resource represented by this object to the specified writer.
Name value resource pair to go in resources list
Does this assembly-qualified type name represent an array of bytes?
We can't hard-code byte[] type name due to version number
updates and potential whitespace issues with ResX files.
Comment and logic from https://github.com/dotnet/winforms/blob/16b192389b377c647ab3d280130781ab1a9d3385/src/System.Windows.Forms/src/System/Resources/ResXDataNode.cs#L411-L416
Extract s from a given file on disk.
Extract the full name of a type from an assembly-qualified name string.
Performs SetPlatform negotiation for all project references when opted
in via the EnableDynamicPlatformResolution property.
See ProjectReference-Protocol.md for details.
All ProjectReference items.
The platform the current project is building as.
Optional parameter that defines mappings from current project platforms
to what the ProjectReference should build as.
Win32=x86, for example.
The resulting items with NearestPlatform metadata set.
Create a wrapper so that when dispose is called we execute the delegate.
Has this been disposed
Delegate to call when we are in dispose
Constructor
Delegate to call when we are in dispose
IDisposable
Clear the caches
Represents a task that can download a file.
Gets or sets an optional filename for the destination file. By default, the filename is derived from the if possible.
Gets or sets a that specifies the destination folder to download the file to.
Gets or sets a that contains details about the downloaded file.
Gets or sets an optional number of times to retry if possible.
Gets or sets the number of milliseconds to wait before retrying.
Gets or sets an optional value indicating whether or not the download should be skipped if the file is up-to-date.
Gets or sets the URL to download.
Gets or sets the number of milliseconds to wait before the request times out.
Gets or sets a to use. This is used by unit tests to mock a connection to a remote server.
Attempts to download the file.
The parsed of the request.
The cancellation token for the task.
Determines if the specified exception is considered retriable.
The originally thrown exception.
The actual exception to be used for logging errors.
true if the exception is retriable, otherwise false.
Attempts to get the file name to use when downloading the file.
The with information about the response.
Receives the name of the file.
true if a file name could be determined, otherwise false.
Represents a wrapper around the that also contains the .
DEPRECATED as of net5.0, which included the StatusCode in the HttpRequestException class.
Computes the checksum for a single file.
The files to be hashed.
The algorithm. Allowed values: SHA256, SHA384, SHA512. Default = SHA256.
The metadata name where the hash is stored in each item. Defaults to "FileHash".
The encoding to use for generated hashs. Defaults to "hex". Allowed values = "hex", "base64".
The hash of the file. This is only set if there was one item group passed in.
The input files with additional metadata set to include the file hash.
Verifies that a file matches the expected file hash.
The file path.
The expected hash of the file.
The encoding format of . Defaults to "hex".
The hashing algorithm to use. Allowed values: SHA256, SHA384, SHA512. Default = SHA256.
CopyFile delegate
returns Success = true, Failure = false; Retry = null
Source file
Destination file
Short-term cache saves the result of IO operations on a filename. Should only be
used in cases where it is know there will be no exogenous changes to the filesystem
for this file.
Uses PInvoke rather than FileInfo because the latter does all kinds of expensive checks.
Deficiency: some of the properties eat some or all exceptions. If they are called first, they will
trigger the population and eat. Subsequent calls will then not throw, but instead eg return zero.
This could be fixed by storing the exception from the population, and throwing no matter who does
the population and whether it's been done before.
The name of the file.
Set to true if file or directory exists
Set to true if the path referred to a directory.
File length
Last time the file was updated
True if the file is readonly
Exception thrown on creation
Constructor gets the data for the filename.
On Win32 it uses native means. Otherwise,
uses standard .NET FileInfo/DirInfo
Throw exception as if the FileInfo did it. We
know that getting the length of a file would
throw exception if there are IO problems
Throw non-IO-related exception if occurred during creation.
Return true if exception did occur, but was IO-related
Throw any exception collected during construction
The name of the file.
Holds the full path equivalent of _filename
Actual file or directory information
Constructor.
Only stores file name: does not grab the file state until first request.
Whether the file is readonly.
Returns false for directories.
Throws if file does not exist.
Whether the file exists.
Returns false if it is a directory, even if it exists.
Returns false instead of IO related exceptions.
Whether the directory exists.
Returns false for files.
Returns false instead of IO related exceptions.
Last time the file was written.
Works for directories.
Last time the file was written, in UTC. Avoids translation for daylight savings, time zone etc which isn't needed for just comparisons.
If file does not exist, returns 12 midnight 1/1/1601.
Works for directories.
Length of the file in bytes.
Throws if it is a directory.
Throws if it does not exist.
Name of the file as it was passed in.
Not normalized.
Whether this is a directory.
Throws if it does not exist.
Use in case the state is known to have changed exogenously.
A task that copies files.
Constructor.
Force the copy to retry even when it hits ERROR_ACCESS_DENIED -- normally we wouldn't retry in this case since
normally there's no point, but occasionally things get into a bad state temporarily, and retrying does actually
succeed. So keeping around a secret environment variable to allow forcing that behavior if necessary.
Global flag to force on UseSymboliclinksIfPossible since Microsoft.Common.targets doesn't expose the functionality.
Default milliseconds to wait between necessary retries
Gets or sets the number of times to attempt to copy, if all previous attempts failed.
Warning: using retries may mask a synchronization problem in your build process.
Gets or sets the delay, in milliseconds, between any necessary retries.
Defaults to RetryDelayMillisecondsDefault
Gets or sets a value that indicates whether to use hard links for the copied files
rather than copy the files, if it's possible to do so.
Gets or sets a value that indicates whether to create symbolic links for the copied files
rather than copy the files, if it's possible to do so.
Fail if unable to create a symbolic or hard link instead of falling back to copy
The subset of files that were successfully copied.
Gets or sets a value that indicates whether to overwrite files in the destination
that have the read-only attribute set.
Stop and return (in an undefined state) as soon as possible.
Method compares two files and returns true if their size and timestamp are identical.
The source file
The destination file
INTERNAL FOR UNIT-TESTING ONLY
We've got several environment variables that we read into statics since we don't expect them to ever
reasonably change, but we need some way of refreshing their values so that we can modify them for
unit testing purposes.
If MSBUILDALWAYSRETRY is set, also log useful diagnostic information -- as
a warning, so it's easily visible.
Copy one file from source to destination. Create the target directory if necessary and
leave the file read-write.
Return true to indicate success, return false to indicate failure and NO retry, return NULL to indicate retry.
Ensure the read-only attribute on the specified file is off, so
the file is writeable.
Copy the files.
Delegate used to copy the files.
Thread parallelism allowed during copies. 1 uses the original algorithm, >1 uses newer algorithm.
Original copy code that performs single-threaded copies.
Used for single-file copies and when parallelism is 1.
Parallelize I/O with the same semantics as the single-threaded copy method above.
ResolveAssemblyReferences tends to generate longer and longer lists of files to send
to CopyTask as we get further and further down the dependency graph.
The OS can handle a lot of parallel I/O so let's minimize wall clock time to get
it all done.
Verify that the inputs are correct.
False on an error, implying that the overall copy operation should be aborted.
Set up our list of destination files.
For SourceFiles: Apply DestinationFolder to each SourceFiles item to create a DestinationFiles item.
For SourceFolders: With each SourceFolders item, get the files in the represented directory. Create both SourceFiles and DestinationFiles items.
False if an error occurred, implying aborting the overall copy operation.
Tries the path operation. Logs a 'Copy.Error' if an exception is thrown.
The operation.
The source to use for the log message.
The destination to use for the log message.
The result of the path operation.
Copy source to destination, unless SkipUnchangedFiles is true and they are equivalent.
True if the file was copied or, on SkipUnchangedFiles, the file was equivalent.
Copy one file with the appropriate number of retries if it fails.
Try to get a message to inform the user which processes have a lock on a given file.
Standard entry point.
Compares two paths to see if they refer to the same file. We can't solve the general
canonicalization problem, so we just compare strings on the full paths.
Base class for task that determines the appropriate manifest resource name to
assign to a given resx or other resource.
Utility function for creating a C#-style manifest name from
a resource name.
The file name of the dependent (usually a .resx)
The file name of the dependent (usually a .resx)
The root namespace (usually from the project file). May be null
The file name of the parent of this dependency (usually a .cs file). May be null
File contents binary stream, may be null
Returns the manifest name
Utility function for creating a C#-style manifest name from
a resource name. Note that this function attempts to emulate the
Everret implementation of this code which can be found by searching for
ComputeNonWFCResourceName() or ComputeWFCResourceName() in
\vsproject\langproj\langbldmgrsite.cpp
The file name of the dependent (usually a .resx)
The file name of the dependent (usually a .resx)
The root namespace (usually from the project file). May be null
should the culture name be prepended to the manifest name as a path
The file name of the parent of this dependency (usually a .cs file). May be null
The override culture of this resource, if any
File contents binary stream, may be null
Task's TaskLoggingHelper, for logging warnings or errors
Whether to treat the current file as 'culture-neutral' and retain the culture in the name.
Returns the manifest name
Return 'true' if this is a C# source file.
Name of the candidate source file.
True, if this is a validate source file.
Base class for task that determines the appropriate manifest resource name to
assign to a given resx or other resource.
Utility function for creating a VB-style manifest name from
a resource name.
The file name of the dependent (usually a .resx)
The file name of the dependent (usually a .resx)
The root namespace (usually from the project file). May be null
The file name of the parent of this dependency (usually a .vb file). May be null
File contents binary stream, may be null
Returns the manifest name
Utility function for creating a VB-style manifest name from
a resource name. Note that this function attempts to emulate the
Everret implementation of this code which can be found by searching for
ComputeNonWFCResourceName() or ComputeWFCResourceName() in
\vsproject\langproj\langbldmgrsite.cpp
The file name of the dependent (usually a .resx)
The file name of the dependent (usually a .resx)
should the culture name be prepended to the manifest name as a path
The root namespace (usually from the project file). May be null
The file name of the parent of this dependency (usually a .vb file). May be null
The override culture of this resource, if any
File contents binary stream, may be null
Task's TaskLoggingHelper, for logging warnings or errors
Whether to treat the current file as 'culture-neutral' and retain the culture in the name.
Returns the manifest name
Return 'true' if this is a VB source file.
Name of the candidate source file.
True, if this is a validate source file.
Forward a list of items from input to output. This allows dynamic item lists.
Only apply the additional metadata is none already exists
A list of metadata name/value pairs to apply to the output items.
A typical input: "metadataname1=metadatavalue1", "metadataname2=metadatavalue2", ...
`
The engine fails on this because it doesn't like item lists being concatenated with string
constants when the data is being passed into an array parameter. So the workaround is to
write this in the project file:
``
]]>
Execute.
Create the list of output items.
Expand wildcards in the item list.
Create a table of unique items
Base class for task that determines the appropriate manifest resource name to
assign to a given resx or other resource.
Should the culture name be prepended to the manifest resource name as a directory?
This is true by default.
The possibly dependent resource files.
Rootnamespace to use for naming.
The resulting manifest names.
The initial list of resource names, with additional metadata for manifest resource names
Method in the derived class that composes the manifest name.
The file name of the dependent (usually a .resx)
The name of the file specified by the Link attribute.
The root namespace (usually from the project file). May be null
The file name of the parent of this dependency. May be null
File contents binary stream, may be null
Returns the manifest name
The derived class chooses whether this is a valid source file to work against.
Usually, this is just a matter of looking at the file's extension.
Name of the candidate source file.
True, if this is a validate source file.
Given a file path, return a stream on top of that path.
Path to the file
File mode
Access type
The FileStream
Execute the task with delegate handlers.
CreateFileStream delegate
True if task succeeded.
Do the task's work.
True if succeeded.
Is the character a valid first Everett identifier character?
Is the character a valid Everett identifier character?
Make a folder subname into an Everett-compatible identifier
Make a folder name into an Everett-compatible identifier
This method is provided for compatibility with Everett which used to convert parts of resource names into
valid identifiers
Just a straight pass-through of the inputs through to the outputs.
The in/out property value.
So ... why is this a string[] instead of a string?
Basically if the project author passed in:
CreateProperty Value="Clean;Build"
Output TaskParameter="Value" PropertyName="MyTargetsToBuild"
/CreateProperty
We need to respect the semicolon that they put in the value, and need to treat
this exactly as if they had done:
PropertyGroup
MyTargetsToBuild="Clean;Build"
/PropertyGroup
If we make this parameter a "string", then the engine will escape the
value on the way out from the task back to the engine, creating a property
that is set to "Clean%3BBuild", which is not what the user wanted.
This is to fool MSBuild into not doing its little TLDA trick whereby even if
a target is up-to-date, it will still set the properties that were meant to
be set using the CreateProperty task. This is because MSBuild is smart enough
to figure out the value of the output property without running the task.
But if the input parameter is differently named than the output parameter,
MSBuild can't be smart enough to do that. This is an important scenario
for people who want to know whether a particular target was up-to-date or not.
Create the property. Since the input property is the same as the
output property, this is rather easy.
Specific-purpose utility functions for parsing C#.
Parse a C# file and get the first class name, fully qualified with namespace.
Extract the class name.
File.GetAttributes delegate.
The path get attributes for.
File SetAttributes delegate.
The path to set attributes for.
The actual file attributes.
File SetLastAccessTime delegate.
File SetLastWriteTime delegate.
GetDirectories delegate.
The path to get directories for.
The pattern to search for.
An array of directories.
CopyFile delegate
Source file
Destination file
GetAssemblyName delegate
The path to the file
The assembly name.
GetAssemblyRuntimeVersion delegate to get the clr runtime version of a file.
The path to the file
The clr runtime version for the file
GetGacEnumerator delegate to get the enumerator which will enumerate over the GAC
StrongName to get an enumerator for
The enumerator for the gac
GetPathFromFusionName delegate to get path to a file based on the fusion name
StrongName to get a path for
The path to the assembly
Delegate. Given an assembly name, crack it open and retrieve the list of dependent
assemblies and the list of scatter files.
Path to the assembly.
Assembly metadata cache.
Receives the list of dependencies.
Receives the list of associated scatter files.
The framework name
Delegate to take in a dll path and read the machine type from the PEHeader
Delegate to get the path to an assembly in the GAC.
Determines if a assembly is an winmd file
CreateFileString delegate. Creates a stream on top of a file.
Path to the file
File mode
Access type
The Stream
Delegate for System.IO.File.GetLastWriteTime
The file name
The last write time.
Delete files from disk.
When true, errors will be logged as warnings.
Gets or sets the delay, in milliseconds, between any necessary retries.
Gets or sets the number of times to attempt to copy, if all previous attempts failed.
Set question parameter to verify if this is incremental.
Verify that the inputs are correct.
False on an error, implying that the overall delete operation should be aborted.
Stop and return (in an undefined state) as soon as possible.
Delete the files.
Log an error.
The file that wasn't deleted.
The exception.
Task that simply emits an error. Engine will add project file path and line/column
information.
Error message
Error code
Relevant file if any.
If none is provided, the file containing the Error
task will be used.
Error help keyword
A link pointing to more information about the error
Main task method
This class defines an "Exec" MSBuild task, which simply invokes the specified process with the specified arguments, waits
for it to complete, and then returns True if the process completed successfully, and False if an error occurred.
Default constructor.
Enable the pipe of the standard out to an item (StandardOutput).
Even thought this is called a pipe, it is in fact a Tee. Use StandardOutputImportance to adjust the visibility of the stdout.
Users can supply a regular expression that we should
use to spot error lines in the tool output. This is
useful for tools that produce unusually formatted output
Users can supply a regular expression that we should
use to spot warning lines in the tool output. This is
useful for tools that produce unusually formatted output
Whether to use pick out lines in the output that match
the standard error/warning format, and log them as errors/warnings.
Defaults to false.
Property specifying the encoding of the captured task standard output stream
Property specifying the encoding of the captured task standard error stream
Project visible property specifying the encoding of the captured task standard output stream
Project visible property specifying the encoding of the captured task standard error stream
Returns the output as an Item. Whitespace are trimmed.
ConsoleOutput is enabled when ConsoleToMSBuild is true. This avoids holding lines in memory
if they aren't used. ConsoleOutput is a combination of stdout and stderr.
Write out a temporary batch file with the user-specified command in it.
Executes cmd.exe and waits for it to complete
Overridden to clean up the batch file afterwards.
Upon completion of the process, returns True if successful, False if not.
Allows tool to handle the return code.
This method will only be called with non-zero exitCode set to true.
Overridden to make sure we display the command we put in the batch file, not the cmd.exe command
used to run the batch file.
Logs the tool name and the path from where it is being run.
Overridden to avoid logging the path to "cmd.exe", which is not interesting.
Logs the command to be executed.
Overridden to log the batch file command instead of the cmd.exe command.
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.
Overridden to handle any custom regular expressions supplied.
Returns true if the string is matched by the regular expression.
If the regular expression is invalid, logs an error, then clears it out to
prevent more errors.
Validate the task arguments, log any warnings/errors
true if arguments are corrent enough to continue processing, false otherwise
Accessor for ValidateParameters purely for unit-test use
Determining the path to cmd.exe
path to cmd.exe
Gets the working directory to use for the process. Should return null if ToolTask should use the
current directory.
May throw an IOException if the directory to be used is somehow invalid.
working directory
Accessor for GetWorkingDirectory purely for unit-test use
Adds the arguments for cmd.exe
command line builder class to add arguments to
The name of the tool to execute
Importance with which to log ordinary messages in the
standard error stream.
Importance with which to log ordinary messages in the
standard out stream.
Overridden to increase from the default "Low" up to "High".
Finds the app.config file, if any, in the provided lists.
For compat reasons, it has to follow a particular arbitrary algorithm.
It also adds the TargetPath metadata.
The primary list to search through
The secondary list to search through
The value to add as TargetPath metadata
The first matching item found in the list, if any
Find the app config
Examines the item to see if it matches what we are looking for.
If it does, returns true.
Returns the reference assembly paths to the various frameworks
Regex for breaking up the platform moniker
Example: XNA, Version=8.0
Reference moniker metadata
SimpleName group
Version group
List of Platform monikers for each referenced project
Target platform version of the current project
Target platform identifier of the current project
Invalid references to be unresolved
Execute the task.
Take the identity and the version of a platform moniker
Returns the paths to the various frameworks versions.
Does nothing: getters do all the work
Path to the latest framework, whatever version it happens to be
Path to the v1.1 framework, if available
Path to the v2.0 framework, if available
Path to the v3.0 framework, if available
Path to the v3.5 framework, if available
Path to the v4.0 framework, if available
Path to the v4.5 framework, if available
Path to the v4.5.1 framework, if available
Path to the v4.5.2 framework, if available
Path to the v4.6 framework, if available
Path to the v4.6.1 framework, if available
Path to the v4.6.2 framework, if available
Path to the v4.7 framework, if available
Path to the v4.7.1 framework, if available
Path to the v4.7.2 framework, if available
Path to the v4.8 framework, if available
Returns the reference assembly paths to the various frameworks
This is the sentinel assembly for .NET FX 3.5 SP1
Used to determine if SP1 of 3.5 is installed
Cache in a static whether or not we have found the 35sp1sentinel assembly.
Hold the reference assembly paths based on the passed in targetframeworkmoniker.
Hold the reference assembly paths based on the passed in targetframeworkmoniker without considering any profile passed in.
Returns the path based on the passed in TargetFrameworkMoniker. If the TargetFrameworkMoniker is null or empty
this path will be empty.
Returns the path based on the passed in TargetFrameworkMoniker without considering the profile part of the moniker. If the TargetFrameworkMoniker is null or empty
this path will be empty.
The target framework moniker to get the reference assembly paths for
The root path to use to generate the reference assembly path
By default GetReferenceAssemblyPaths performs simple checks
to ensure that certain runtime frameworks are installed depending on the
target framework.
set BypassFrameworkInstallChecks to true in order to bypass those checks.
If set to true, the task will not generate an error (or a warning) if the reference assemblies cannot be found.
This allows the task to be used to check whether reference assemblies for a framework are available.
Gets the display name for the targetframeworkmoniker
Target frameworks are looked up in @RootPath. If it cannot be found
there, then paths in @TargetFrameworkFallbackSearchPaths
are used for the lookup, in order. This can have multiple paths, separated
by ';'
If the target framework moniker is set, generate the correct Paths.
Generate the set of chained reference assembly paths
Generates a hash of a given ItemGroup items. Metadata is not considered in the hash.
Currently uses SHA256. Implementation subject to change between MSBuild versions.
This class is not intended as a cryptographic security measure, only uniqueness between build executions
- collisions can theoretically be possible in the future (should we move to noncrypto hash) and should be handled gracefully by the caller.
Usage of cryptographic secure hash brings slight performance penalty, but it is considered acceptable.
Would this need to be revised - XxHash64 from System.Io.Hashing could be used instead for better performance.
(That however currently requires load of additional binary into VS process which has it's own costs)
Items from which to generate a hash.
When true, will generate a case-insensitive hash.
Hash of the ItemsToHash ItemSpec.
Execute the task.
Add bytes to the sha buffer. Once the limit size is reached, sha.TransformBlock is called and the buffer is flushed.
Hashing algorithm sha.
The sha buffer which stores bytes of the strings. Bytes should be added to this buffer.
Number of used bytes of the sha buffer.
The size of sha buffer.
Bytes buffer which contains bytes to be written to sha buffer.
Amount of bytes that are to be added to sha buffer.
Updated shaBufferPosition.
There is no search path element because the only way to get this resolver is by having the SDKName metadata on the reference.
Resolved SDKs
Construct.
Task that emits an error given a resource string. Engine will add project file path and line/column
information.
Resource from which error message is extracted
Optional arguments to use when formatting the error message
Error code
Relevant file if any.
If none is provided, the file containing the Error
task will be used.
Error help keyword
Log the requested error message.
Extracted class name from the source file.
Whether or not we found the name inside a block of conditionally compiled code
Extracted class name
Read a list of items from a file.
File to read lines from.
Receives lines from file.
Execute the task.
Appends a list of items to a file. One item per line with carriage returns in-between.
File to write lines to.
Write each item as a line in the file.
If true, overwrite any existing file contents.
Encoding to be used.
If true, the target file specified, if it exists, will be read first to compare against
what the task would have written. If identical, the file is not written to disk and the
timestamp will be preserved.
Question whether this task is incremental.
When question is true, then error out if WriteOnlyWhenDifferent would have
written to the file.
Execute the task.
A task that finds an item with the specified itemspec, if present,
in the provided list.
The list to search through
Whether to match against just the file part of the itemspec,
or the whole itemspec (the default)
The first matching item found in the list, if any
The itemspec to try to find
Whether or not to match case sensitively
Whether or not to return the last match, instead of
the first one
Entry point
Examines the item to see if it matches what we are looking for.
If it does, returns true.
Formats a url by canonicalizing it (i.e. " " -> "%20") and transforming "localhost" to "machinename".
Formats a version by combining version and revision.
Case #1: Input: Version=<undefined> Revision=<don't care> Output: OutputVersion="1.0.0.0"
Case #2: Input: Version="1.0.0.*" Revision="5" Output: OutputVersion="1.0.0.5"
Case #3: Input: Version="1.0.0.0" Revision=<don't care> Output: OutputVersion="1.0.0.0"
Generates an application manifest for ClickOnce projects.
Generates a deploy manifest for ClickOnce projects.
Generates a bootstrapper for ClickOnce deployment projects.
Base class for all manifest generation tasks.
This class defines the "GenerateResource" MSBuild task, which enables using resource APIs
to transform resource files.
This class defines the "GenerateResource" MSBuild task, which enables using resource APIs
to transform resource files.
See GenerateResource.cs for the source code to the GenerateResource task; this file
just contains the nested internal ResGen task
Table of aliases for types defined in resx / resw files
Ordinal comparer matches ResXResourceReader's use of a HashTable.
The task items that we remoted across the appdomain boundary
we use this list to disconnect the task items once we're done.
Satellite input assemblies.
The names of the items to be converted. The extension must be one of the
following: .txt, .resx or .resources.
Indicates whether the resource reader should use the source file's directory to
resolve relative file paths.
Resolves types in ResX files (XML resources) for Strongly Typed Resources
Indicates whether resources should be passed through in their current serialization
format. .NET Core-targeted assemblies should use this; it's the only way to support
non-string resources with MSBuild running on .NET Core.
Additional inputs to the dependency checking done by this task. For example,
the project and targets files typically should be inputs, so that if they are updated,
all resources are regenerated.
This is the path/name of the file containing the dependency cache
The name(s) of the resource file to create. If the user does not specify this
attribute, the task will append a .resources extension to each input filename
argument and write the file to the directory that contains the input file.
Includes any output files that were already up to date, but not any output files
that failed to be written due to an error.
Storage for names of *all files* written to disk. This is part of the implementation
for Clean, and contains the OutputResources items and the StateFile item.
Includes any output files that were already up to date, but not any output files
that failed to be written due to an error.
Gets or sets the language to use when generating the class source for the strongly typed resource.
This parameter must match exactly one of the languages used by the CodeDomProvider.
Specifies the namespace to use for the generated class source for the
strongly typed resource. If left blank, no namespace is used.
Specifies the resource namespace or manifest prefix to use in the generated
class source for the strongly typed resource.
Specifies the class name for the strongly typed resource class. If left blank, the base
name of the resource file is used.
Specifies the filename for the source file. If left blank, the name of the class is
used as the base filename, with the extension dependent on the language.
Specifies whether the strongly typed class should be created public (with public methods)
instead of the default internal. Analogous to resgen.exe's /publicClass switch.
Whether this rule is generating .resources files or extracting .ResW files from assemblies.
Requires some additional input filtering.
(default = false)
When true, a new AppDomain is always created to evaluate the .resx files.
When false, a new AppDomain is created only when it looks like a user's
assembly is referenced by the .resx.
Even though the generate resource task will do the processing in process, a logging message is still generated. This logging message
will include the path to the windows SDK. Since the targets now will pass in the Windows SDK path we should use this for logging.
Property to allow multitargeting of ResolveComReferences: If true, tlbimp.exe and
aximp.exe from the appropriate target framework will be run out-of-proc to generate
the necessary wrapper assemblies.
Array of equals-separated pairs of environment
variables that should be passed to the spawned resgen.exe,
in addition to (or selectively overriding) the regular environment block.
These aren't currently used when resgen is run in-process.
That set of paths from which tracked inputs will be ignored during
Up to date checking
Property used to set whether tracked incremental build will be used. If true,
incremental build is turned on; otherwise, a rebuild will be forced.
True if we should be tracking file access patterns - necessary for incremental
build support.
Names of the read tracking logs.
Names of the write tracking logs.
Intermediate directory into which the tracking logs from running this task will be placed.
Microsoft.Build.Utilities.ExecutableType of ResGen.exe. Used to determine whether or not
Tracker.exe needs to be used to spawn ResGen.exe. If empty, uses a heuristic to determine
a default architecture.
Path to the appropriate .NET Framework location that contains FileTracker.dll. If set, the user
takes responsibility for making sure that the bitness of the FileTracker.dll that they pass matches
the bitness of the ResGen.exe that they intend to use. If not set, the task decides the appropriate
location based on the current .NET Framework version.
Should only need to be used in partial or full checked in toolset scenarios.
Path to the appropriate Windows SDK location that contains Tracker.exe. If set, the user takes
responsibility for making sure that the bitness of the Tracker.exe that they pass matches the
bitness of the ResGen.exe that they intend to use. If not set, the task decides the appropriate
location based on the current Windows SDK.
Should only need to be used in partial or full checked in toolset scenarios.
Where to extract ResW files. (Could be the intermediate directory.)
Simple public constructor.
Logs a Resgen.exe command line that indicates what parameters were
passed to this task. Since this task is replacing Resgen, and we used
to log the Resgen.exe command line, we need to continue logging an
equivalent command line.
Generate the parts of the resgen command line that are don't involve resgen.exe itself or the
resources to be generated.
Expects resGenCommand to be non-null -- otherwise, it doesn't get passed back to the caller, so it's
useless anyway.
This is the main entry point for the GenerateResource task.
true, if task executes successfully
For setting OutputResources and ensuring it can be read after the second AppDomain has been unloaded.
ITaskItems in another AppDomain
Remember this TaskItem so that we can disconnect it when this Task has finished executing
Only if we're passing TaskItems to another AppDomain is this necessary. This call
Will make that determination for you.
Computes the path to ResGen.exe for use in logging and for passing to the
nested ResGen task.
True if the path is found (or it doesn't matter because we're executing in memory), false otherwise
Wrapper around the call to the ResGen task that handles setting up the
task to run properly.
Array of names of inputs to be processed
Array of output names corresponding to the inputs
Given an instance of the ResGen task with everything but the strongly typed
resource-related parameters filled out, execute the task and return the result
Input files to give to resgen.exe.
Output files to give to resgen.exe.
Given the list of inputs and outputs, returns the number of resources (starting at the provided initial index)
that can fit onto the commandline without exceeding MaximumCommandLength.
Given an instance of the ResGen task with everything but the strongly typed
resource-related parameters filled out, execute the task and return the result
Input files to give to resgen.exe.
Output files to give to resgen.exe.
Factoring out the setting of the default parameters to the
ResGen task.
Check for parameter errors.
true if parameters are valid
Returns true if everything is up to date and we don't need to do any work.
Given a cached portable library that is up to date, create ITaskItems to represent the output of the task, as if we did real work.
The portable library cache entry to extract output files and metadata from.
List of output files produced from the cache.
Checks if this list contain any duplicates. Do this so we don't have any races where we have two
threads trying to write to the same file simultaneously.
A list that may have duplicates
Were there duplicates?
Determines if the given output file is up to date with respect to the
the given input file by comparing timestamps of the two files as well as
(if the source is a .resx) the linked files inside the .resx file itself
Returns true if the output does not exist, if the provided source is newer than the output,
or if any of the set of additional inputs is newer than the output. Otherwise, returns false.
Add the strongly typed resource to the set of resources to process if it is out of date.
Returns the newest last write time among the references and additional inputs.
If any do not exist, returns DateTime.MaxValue so that resource generation produces a nice error.
Make the decision about whether a separate AppDomain is needed.
If this algorithm is unsure about whether a separate AppDomain is
needed, it should always err on the side of returning 'true'. This
is because a separate AppDomain, while slow to create, is always safe.
Finds the "value" element expected to be the next element read from the supplied reader.
Deserializes the data content in order to figure out whether it implies a new app domain
should be used to process resources.
Deserializes a base64 block from a resx in order to figure out if its type is in the GAC.
Because we're not providing any assembly resolution callback, deserialization
will attempt to load the object's type using fusion rules, which essentially means
the GAC. So, if the object is null, it's definitely not in the GAC.
Chars that should be ignored in the nicely justified block of base64
Turns the nicely justified block of base64 found in a resx into a byte array.
Copied from fx\src\winforms\managed\system\winforms\control.cs
Make sure that OutputResources has 1 file name for each name in Sources.
Remove any output resources that we didn't successfully create (due to error) from the
OutputResources list. Keeps the ordering of OutputResources the same.
Q: Why didn't we keep a "successfully created" list instead, like in the Copy task does, which
would save us doing the removal algorithm below?
A: Because we want the ordering of OutputResources to be the same as the ordering passed in.
Some items (the up to date ones) would be added to the successful output list first, and the other items
are added during processing, so the ordering would change. We could fix that up, but it's better to do
the fix up only in the rarer error case. If there were no errors, the algorithm below skips.
Record the list of file that will be written to disk.
Read the state file if able.
Write the state file if there is one to be written.
Defines the "ResGen" MSBuild task, which enables using ResGen.exe
to generate strongly-typed resource classes and convert resource
files from one format to another.
Files being passed to ResGen.exe to be converted to a different resource format.
If a strongly typed resource class is being created, only one file may be
passed to InputFiles at a time.
Should be the same length as InputFiles or null. If null, the files output
by ResGen.exe will be named "inputFiles[i].resources". Otherwise, the
extensions on the output filesnames indicate which format the corresponding
input file will be translated to.
Specifies whether the strongly typed class should be created public (with public methods)
instead of the default internal. Analogous to resgen.exe's /publicClass switch.
Resolves types in ResX files (XML resources) for Strongly Typed Resources
Path to the SDK directory where ResGen.exe can be found
The language to use when generating the class source for the strongly typed resource.
This parameter must match exactly one of the languages used by the CodeDomProvider.
Specifies the namespace to use for the generated class source for the
strongly typed resource. If left blank, no namespace is used.
Specifies the class name for the strongly typed resource class. If left blank, the base
name of the resource file is used.
Specifies the filename for the source file. If left blank, the name of the class is
used as the base filename, with the extension dependent on the language.
Indicates whether the resource reader should use the source file's directory to
resolve relative file paths.
Returns the name of the tool to execute
Tracker.exe wants Unicode response files, and ResGen.exe doesn't care,
so make them Unicode across the board.
We no longer use Tracker.exe in ResGen, but given that as ResGen doesn't care,
there doesn't really seem to be a particular reason to change it back, either...
Invokes the ToolTask with the given parameters
True if the task succeeded, false otherwise
Fills the provided CommandLineBuilderExtension with all the command line options used when
executing this tool that can go into a response file.
ResGen 3.5 and earlier doesn't support response files, but ResGen 4.0 and later does.
Gets filled with command line options
Fills the provided CommandLineBuilderExtension with all the command line options used when
executing this tool that must go on the command line
Has to be command line commands because ResGen 3.5 and earlier don't know about
response files.
Gets filled with command line options
Generates the full path to the tool being executed by this ToolTask
A string containing the full path of this tool, or null if the tool was not found
Validates the parameters passed to the task
True if parameters are valid
Checks a string array for null or length zero. Does not check if
individual members are null
The string array to check
True if the array is null or has length zero
If OutputFiles is null, we need to generate default output names
to pass to resgen.exe (which would generate the names on its own, but
then we wouldn't have access to them)
Generates the full path to ResGen.exe.
The path to ResGen.exe, or null.
Generate the command line to be passed to resgen.exe, sans the path to the tool.
This class handles the processing of source resource files into compiled resource files.
Its designed to be called from a separate AppDomain so that any files locked by ResXResourceReader
can be released.
List of readers used for input.
Logger for any messages or errors
Language for the strongly typed resources.
Filename for the strongly typed resources.
Getter provided since the processor may choose a default.
Namespace for the strongly typed resources.
ResourceNamespace for the strongly typed resources.
Class name for the strongly typed resources.
Getter provided since the processor may choose a default.
Whether the fields in the STR class should be public, rather than internal
Class that gets called by the ResxResourceReader to resolve references
to assemblies within the .RESX.
Handles assembly resolution events.
The referenced assemblies
The AssemblyNameExtensions for each of the referenced assemblies in "assemblyFiles".
This is populated lazily.
List of input files to process.
List of satellite input files to process.
List of output files to process.
Whether we are extracting ResW files from an assembly, instead of creating .resources files.
Where to write extracted ResW files.
Record all the information about outputs here to avoid future incremental builds.
List of output files that we failed to create due to an error.
See note in RemoveUnsuccessfullyCreatedResourcesFromOutputResources()
Whether we successfully created the STR class
Indicates whether the resource reader should use the source file's
directory to resolve relative file paths.
Process all files.
Callback to resolve assembly names to assemblies.
Read all resources from a file and write to a new file in the chosen format
Uses the input and output file extensions to determine their format
Input resources file
Output resources file or directory
True if conversion was successful, otherwise false
For very long resource names, the directory structure we generate may be too deep.
If so, assume that the name is so long it will already uniquely distinguish itself.
However for shorter names we'd still prefer to use the assembly simple name
in the path to avoid conflicts.
The current path name
The current file name without a path.
Output directory path
culture for this resource
The current path or a shorter one.
Remove a corrupted file, with error handling and a warning if we fail.
Full path to file to delete
Figure out the format of an input resources file from the extension
Input resources file
Resources format
Text files are just name/value pairs. ResText is the same format
with a unique extension to work around some ambiguities with MSBuild
ResX is our existing XML format from V1.
Reads the resources out of the specified file and populates the
resources hashtable.
Filename to load
Whether to resolve paths in the
resources file relative to the resources file location
Output file or directory.
Legacy Core implementation of string-only ResX handling
Reads resources from an assembly.
Output file or directory.
This should not run for Framework assemblies.
Checks the consistency of the CultureInfo and NeutralResourcesLanguageAttribute settings.
Assembly's file name
AssemblyName of this assembly
Assembly's CultureInfo
The actual Assembly
Whether this is the main assembly
Write resources from the resources ArrayList to the specified output file
Reader information
Output resources file
Create a strongly typed resource class
Reader information
Output resource filename, for defaulting the class filename
Input resource filename, for error messages
The generated strongly typed filename
If no strongly typed resource class filename was specified, we come up with a default based on the
input file name and the default language extension.
Broken out here so it can be called from GenerateResource class.
A CodeDomProvider for the language
Name of the output resources file
Filename for strongly typed resource class
Tries to create a CodeDom provider for the specified strongly typed language. If successful, returns true,
otherwise returns false.
Broken out here so it can be called from GenerateResource class.
Not a true "TryXXX" method, as it still throws if it encounters an exception it doesn't expect.
Logger helper.
The language to create a provider for.
The provider in question, if one is successfully created.
True if the provider was successfully created, false otherwise.
Read resources from an XML or binary format file
Reader info
Appropriate IResourceReader
Filename, for error messages
Read resources from a text format file
Reader info
Input resources filename
Write resources to an XML or binary format resources file.
Closes writer automatically
Reader information
Appropriate IResourceWriter
Write resources to a text format resources file
Reader information
Output resources file
Add a resource from a text file to the internal data structures
Reader information
Resource name
Resource value
Input file for messages
Line number for messages
Column number for messages
Add a resource from an XML or binary format file to the internal data structures
Reader information.
Resource name.
Resource value.
Input file for messages.
Custom StreamReader that provides detailed position information,
used when reading text format resources
For flow of control and passing sufficient error context back
from ReadTextResources
This implemention of ITypeResolutionService is passed into the ResxResourceReader
class, which calls back into the methods on this class in order to resolve types
and assemblies that are referenced inside of the .RESX.
Constructor, initialized with the set of resolved reference paths passed
into the GenerateResource task.
Not implemented. Not called by the ResxResourceReader.
Not implemented. Not called by the ResxResourceReader.
Given a path to an assembly, load the assembly if it's not already loaded.
Not implemented. Not called by the ResxResourceReader.
Returns the type with the specified name. Searches for the type in all
of the assemblies passed into the References parameter of the GenerateResource
task.
Returns the type with the specified name. Searches for the type in all
of the assemblies passed into the References parameter of the GenerateResource
task.
Returns the type with the specified name. Searches for the type in all
of the assemblies passed into the References parameter of the GenerateResource
task.
Not implemented. Not called by the ResxResourceReader.
Sniffs input files for their assembly identities, and outputs a set of items with the identity information.
Input: Assembly Include="foo.exe"
Output: Identity Include="Foo, Version=1.0.0.0", Name="Foo, Version="1.0.0.0"
Gathers the list of installed SDKS in the registry and on disk and outputs them into the project
so they can be used during SDK reference resolution and RAR for single files.
Metadata name for directory roots on installed SDK items
Metadata name for extension directory roots on installed SDK items
Metadata name for SDK Name
Metadata name for registry roots on installed SDK items
Key into our build cache
Target platform version
Target platform identifier
Platform version we are targeting
Platform identifier we are targeting
Root registry root to look for SDKs
Root directory on disk to look for SDKs
Root directories on disk to look for new style extension SDKs
When set to true, the task will produce a warning if there were no SDKs found.
Set of items that represent all of the installed SDKs found in the SDKDirectory and SDKRegistry roots.
The itemspec is the SDK install location. There is a piece of metadata called SDKName which contains the name of the SDK.
Get the SDK.
Resolves an SDKReference to a full path on disk
Set of resolvedSDK references which we will use to find the reference assemblies.
Set of resolved reference assemblies. This removes any duplicate ones between sdks.
Set of resolved reference assemblies. This removes any duplicate ones between sdks.
Set of reference assembly extensions to look for.
Dictionary of SDK Identity to the cache file that contains the file information for it.
Set of exceptions which were thrown while reading or writing to the cache file, this needs to be thread safe since TPL code will add exceptions into this structure at the same time.
Delegate to get the assembly name
Get the image runtime version from a file
File exists delegate
When false, allow fire-and-forget background work.
Folder where the cache files are written to
Path where the cache files should be stored
Resolved SDK references which we will get the reference assemblies from.
Extensions which should be considered reference files, we will look for
the files in the order they are specified in the array.
Should the references found as part of resolving the sdk be logged.
The default is true
Should the redist files found as part of resolving the sdk be logged.
The default is true
The targetted SDK identifier.
The targeted SDK version.
The targetted platform identifier.
The targeted platform version.
Resolved reference items.
Resolved redist files.
Files that need to be copied locally, this is the reference assemblies and the xml intellisense files.
Should conflicts between redist files within an SDK be logged as a message or a warning.
The default is to log them as a message.
Should conflicts between redist files across different referenced SDKs be logged as a message or a warning.
The default is to log them as a warning.
Should conflicts between reference files within an SDK be logged as a message or a warning.
The default is to log them as a message.
Should conflicts between reference files across different referenced SDKs be logged as a message or a warning.
The default is to log them as a warning.
Should we log exceptions which were hit when the cache file is being read and written to
Execute the task
Execute the task
Find the redist files
Find references for the sdk
Generate the output groups
Gather the reference assemblies from the referenceassembly directory.
Gather the redist files from the redist directory.
Gather the contents of all of the SDK into a cache file and save it to disk.
Get the referenced file names from the SDK's manifest if applicable- may return null.
Class which represents a resolved reference assembly
Is the reference copy local
Constructor
What is the file name
What is the location of the assembly on disk.
Is the assembly copy local or not.
Original resolved SDK reference item passed in.
Override object equals to use the equals redist in this object.
Override get hash code
Are two resolved references items Equal
Class which represents a resolved redist file
Constructor
What is the file name
What is the targetPath for the redist file.
What is the root directory of the target path
Original resolved SDK reference item passed in.
Override object equals to use the equals redist in this object.
Override get hash code
Are two resolved references items Equal
Methods which are used to save and read the cache files per sdk from and to disk.
Thread-safe queue which contains exceptions throws during cache file reading and writing.
Delegate to get the assembly name
Get the image runtime version from a file
File exists delegate
Location for the cache files to be written to
Constructor
Load reference assembly information from the cache file
Save assembly reference information to the cache file
Get references from the paths provided, and populate the provided cache
Populate an existing assembly dictionary for the given framework moniker utilizing provided manifest reference information
Populate an existing assembly dictionary for the given framework moniker
Populate an existing assembly dictionary for the given framework moniker
Is the assembly list cache file up to date.
This is done by comparing the last write time of the cache file to the last write time of the code.
If our code is newer than the last write time of the cache file then there may be some different serialization used so we should say it is out of date and just regenerate it.
Generate an SDKReferenceInfo object
Generate cache file name from sdkIdentity, sdkRoot and suffixHash.
Get all redist subdirectories under the given path
Get all reference subdirectories under the given path
Class to contain some identity information about a file in an sdk
This is a serialization format. Do not change member naming.
Structure that contains the on disk representation of the SDK in memory.
A dictionary which maps a file path to a structure that contain some metadata information about that file.
Hashset
This class represents the context information used by the background cache serialization thread.
Constructor
Identity of the sdk
Root path of the sdk
Assembly metadata information
Defines an interface for the Vbc/Csc tasks to communicate information about
analyzers and rulesets to the IDE.
Defines an interface for the Csc task to communicate with the IDE. In particular,
the Csc task will delegate the actual compilation to the IDE, rather than shelling
out to the command-line compilers.
Defines an interface for the Csc task to communicate with the IDE. In particular,
the Csc task will delegate the actual compilation to the IDE, rather than shelling
out to the command-line compilers.
Defines an interface for the Csc task to communicate with the IDE. In particular,
the Csc task will delegate the actual compilation to the IDE, rather than shelling
out to the command-line compilers.
Defines an interface for the Csc task to communicate with the IDE. In particular,
the Csc task will delegate the actual compilation to the IDE, rather than shelling
out to the command-line compilers.
Defines an interface for the Vbc task to communicate with the IDE. In particular,
the Vbc task will delegate the actual compilation to the IDE, rather than shelling
out to the command-line compilers.
Defines an interface for the Vbc task to communicate with the IDE. In particular,
the Vbc task will delegate the actual compilation to the IDE, rather than shelling
out to the command-line compilers.
Defines an interface for the Vbc task to communicate with the IDE. In particular,
the Vbc task will delegate the actual compilation to the IDE, rather than shelling
out to the command-line compilers.
Defines an interface for the Vbc task to communicate with the IDE. In particular,
the Vbc task will delegate the actual compilation to the IDE, rather than shelling
out to the command-line compilers.
Defines an interface that proffers a free threaded host object that
allows for background threads to call directly (avoids marshalling
to the UI thread.
Defines a free threaded interface for the Vbc task to communicate with the IDE. In particular,
the Vbc task will delegate the actual compilation to the IDE, rather than shelling
out to the command-line compilers.
This particular version of Compile (unlike the IVbcHostObject::Compile) is not marshalled back to the UI
thread. The implementor of the interface is responsible for any marshalling.
This was added to allow some of the implementors code to run on the BG thread from which VBC Task is being
called from.
A parameter passed to the task was invalid.
Currently used by the RAR task.
ArgumentException was not used because it does not have a property for ActualValue.
ArgumentOutOfRangeException does, but it appends its own message to yours.
Constructor
Constructor
Constructor
The name of the parameter.
The value supplied, that was bad.
The License Compiler task
Specifies the items that contain licensed components that need to be included in the .licenses file
The name of the .licenses file, output only. It's inferred from LicenseTarget and OutputDirectory.
Specifies the executable for which the .licenses files are being generated
Output directory for the generated .licenses file
Specifies the referenced components (licensed controls and possibly their dependent assemblies)
to load when generating the .license file.
Suppresses the display of the startup banner
Targeted version of the framework (i.e. 4.5 or 2.0, etc.)
The name of the tool to execute
Validate the task arguments, log any warnings/errors
true if arguments are corrent enough to continue processing, false otherwise
Determing the path to lc.exe
path to lc.exe, null if not found
Generates arguments to be passed to lc.exe
command line builder class to add arguments to
Generates response file with arguments for lc.exe
Used when targeting framework version is 4.6 or later
command line builder class to add arguments to the response file
Generates command line arguments for lc.exe
Used when targeting framework version is less than 4.6
command line builder class to add arguments to the command line
Given a list of items, determine which are in the cone of the folder passed in and which aren't.
Filter based on whether items fall under this path or not.
Files to consider.
Set to true if the paths of the output items should be updated to be absolute
Files that were inside of Path.
Files that were outside of Path.
Execute the task.
Given a list of items, remove duplicate items. Attributes are not considered. Case insensitive.
The left-hand set of items to be RemoveDuplicatesed from.
List of unique items.
True if any duplicate items were found. False otherwise.
Execute the task.
Starts a new Restart Manager session.
A maximum of 64 Restart Manager sessions per user session
can be open on the system at the same time. When this
function starts a session, it returns a session handle
and session key that can be used in subsequent calls to
the Restart Manager API.
A pointer to the handle of a Restart Manager session.
The session handle can be passed in subsequent calls
to the Restart Manager API.
Reserved. This parameter should be 0.
A null-terminated string that contains the session key
to the new session. The string must be allocated before
calling the RmStartSession function.
System error codes that are defined in Winerror.h.
The RmStartSession function doesn’t properly null-terminate
the session key, even though the function is documented as
returning a null-terminated string. To work around this bug,
we pre-fill the buffer with null characters so that whatever
ends gets written will have a null terminator (namely, one of
the null characters we placed ahead of time).
see .
Ends the Restart Manager session.
This function should be called by the primary installer that
has previously started the session by calling the
function. The RmEndSession function can be called by a secondary installer
that is joined to the session once no more resources need to be registered
by the secondary installer.
A handle to an existing Restart Manager session.
The function can return one of the system error codes that are defined in Winerror.h.
Try to get a message to inform the user which processes have a lock on a given file.
A task that creates a directory
Executes the MakeDir task. Create the directory.
Task that simply emits a message. Importance defaults to high if not specified.
Text to log.
Importance: high, normal, low (default normal)
Message code
Relevant file if any.
If none is provided and this is a critical message, the file containing the Message
task will be used.
Message help keyword
Indicates if this is a critical message
Task to move one or more files.
This does not support moving directories (ie, xcopy)
but this could restriction could be lifted as MoveFileEx,
which is used here, supports it.
Flags for MoveFileEx.
Whether we should cancel.
List of files to move.
Destination folder for all the source files.
Whether to overwrite files in the destination
that have the read-only attribute set.
Default is to not overwrite.
Destination files matching each of the source files.
Subset that were successfully moved.
Set question parameter for Move task.
Move can be chained A->B->C with location C as the final location.
Incrementally, it is hard to question A->B if both files are gone.
In short, question will always return false and author should use target inputs/outputs.
Stop and return (in an undefined state) as soon as possible.
Main entry point.
Makes the provided file writeable if necessary.
Move one file from source to destination. Create the target directory if necessary.
IO related exceptions.
This class implements the "MSBuild" task, which hands off child project files to the MSBuild engine to be built.
Marked RunInMTA because there is no reason MSBuild tasks should run on a thread other than that of the
RequestBuilder which spawned them.
Enum describing the behavior when a project doesn't exist on disk.
Default when unset by user.
Skip the project if there is no file on disk.
Error if the project does not exist on disk.
Build even if the project does not exist on disk.
A list of property name/value pairs to apply as global properties to
the child project.
A typical input: "propname1=propvalue1", "propname2=propvalue2", "propname3=propvalue3".
`
The engine fails on this because it doesn't like item lists being concatenated with string
constants when the data is being passed into an array parameter. So the workaround is to
write this in the project file:
``
]]>
Gets or sets the set of global properties to remove.
The targets to build in each project specified by the property.
Array of target names.
The projects to build.
Array of project items.
Outputs of the targets built in each project.
Array of output items.
Indicates if the paths of target output items should be rebased relative to the calling project.
true, if target output item paths should be rebased
Forces the task to stop building the remaining projects as soon as any of
them fail.
When this is true, instead of calling the engine once to build all the targets (for each project),
we would call the engine once per target (for each project). The benefit of this is that
if one target fails, you can still continue with the remaining targets.
Value of ToolsVersion to use when building projects passed to this task.
When this is true we call the engine with all the projects at once instead of
calling the engine once per project
If true the project will be unloaded once the operation is completed
Deprecated. Does nothing.
When this is true, project files that do not exist on the disk will be skipped. By default,
such projects will cause an error.
Unescape Targets, Properties (including Properties and AdditionalProperties as Project item metadata)
will be un-escaped before processing. e.g. %3B (an escaped ';') in the string for any of them will
be treated as if it were an un-escaped ';'
Instructs the MSBuild engine to build one or more project files whose locations are specified by the
property.
true if all projects build successfully; false if any project fails
Build projects which have not been skipped. This will be done in parallel
Expand and re-construct arrays of all targets and properties
True if the operation was successful
The original ITypeInfo interface in the CLR has incorrect definitions for GetRefTypeOfImplType and GetRefTypeInfo.
It uses ints for marshalling handles which will result in a crash on 64 bit systems. This is a temporary interface
for use until the one in the CLR is fixed. When it is we can go back to using ITypeInfo.
Interop methods.
Add implementation of this function when not running on windows. The implementation is
not complete, of course, but should work for most common cases.
GetCachePath from fusion.dll.
A common design pattern in unmanaged C++ is calling a function twice, once to determine the length of the string
and then again to pass the client-allocated character buffer.
Value that indicates the source of the cached assembly.
The returned pointer to the path.
The requested maximum length of CachePath, and upon return, the actual length of CachePath.
Get the runtime version for a given file.
The path of the file to be examined.
The buffer allocated for the version information that is returned.
The size, in wide characters, of szBuffer.
The size, in bytes, of the returned szBuffer.
HResult.
Given a pointer to a metadata blob, read the string parameter from it. Returns true if
a valid string was constructed and false otherwise.
Adapted from bizapps\server\designers\models\packagemodel\nativemethods.cs (TryReadStringArgument) and
the original ARD implementation in vsproject\compsvcspkg\enumcomplus.cpp (GetStringCustomAttribute)
This code was taken from the vsproject\ReferenceManager\Providers\NativeMethods.cs
Returns the number of bytes that compressed data -- the length of the uncompressed
data -- takes up, and has an out value of the length of the string.
Decompression algorithm stolen from ndp\clr\src\toolbox\mdbg\corapi\metadata\cormetadata.cs, which
was translated from the base implementation in ndp\clr\src\inc\cor.h
This code was taken from the vsproject\ReferenceManager\Providers\NativeMethods.cs
Pointer to the beginning of the data block
Length of the uncompressed data block
This class is a wrapper over the native GAC enumeration API.
Path to the gac
Regex for directory version parsing
The IAssemblyEnum interface which allows us to ask for the next assembly from the GAC enumeration.
For non-Windows implementation, we need assembly name
For non-Windows implementation, we need assembly name
Are we done going through the enumeration.
Initialize the GAC Enum
State used by the c# and vb parsers. Maintains information about
what's being parsed and what has been seen so far.
Are we resolving a namespace?
Are we resolving a class?
Are we inside a conditional directive?
The current namespace name as its being resolved.
Reset the state, but don't throw away namespace stack information.
Note that we've entered a conditional directive
Note that we've exited a conditional directive
Push a namespace element onto the stack. May be null.
Pop a namespace element from the stack. May be null.
Build a fully qualified (i.e. with the namespace) class name based on the contents of the stack.
Defines list of redistributable assemblies for use in dependency analysis.
The input is a set of XML files in a well known format consisting of
File elements. Each File element defines the assembly name of an assembly
that is part of a redistributable unit, such as the .NET Framework
(i.e. dotnetfx.exe) or the J# Framework. For the .NET Framework, these
data files are specified in a sub-folder of the .NET Framework named
"RedistList". This list is used by the build system to unify previous
Framework version dependencies to the current Framework version.
This list is also used by the deployment system to exclude Framework
dependencies from customer deployment packages.
When we check to see if an assembly is in this redist list we want to cache it so that if we ask again we do not
have to re-scan bits of the redist list and do the assemblynameExtension comparisons.
AssemblyName to unified assemblyName. We make this kind of call a lot and also will ask for the same name multiple times.
AssemblyName to AssemblyNameExtension object. We make this kind of call a lot and also will ask for the same name multiple times.
When we check to see if an assembly is remapped we should cache the result because we may get asked the same question a number of times.
Since the remapping list does not change between builds neither would the results of the remapping for a given fusion name.
Returns any exceptions encountered while reading\parsing the XML.
Returns any exceptions encountered while reading\parsing the XML.
Returns the number of entries in the redist list
Determines whether or not the specified assembly is part of the Framework.
Assemblies from a previous version of the Framework will be
correctly identified.
Determines whether or not the specified assembly is a Prerequisite assembly.
A prerequisite assembly is any assembly that is flagged as being installed in the GAC
in a redist data file.
If there was a remapping entry in the redist list then remap the passed in assemblynameextension
if not just return the original one.
Determines whether or not the specified assembly is a redist root.
Returns an instance of RedistList initialized from the framework folder for v2.0
This function returns a statically cached object, so all calls will return the
same instance.
Returns an instance of RedistList initialized from the framework folder for v3.0
This function returns a statically cached object, so all calls will return the
same instance.
Returns an instance of RedistList initialized from the framework folder for v3.5
This function returns a statically cached object, so all calls will return the
same instance.
This is owned by chris mann
Given a framework directory path, this static method will find matching
redist list files underneath that path. A process-wide cache is used to
avoid hitting the disk multiple times for the same framework directory.
Array of paths to redist lists under given framework directory.
The name of this redist.
Returns an instance of RedistList initialized from the specified set of files.
This function returns a statically cached object, so subsequent calls with the same set
of files will return the same instance.
Given an assemblyNameExtension, is that assembly name in the redist list or not. This will use partial matching and match as much of the fusion name as exists in the assemblyName passed in.
Returns the unified version of the specified assembly.
Assemblies from a previous version of the Framework will be
returned with the current runtime version.
Find every assembly full name that matches the given simple name.
The list of assembly names.
This method will take a list of AssemblyTableInfo and generate a deny list by subtracting the
assemblies listed in the AllowList from the RedistList.
1) If there are assemblies in the redist list and one or more client subset files are read in with matching names then
the subtraction will take place. If there were no matching redist lists read in the deny list will be empty.
2) If the subset has a matching name but there are no files inside of it then the deny list will contain ALL files in the redist list.
3) If the redist list assembly has a null or empty redist name or the subset list has a null or empty subset name they will not be used for deny list generation.
When generating the denylist, we will first see if the deny list is in the appdomain wide cache
so that we do not regenerate one for multiple calls using the same allowListAssemblyTableInfo.
List of paths to allow list xml files
List of allow listed errors
List of allow listed error file names
A dictionary containing the full assembly names of deny listed assemblies as the key, and null as the value.
If there is no assemblies in the redist list null is returned.
Read the redist list from disk.
XML formatting issues will recorded in the 'errors' collection.
Information about the redistlist file.
List of assembly from installed assembly table.
Error list.
Error filename list.
Assembly remaping.
Redist name of the redist list just read in
Parse the remapping xml element in the redist list
Parse the FileList section in the redist list.
Parse an individual FileListEntry in the redist list
The redist list is a collection of AssemblyEntry. We would like to have the redist list sorted on two keys.
The first key is simple name, the simple names should be sorted alphabetically in ascending order (a,b,c,d,e).
When the simple names are the same the sorting shouldbe done by version number rather than the alphabetical representation of the version.
A numerical comparison is required because the alphabetical sort does not place the versions in numerical order. For example 1, 10, 2, 3, 4
This sort should be done descending ( 10,9,8,7,6,5) so that if the resdist list is read from top to bottom the newest version is seen first.
Internal class representing a redist list or allowlist and its corresponding framework directory.
Provide a mechanism to determine where the subset allow lists are located by searching the target framework folders
for a list of provided subset list names.
The subset names to search for.
This class takes in a list of subset names to look for and provides a method to search the target framework directories to see if those
files exist.
String array of subset names, ie Client, Net, MySubset. This may be null or empty if no subsets were requested to be
found in the target framework directories. This can happen if the subsets are instead passed in as InstalledDefaultSubsetTables
Folder to look for the subset lists under the target framework directories
Given a framework directory path, this method will find matching
subset list files underneath that path. An appdomain-wide cache is used to
avoid hitting the disk multiple times for the same framework directory and set of requested subset names.
Framework directory to look for set of subset files under
Array of paths locations to subset lists under the given framework directory.
Describes an assembly entry found in an installed assembly table.
Remove the specified directories.
This class is a caching mechanism for the resgen task to keep track of linked
files within processed .resx files.
The list of resx files.
A list of portable libraries and the ResW files they can produce.
A newly-created ResGenDependencies is not dirty.
What would be the point in saving the default?
This is the directory that will be used for resolution of files linked within a .resx.
If this is NULL then we use the directory in which the .resx is in (that should always
be the default!)
Writes the contents of this object out to the specified file.
Reads the .cache file from disk into a ResGenDependencies object.
Represents a single .resx file in the dependency cache.
Given a .RESX file, returns all the linked files that are referenced within that .RESX.
May be thrown if Resx is invalid. May contain XmlException.
May be thrown if Resx is invalid
Represents a single assembly in the dependency cache, which may produce
0 to many ResW files.
Must be serializable because instances may be marshaled cross-AppDomain, see .
Whether this cache is dirty or not.
Determines which file, if any, to be used as the code analysis rule set based
on the supplied code analysis properties.
The desired code analysis rule set file. May be a simple name, relative
path, or full path.
The set of additional directories to search for code analysis rule set files.
The location of the project currently being built.
The location of the resolved rule set file. May be null if the file
does not exist on disk.
Runs the task.
True if the task succeeds without errors; false otherwise.
Computes the resolved rule set path.
There are four cases: null, file name, relative path, and full path.
If we were given no value for the ruleset, simply return null.
For full path we return the string as it is.
A simple file name can refer to either a file in the MSBuild project directory
or a file in the rule set search paths. In the former case we return the string as-is.
In the latter case, we create a full path by prepending the first rule set search path
where the file is found.
For relative paths we return the string as-is.
In all cases, we return null if the file does not actual exist.
The full or relative path to the rule set, or null if the file does not exist.
Determine the strong name key source
This task resolves items in the build process (built, dependencies, satellites,
content, debug symbols, documentation, etc.) to files for manifest generation.
This task executes following steps:
(1) Filter out Framework assemblies
(2) Filter out non-existent files
(3) Build list of Dependencies from built items with CopyLocal=True
(4) Build list of Prerequisites from built items with CopyLocal=False
(5) Build list of Satellites from built items based on TargetCulture
(6) Build list of Files from Files and ExtraFiles inputs, using next step
(7) For each PublishFile item...
If item is on Dependencies list then move it to Prerequisites list
If item is on Content list then add it to File list unless it is excluded
If item is on Extra list then add it to File list only if it is included
Apply Group and Optional attributes from PublishFile items to built items
(8) Insure all output items have a TargetPath, and if in a Group that IsOptional is set
This task determines the output files for non-MSBuild project references. We look inside
a special property set by the VS IDE for the list of project guids and their associated outputs.
While there's nothing that would prevent resolution of MSBuild projects in this task, the IDE
only pre-resolves non-MSBuild projects so that we can separate MSBuild project references from
non-MSBuild ones and return the list of MSBuild projects as UnresolvedProjectReferences.
Then we can use more powerful MSBuild mechanisms to manipulate just the MSBuild project
references (i.e. calling into specific targets of references to get the manifest file name)
which would not be possible with a mixed list of MSBuild and non-MSBuild references.
default public constructor
A special XML string containing resolved project outputs - we need to simply match the projects and
return the appropriate paths
The list of resolved reference paths (preserving the original project reference attributes)
The list of project reference items that could not be resolved using the pre-resolved list of outputs.
Since VS only pre-resolves non-MSBuild projects, this means that project references in this list
are in the MSBuild format.
A delegate with a signature that matches AssemblyName.GetAssemblyName.
A dependency-injection way of getting an assembly name.
Main task method
Given a project reference task item and an XML document containing pre-resolved output paths,
find the output path for that task item.
project reference to resolve
resulting ITaskItem containing the resolved path
true if resolved successfully
Base class for ResolveNonMSBuildProjectOutput and AssignProjectConfiguration, since they have
similar architecture
The list of project references
Checks if a project reference task item contains all the required attributes.
Currently, the only required attribute is project GUID for inside the IDE mode.
Checks all project reference task items for required attributes
Internal for unit testing
Pre-cache individual project elements from the XML string in a hashtable for quicker access.
Helper method for retrieving whatever was stored in the XML string for the given project
Helper method for retrieving the XML element for the given project
Helper method for retrieving the extra "project references" passed in the solution blob.
These came from dependencies expressed in the solution file itself.
Resolves an SDKReference to a full path on disk
Platform aliases
Regex for breaking up the sdk reference include into pieces.
Example: XNA, Version=8.0
SimpleName group
Version group
Delimiter used to delimit the dependent sdk's in the warning message
Split char for the appx attribute
SDKName
PlatformVersion
Default target platform version
Set of sdk references to resolve to paths on disk.
The list of installed SDKs the location of the SDK, the SDKName metadata is the SDKName.
stores value of TargetPlatformVersion property
Stores TargetPlatform property
Stores ProjectName property
Stores dictionary with runtime only reference dependencies
Set of SDK References to resolve to paths on disk
The list of installed SDKs the location of the SDK, the SDKName metadata is the SDKName.
TargetPlatform used in warning/error messages
ProjectName used in warning/error messages
TargetPlatformVersion property used to filter SDKs
Reference may be passed in so their SDKNames can be resolved and then sdkroot paths can be tacked onto the reference
so RAR can find the assembly correctly in the sdk location.
List of disallowed dependencies passed from the targets file (deprecated)
For instance "VCLibs 11" should be disallowed in projects targeting Win 8.1 or higher.
List of dependencies passed from the targets file that will have the metadata RuntimeReferenceOnly set as true.
For instance "VCLibs 11" should have such a metadata set to true in projects targeting Win 8.1 or higher.
Configuration for SDK's which are resolved
Architecture of the SDK's we are targeting
Enables warning when MaxPlatformVersion is not present in the manifest and the ESDK platform version (from its path)
is different than the target platform version (from the project)
Should problems resolving SDKs be logged as a warning or an error.
If the resolution problem is logged as an error the build will fail.
If the resolution problem is logged as a warning we will warn and continue.
The prefer32bit flag used during the build
Resolved SDK References
Version object containing target platform version
Execute the task.
Add metadata to a specified subset of reference items
Verify the dependencies SDKs have for each other
Get a set of unresolved SDK identities
Parse out the sdk identities
Parse the item include of the SDKReference item into its simple name and version parts.
Take the identity of an sdk and use a regex to parse out the version and simple name
Log where we searched ect, for sdk references and if we found them or not.
Log an error or warning depending on the LogErrorsAsWarnigns propertry.
This class holds the sdk reference task item and the split versions of the simple name and version.
Delimiter for supported architectures
Delimiter used to delimit the supported architectures in the error message
Neutral architecture name
Neutral architecture name
ANY CPU architecture name
TargetedSDKArchitecture metadata name
TargetedSDKConfiguration metadata name
Retail config name
Debug config name
Path to the sdk manifest file
SDKManifest object encapsulating all the information contained in the manifest xml file
What should happen if this sdk is resolved with other sdks of the same productfamily or same sdk name.
Value of the prefer32Bit property from the project.
Constructor
Sdk reference item passed in from the build
Parsed simple name
Parsed version.
Resolved full path to the root of the sdk.
Has the reference been resolved
Messages which may be warnings or errors depending on the logging setting.
Warning messages only
Messages generated during resolution
SDKName, this is a formatted name based on the SimpleName and the Version
Resolved item which will be output by the task.
SDKType found in the sdk manifest
The target platform in the sdk manifest
The target platform min version in the sdk manifest
The target platform max version in the sdk manifest
DisplayName found in the sdk manifest
Support Prefer32bit found in the sdk manifest
CopyRedistToSubDirectory specifies where the redist files should be copied to relative to the root of the package.
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.
SupportsMultipleVersions specifies what should happen if multiple versions of the product family or sdk name are detected
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.
MaxPlatformVersion as in the manifest
MinOSVersion as in the manifest
MaxOSVersionTested as in the manifest
MoreInfo as in the manifest
What ever framework identities we found in the manifest.
The frameworkIdentity for the sdk, this may be a single name or a | delimited name
PlatformIdentity if it exists in the appx manifest for this sdk.
Whatever appx locations we found in the manifest
The appxlocation for the sdk can be a single name or a | delimited list
Set the location where the reference was resolved.
Override object equals to use the equals implementation in this object.
Override get hash code
Are two SDKReference items Equal
Add a resolution error or warning to the reference
Add a resolution warning to the reference
Get a piece of metadata off an item and make sureit is trimmed
After resolving a reference we need to check to see if there is a SDKManifest file in the root directory and if there is we need to extract the frameworkidentity.
We ignore other attributes to leave room for expansion of the file format.
Parse the multipleversions string and set supportsMultipleVersions if it can be parsed correctly.
Create a resolved output item which contains the path to the SDK and the associated metadata about it.
Check to see if an FrameworkIdentity is in the list of framework identities found in the SDKManifest.
Keep track of messages which are status information about resolving this reference. We want to print it out in a nicer format at the end of resolution.
This task determines if this project requires VS2008 SP1 assembly.
Is this file's IncludeHash set to false?
Is this file System.Data.Entity.dll?
Is this file Client Sentinel Assembly?
A set of default namespaces to add so that user does not have to include them. Make sure that these are covered
by the list of .
A set of default references to add so that the user does not have to include them.
The name of a subdirectory that contains reference assemblies.
A cache of objects and their corresponding compiled assembly. This cache ensures that two of the exact same code task
declarations are not compiled multiple times.
Stores the path to the directory that this assembly is located in.
Stores an instance of a for logging messages.
Stores functions that were added to the current app domain. Should be removed once we're finished.
Stores the parameters parsed in the <UsingTask />.
Stores the task name parsed in the <UsingTask />.
Gets the of the compiled task.
Gets the full source code by applying an appropriate template based on the current .
Parses and validates the body of the <UsingTask />.
A used to log events during parsing.
The name of the task.
The raw inner XML string of the <UsingTask />> to parse and validate.
An containing parameters for the task.
A object that receives the details of the parsed task.
true if the task body was successfully parsed, otherwise false.
The will look like this:
// Source code
]]>
Attempts to resolve assembly references that were specified by the user.
A used for logging.
A object containing details about the task.
Receives the list of full paths to resolved assemblies.
true if all assemblies could be resolved, otherwise false.
The user can specify a short name like My.Assembly or My.Assembly.dll. In this case we'll
attempt to look it up in the directory containing our reference assemblies. They can also specify a
full path and we'll do no resolution. At this time, these are the only two resolution mechanisms.
Perhaps in the future this could be more powerful by using NuGet to resolve assemblies but we think
that is too complicated for a simple in-line task. If users have more complex requirements, they
can compile their own task library.
Attempts to compile the current source code and load the assembly into memory.
An to use give to the compiler task so that messages can be logged.
A object containing details about the task.
The if the source code be compiled and loaded, otherwise null.
true if the source code could be compiled and loaded, otherwise null.
Represents the kind of code contained in the code task definition.
The code is a fragment and should be included within a method.
The code is a method and should be included within a class.
The code is a whole class and no modifications should be made to it.
Gets or sets the code language of the task.
Gets or sets the of the task.
Gets or sets the name of the task.
Gets a of namespaces to use.
Gets an of assembly references.
Gets or sets the source code of the assembly.
This class will provide the ability for classes given an SdkToolsPath and their tool name to find that tool.
The tool will be looked for either under the SDKToolPath passed into the task or as fallback to look for the toolname using the toolslocation helper.
Cache the file exists delegate which will determine if a file exists or not but will not eat the CAS exceptions.
Provide a delegate which will do the correct file exists.
This method will take a sdkToolsPath and a toolName and return the path to the tool if it is found and exists.
First the method will try and find the tool under the sdkToolsPath taking into account the current processor architecture
If the tool could not be found the method will try and find the tool under the sdkToolsPath (which should point to the x86 sdk directory).
Finally if the method has not found the tool yet it will fallback and use the toolslocation helper method to try and find the tool.
Path including the toolName of the tool if found, null if it is not found
This method will take the toolName and use the Legacy ToolLocation helper methods to try and find the tool.
This is a last ditch effort to find the tool when we cannot find it using the passed in SDKToolsPath (in either the x86 or processor specific directories).
Name of the tool to find the sdk path for
A path to the tool or null if the path does not exist.
Provide a method which can be used with a delegate to provide a specific FileExists behavior.
Use FileInfo instead of FileSystems.Default.FileExists(...) because the latter fails silently (by design) if CAS
doesn't grant access. We want the security exception if there is going to be one.
True if the file exists. False if it does not
An interface containing public SGen task properties to make sure that all versions of the task have the same public surface.
Gets or Sets the Compiler Platform used by SGen to generate the output assembly.
Gets or Sets a list of specific Types to generate serialization code for, SGen will generate serialization code only for those types.
Genererates a serialization assembly containing XML serializers for the input assembly.
Gets or Sets the Compiler Platform used by SGen to generate the output assembly.
Gets or Sets a list of specific Types to generate serialization code for, SGen will generate serialization code only for those types.
The name of the tool to execute.
The full path of the tool to execute.
Validate parameters, log errors and warnings and return true if Execute should proceed.
Returns true if task execution is not necessary. Executed after ValidateParameters
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
This task signs the passed in file using the Authenticode cert
provided and optionally uses a timestamp if a URL is provided.
It can sign ClickOnce manifests as well as exe's.
Constructs a new sys description.
description text.
Retrieves the description text.
description
AutoGenerated resource class. Usage:
string s = SR.GetString(SR.MyIdenfitier);
The containing assembly is set to lookup resources for the neutral language in satellite assemblies, not in the main assembly.
System.Design resources are not meant to be translated, so the ResourceManager should not look for satellite assemblies.
This ResourceManager forces resource lookup to be constrained to the current assembly and not look for satellites.
A small intermediate class for MSBuild tasks, see also TaskLoadInSeparateAppDomainExtension
Gets an instance of a TaskLoggingHelperExtension class containing task logging methods.
The logging helper object.
Task that logs telemetry.
Gets or sets a semi-colon delimited list of equal-sign separated key/value pairs. An example would be "Property1=Value1;Property2=Value2".
Gets or sets the event name.
Main task method
A small intermediate class between ToolTask and classes using it in XMakeTasks, implementing functionality
that we didn't want to expose in Utilities
This class has to be public because the tasks that derive from it are public.
Ideally we would like this class to be internal, but C# does not allow a base class
to be less accessible than its derived classes.
Default constructor.
Gets an instance of a TaskLoggingHelperExtension class containing task logging methods.
The logging helper object.
Whether this ToolTaskExtension has logged any errors
Gets the collection of parameters used by the derived task class.
Parameter bag.
When set to true, the response file will use new lines instead of spaces to separate arguments.
Get a bool parameter and return a default if its not present
in the hash table.
Get an int parameter and return a default if its not present
in the hash table.
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
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
Fills the provided CommandLineBuilderExtension with those switches and other information that can go into a response file.
Fills the provided CommandLineBuilderExtension with those switches and other information that can't go into a response file and
must go directly onto the command line.
true, if successful
This class defines the touch task.
Forces a touch even if the file to be touched is read-only.
Creates the file if it doesn't exist.
Specifies a specific time other than current.
File(s) to touch.
Output of this task - which files were touched.
Importance: high, normal, low (default normal)
Question the incremental nature of this task.
When Question is true, skip touching the disk to avoid causing incremental issue.
Unless the file doesn't exists, in which case, error out.
Implementation of the execute method.
Run the task
Helper method creates a file.
"true" if the file was created.
Helper method touches a file.
"True" if the file was touched.
Represents a task that can extract a .zip archive.
Stores a used for cancellation.
Stores the include patterns after parsing.
Stores the exclude patterns after parsing.
Gets or sets a with a destination folder path to unzip the files to.
Gets or sets a value that indicates whether read-only files should be overwritten.
Gets or sets a value that indicates whether files should be skipped if the destination is unchanged.
Gets or sets an array of objects containing the paths to .zip archive files to unzip.
Gets or sets an MSBuild glob expression that specifies which files to include being unzipped from the archive.
Gets or sets an MSBuild glob expression that specifies which files to exclude from being unzipped from the archive.
Extracts all files to the specified directory.
The containing the files to extract.
The to extract files to.
Determines whether or not a file should be skipped when unzipping by filtering.
The object containing information about the file in the zip archive.
true if the file should be skipped, otherwise false.
Determines whether or not a file should be skipped when unzipping.
The object containing information about the file in the zip archive.
A object containing information about the destination file.
true if the file should be skipped, otherwise false.
Specific-purpose utility functions for parsing VB.
Parse a VB file and get the first class name, fully qualified with namespace.
Extract the class name.
Task that simply emits a warning. Engine will add the project path because
we do not specify a filename.
Error message
Warning code
Relevant file if any.
If none is provided, the file containing the Warning
task will be used.
Warning help keyword
A link pointing to more information about the warning
Main task method
A task that transforms a XML input with an XSLT or Compiled XSLT
and outputs to screen or specified file.
The output files.
The XML input as file path.
The XML input as string.
The XSLT input as file path.
The XSLT input as string.
Flag to preserve whitespaces in the XSLT file.
The XSLT input as compiled dll.
The output file.
The parameters to XSLT Input document.
Determines whether or not to use trusted settings. Default is false.
Executes the XslTransform task.
true if transformation succeeds.
Takes the raw XML and loads XsltArgumentList
The raw XML that holds each parameter as
XsltArgumentList.
This class prepares XML input from XmlFile and Xml parameters
This either contains the raw Xml or the path to Xml file.
Constructor.
Only one parameter should be non null or will throw ArgumentException.
The path to XML file or null.
The raw XML.
Possible accepted types of XML input.
If the mode is a XML file.
If the mode is a raw XML.
Returns the count of Xml Inputs
Returns the current mode of the XmlInput
Creates correct reader based on the input type.
The XmlReader object
This class prepares XSLT input from XsltFile, Xslt and XsltCompiledDll parameters
What XSLT input type are we at.
Contains the raw XSLT
or the path to XSLT file
or the path to compiled XSLT dll.
Flag to preserve whitespaces in the XSLT file.
Tool for logging build messages, warnings, and errors
Constructer.
Only one parameter should be non null or will throw ArgumentException.
The path to XSLT file or null.
The raw to XSLT or null.
The path to compiled XSLT file or null.
Log helper.
Flag for xslt whitespace option.
Possible accepted types of XSLT input.
If the mode is a XSLT file.
If the mode is a raw XSLT.
If the mode is a compiled Xslt dll.
Loads the XSLT to XslCompiledTransform. By default uses Default settings instead of trusted settings.
A XslCompiledTransform object.
Loads the XSLT to XslCompiledTransform. By default uses Default settings instead of trusted settings.
Determines whether or not to use trusted settings.
A XslCompiledTransform object.
Find the type from an assembly and loads it.
The path to assembly.
The type name.
Found type.
Class: AssignCulture
This task takes a list of resource file names and sets an attribute that
contains the culture name embedded in the file name:
MyResources.fr.resx ==> Culture='fr'
The task can also return a list of "Culture-neutral" file names, like:
MyGlyph.fr.bmp ==> MyGlyph.bmp [Culture='fr']
This is because embedded resources are referred to this way.
There are plenty of corner cases with this task. See the unit test for
more details.
The incoming list of files to assign a culture to.
This outgoing list of files is exactly the same as the incoming Files
list except that an attribute name "Culture" will have been added if
the particular file name is in the form:
MyResource.<any-valid-culture-id>.resx
The value of Culture will be "<any-valid-culture-id>".
If the incoming item from Files already has a Culture attribute then
that original attribute is used instead.
This is a subset of AssignedFiles that has all of the items that
ended up have a Culture assigned to them. This includes items that
already had a Culture in the incoming Files list as well as items
that were assigned a Culture because they had a valid culture ID
embedded in their file name.
The following is always true:
AssignedFiles = AssignedFilesWithCulture + AssignedFilesWithNoCulture
This is a subset of AssignedFiles that has all of the items that
ended up with no Culture assigned to them.
The following is always true:
AssignedFiles = AssignedFilesWithCulture + AssignedFilesWithNoCulture
This list has the same number of items as the Files list or the
AssignedFiles list.
Items in this list have the file name from Files or AssignedFiles
but with the culture stripped if it was embedded in the file name.
So for example, if the incoming item in Files was:
MyBitmap.fr.bmp
then the corresponding file in CultureNeutralAssignedFiles will be:
MyBitmap.bmp
The culture will only be stripped if it is a valid culture identifier.
So for example,
MyDifferentFile.XX.txt
will result in exactly the same file name:
MyDifferentFile.XX.txt
because 'XX' is not a valid culture identifier.
Execute.
Utility functions for dealing with Culture information.
Culture information about an item.
Given an item's filename, return information about the item including the culture and the culture-neutral filename.
We've decided to ignore explicit Culture attributes on items.
Provides read-only cached instances of .
Original source:
https://raw.githubusercontent.com/aspnet/Localization/dev/src/Microsoft.Framework.Globalization.CultureInfoCache/CultureInfoCache.cs
Determine if a culture string represents a valid instance.
The culture name.
True if the culture is determined to be valid.
Generates a temporary code file with the specified generated code fragment.
Does not delete the file.
Currently only supports writing .NET attributes.
Language of code to generate.
Language name can be any language for which a CodeDom provider is
available. For example, "C#", "VisualBasic".
Emitted file will have the default extension for that language.
Description of attributes to write.
Item include is the full type name of the attribute.
For example, "System.AssemblyVersionAttribute".
Each piece of metadata is the name-value pair of a parameter, which must be of type System.String.
Some attributes only allow positional constructor arguments, or the user may just prefer them.
To set those, use metadata names like "_Parameter1", "_Parameter2" etc.
If a parameter index is skipped, it's an error.
Destination folder for the generated code.
Typically the intermediate folder.
The path to the file that was generated.
If this is set, and a file name, the destination folder will be prepended.
If this is set, and is rooted, the destination folder will be ignored.
If this is not set, the destination folder will be used, an arbitrary file name will be used, and
the default extension for the language selected.
Main entry point.
Generates the code into a string.
If it fails, logs an error and returns null.
If no meaningful code is generated, returns empty string.
Returns the default language extension as an out parameter.
Finds the metadata items that are used to indicate the types of
parameters, and removes those items from the given dictionary.
Returns a dictionary that maps parameter names to their declared types.
Uses the given parameters to add CodeDom arguments to the given attribute.
Returns true if the arguments could be defined, or false if the values could
not be converted to the required type. An error is also logged for failures.
Finds the types that the parameters are likely to be, by finding a constructor
on the attribute that has the same number of parameters that have been provided.
Returns an array of types with a length equal to the number of positional parameters.
If no suitable constructor is found, the array will contain null types.
Attempts to convert the raw value provided in the metadata to the type with the specified name.
Returns true if conversion is successful. An error is logged and false is returned if the conversion fails.
Convert the raw value provided in the metadata to the type
that has been inferred based on the parameter position or name.
Returns the converted value as a CodeExpression if successful, or the raw value
as a CodeExpression if conversion fails. No errors are logged if the conversion fails.
Converts the given value to a CodeExpression object where the value is the specified type.
Returns the CodeExpression if successful, or throws an exception if the conversion fails.
A task that returns values as specified by XPath Query
from an XML file.
The XPath Query.
The XML input as a string.
The XPath Query.
The results returned by this task.
The namespaces for XPath query's prefixes.
Set to true to prohibit loading XML with embedded DTD and produce error MSB3733
if DTD is present. This was a pre-v15 behavior. By default, a DTD clause if any is ignored.
Executes the XMLPeek task.
true if transformation succeeds.
Loads the namespaces specified at Namespaces parameter to XmlNSManager.
The namespace manager to load namespaces to.
The namespaces as XML snippet.
This class prepares XML input from XMLInputPath and XMLContent parameters
This either contains the raw Xml or the path to Xml file.
FileStream used to read XML.
Constructor.
Only one parameter should be non null or will throw ArgumentException.
The path to XML file or null.
The raw XML.
Possible accepted types of XML input.
If the mode is a XML file.
If the mode is a raw XML.
Returns the current mode of the XmlInput
Creates correct reader based on the input type.
The XmlReader object
Closes the reader.
A task that sets values as specified by XPath Query
into a XML file.
The XML input as file path.
The XPath Query.
The value to be inserted into the specified location.
The namespaces for XPath query's prefixes.
Executes the XMLPoke task.
true if task execution succeeds.
Loads the namespaces specified at Namespaces parameter to XmlNSManager.
The namespace manager to load namespaces to.
The namespaces as XML snippet.
A task factory which can take code dom supported languages and create a task out of it
This dictionary keeps track of custom references to compiled assemblies. The in-memory assembly is loaded from a byte
stream and as such its dependencies cannot be found unless they are in the MSBuild.exe directory or the GAC. They
cannot be found even if they are already loaded in the AppDomain. This dictionary knows the FullName of the assembly
and a reference to the assembly itself. In the handler, the dictionary
is used to return the loaded assemblies as a way to allow custom references that are not in the normal assembly Load
context.
Handles the event to return assemblies loaded from custom references.
Default assemblies names to reference during inline code compilation - from the .NET Framework
Default using's for the code
A collection of task assemblies which have been instantiated by any CodeTaskFactory. Used to prevent us from creating
duplicate assemblies.
Merged set of assembly reference paths (default + specified)
Merged set of namespaces (default + specified)
Type of code fragment, ie Fragment, Class, Method
Is the type a fragment or not
Is the type a method or not
By default the language supported is C#, but anything that supports code dom will work
The source that will be compiled
The name of the task for which this is the factory
Path to source that is outside the project file
The using task node from the project file
The inline source compiled into an in memory assembly
Helper to assist in logging messages
Task parameter type information
MSBuild engine uses this for logging where the task comes from
Gets the type of the generated task.
Get the type information for all task parameters.
Initializes the task factory.
Create a taskfactory instance which contains the data that needs to be refreshed between task invocations.
Cleans up any context or state that may have been built up for a given task.
The task to clean up.
For many factories, this method is a no-op. But some factories may have built up
an AppDomain as part of an individual task instance, and this is their opportunity
to shutdown the AppDomain.
Create a property (with the corresponding private field) from the given type information
Create the Execute() method for the task from the fragment of code from the element
Create the body of the task's code by simply using the taskCode as a snippet for the CodeDom
Create a property (with the corresponding private field) from the given type information
Extract the elements from the
string[] of reference paths
Extract the elements from the
string[] of using's
Extract the node from the UsingTask node
textual content of the node
XmlNode
Make sure the task node only contains Code, Reference, Usings
If a parent node has a child node and it is not supposed to, log an error indicating it has an invalid element.
Add a reference assembly to the list of references passed to the compiler. We will try and load the assembly to make sure it is found
before sending it to the compiler. The reason we load here is that we will be using it in this appdomin anyways as soon as we are going to compile, which should be right away.
Compile the assembly in memory and get a reference to the assembly itself.
If compilation fails, returns null.
Combine our default referenced assemblies with those explicitly specified
Combine our default imported namespaces with those explicitly specified
Create the task properties
Create the task class
Class used as a key for the compiled assembly cache
The set of assemblies referenced by this task.
The complete source code for the task.
Constructor
Override of GetHashCode
Override of Equals
Implementation of Equals.
Implementation of CompareTo
The task factory provider for XAML tasks.
The namespace we put the task in.
The compiled task assembly.
The task type.
The name of the task pulled from the XAML.
The namespace of the task pulled from the XAML.
The contents of the UsingTask body.
The name of this factory. This factory name will be used in error messages. For example
Task "Mytask" failed to load from "FactoryName".
The task type object.
MSBuild engine will call this to initialize the factory. This should initialize the factory enough so that the factory can be asked
whether or not task names can be created by the factory.
Create an instance of the task to be used.
The task factory logging host will log messages in the context of the task.
Cleans up any context or state that may have been built up for a given task.
The task to clean up.
For many factories, this method is a no-op. But some factories may have built up
an AppDomain as part of an individual task instance, and this is their opportunity
to shutdown the AppDomain.
Get a list of parameters for the task.
Base class for task state files.
True if should create the state file and serialize ourselves, false otherwise.
Writes the contents of this object out to the specified file.
Reads the specified file from disk into a StateFileBase derived object.
Deletes the state file from disk
Class is used to cache system state.
Cache at the SystemState instance level. Has the same contents as .
It acts as a flag to enforce that an entry has been checked for staleness only once.
Cache at the SystemState instance level.
Before starting execution, RAR attempts to populate this field by deserializing a per-project cache file. During execution,
objects that get actually used are inserted into .
After execution, is serialized and written to disk if it's different from
what we originally deserialized into this field.
Cache at the SystemState instance level. It is serialized to disk and reused between instances via .
LastModified information is purely instance-local. It doesn't make sense to
cache this for long periods of time since there's no way (without actually
calling File.GetLastWriteTimeUtc) to tell whether the cache is out-of-date.
DirectoryExists information is purely instance-local. It doesn't make sense to
cache this for long periods of time since there's no way (without actually
calling Directory.Exists) to tell whether the cache is out-of-date.
GetDirectories information is also purely instance-local. This information
is only considered good for the lifetime of the task (or whatever) that owns
this instance.
Additional level of caching kept at the process level.
XML tables of installed assemblies.
True if the contents have changed.
Delegate used internally.
Cached delegate.
Cached delegate.
Cached delegate.
Cached delegate.
Cached delegate
Class that holds the current file state.
The last modified time for this file.
The fusion name of this file.
The assemblies that this file depends on.
The scatter files associated with this assembly.
FrameworkName the file was built against
The CLR runtime version for the assembly.
Default construct.
Ctor for translator deserialization
Reads/writes this class
Gets the last modified date.
Get or set the assemblyName.
Get or set the runtimeVersion
Get or set the framework name the file was built against
The last-modified value to use for immutable framework files which we don't do I/O on.
It is wasteful to persist entries for immutable framework files.
Construct.
Set the target framework paths.
This is used to optimize IO in the case of files requested from one
of the FX folders.
List of Assembly Table Info.
Reads/writes this class.
Used for serialization and deserialization of this class persistent cache.
Flag that indicates that has been modified.
Set the GetLastWriteTime delegate.
Delegate used to get the last write time.
Cache the results of a GetAssemblyName delegate.
The delegate.
Cached version of the delegate.
Cache the results of a GetAssemblyMetadata delegate.
The delegate.
Cached version of the delegate.
Cache the results of a FileExists delegate.
Cached version of the delegate.
Cache the results of a GetDirectories delegate.
The delegate.
Cached version of the delegate.
Cache the results of a GetAssemblyRuntimeVersion delegate.
The delegate.
Cached version of the delegate.
Cached implementation of GetAssemblyName.
The path to the file
The assembly name.
Cached implementation. Given a path, crack it open and retrieve runtimeversion for the assembly.
Path to the assembly.
Cached implementation. Given an assembly name, crack it open and retrieve the list of dependent
assemblies and the list of scatter files.
Path to the assembly.
Cache for pre-extracted assembly metadata.
Receives the list of dependencies.
Receives the list of associated scatter files.
Reads in cached data from stateFiles to build an initial cache. Avoids logging warnings or errors.
List of locations of caches on disk.
How to log
Whether a file exists
A cache representing key aspects of file states.
Modifies this object to be more portable across machines, then writes it to filePath.
Path to which to write the precomputed cache
How to log
Cached implementation of GetDirectories.
The list of directories from the specified path.
Cached implementation of FileExists.
Path to file.
True if the file exists.
Cached implementation of DirectoryExists.
Path to file.
True if the directory exists.
Represents a single input to a compilation-style task.
Keeps track of timestamp for later comparison.
Must be serializable because instances may be marshaled cross-AppDomain, see .
The name of the file.
The last-modified timestamp when the class was instantiated.
Returns true if the file existed when this class was instantiated.
Construct.
The file name.
Checks whether the file has changed since the last time a timestamp was recorded.
Gets or sets a containing the full path to the destination file to create.
Gets or sets a value indicating if the destination file should be overwritten.
Gets or sets a containing the full path to the source directory to create a zip archive from.
Question the incremental nature of this task.
This task does not support incremental build and will error out instead.
This class defines the "AL" XMake task, which enables using al.exe to link
modules and resource files into assemblies.
Return the name of the tool to execute.
Return the path of the tool to execute
Fills the provided CommandLineBuilderExtension with those switches and other information that can go into a response file.
The AspNetCompiler task, which is a wrapper around aspnet_compiler.exe
If specified, the strong-name assembly will allow partially
trusted callers.
If specified, the assemblly is not fully signed when created.
If specified, the compiled assemblies will be given fixed names.
Specifies a strong name key container.
The physical path to the strong name key file.
The full IIS metabase path of the application. This switch
cannot be combined with the virtualPath or PhysicalDir option.
The physical path of the application to be compiled. If physicalDir
is missing, the IIS metabase is used to locate the application.
The physical path to which the application is compiled. If not
specified, the application is precompiled in-place.
The virtual path of the application to be compiled. If PhysicalDir is
used to locate the application is specified. Otherwise, the IIS metabase
is used, and the application is assumed to be in the default site (under
"/LM/W3SVC/1/Root").
If Updateable is true, then the web is compile with -u flag so that it
can be updated after compilation
If Force is true, then the web is compile with -f flag overwriting
files in the target location
If Debug is true, then the debug information will be emitted during
compilation.
If Clean is true, then the application will be built clean. Previously
compiled components will be re-compiled.
The TargetFrameworkMoniker indicating which .NET Framework version of
aspnet_compiler.exe should be used. Only accepts .NET Framework monikers.
The name of the tool to execute
Small helper property to get the "project name"
Small helper property for determining the "name of the target" that's currently being built
Override the Execute method to be able to send ExternalProjectStarted/Finished events.
Generates command line arguments for aspnet_compiler.exe
command line builder class to add arguments to
Determine the path to aspnet_compiler.exe
path to aspnet_compiler.exe, null if not found
Validate the task arguments, log any warnings/errors
true if arguments are corrent enough to continue processing, false otherwise
Generates a bootstrapper for ClickOnce deployment projects.
Generate the bootstrapper.
Return true on success, false on failure.
This task generates the application trust from the base manifest
and the TargetZone and ExcludedPermissions properties.
Returns paths to the frameworks SDK.
The path to the latest .NET SDK if it could be found. It will be String.Empty if the SDK was not found.
The path to the v2.0 .NET SDK if it could be found. It will be String.Empty if the SDK was not found.
The path to the v3.5 .NET SDK if it could be found. It will be String.Empty if the SDK was not found.
The path to the v4.0 .NET SDK if it could be found. It will be String.Empty if the SDK was not found.
The path to the v4.5 .NET SDK if it could be found. It will be String.Empty if the SDK was not found.
The path to the v4.5.1 .NET SDK if it could be found. It will be String.Empty if the SDK was not found.
The path to the v4.6 .NET SDK if it could be found. It will be String.Empty if the SDK was not found.
The path to the v4.6.1 .NET SDK if it could be found. It will be String.Empty if the SDK was not found.
Get the SDK.
true
Registers a managed assembly for COM interop (equivalent of regasm.exe functionality, but this code doesn't actually call the exe).
ITypeLibExporterNotifySink is necessary for the ITypeLibConverter.ConvertAssemblyToTypeLib call.
The cache file for Register/UnregisterAssembly. Necessary for UnregisterAssembly to do the proper clean up.
Task entry point
Callback method for reporting type library export events
Callback method for finding type libraries for given assemblies. If we are here, it means
the type library we're looking for is not in the current directory and it's not registered.
Currently we assume that all dependent type libs are already registered.
In theory, we could automatically register dependent assemblies for COM interop and return
a newly created typelib here. However, one danger of such approach is the following scenario:
The user creates several projects registered for COM interop, all of them referencing assembly A.
The first project that happens to be built will register assembly A for COM interop, creating
a type library in its output directory and registering it. The other projects will then refer to that
type library, since it's already registered. If then for some reason the first project is deleted
from disk, the typelib for assembly A goes away too, and all the other projects, built five years ago,
suddenly stop working.
Helper registration method
Helper method - exports a type library for an assembly. Returns true if succeeded.
COM references specified by guid/version/lcid
COM references specified by type library file path
Array of equals-separated pairs of environment
variables that should be passed to the spawned tlbimp.exe and aximp.exe,
in addition to (or selectively overriding) the regular environment block.
the directory wrapper files get generated into
When set to true, the typelib version will be included in the wrapper name. Default is false.
source of resolved .NET assemblies - we need this for ActiveX wrappers, since we can't resolve .NET assembly
references ourselves
container name for public/private keys
file containing public/private keys
delay sign wrappers?
Passes the TypeLibImporterFlags.PreventClassMembers flag to tlb wrapper generation
If true, do not log messages or warnings. Default is false.
The preferred target processor architecture. Passed to tlbimp.exe /machine flag after translation.
Should be a member of Microsoft.Build.Utilities.ProcessorArchitecture.
Property to allow multitargeting of ResolveComReferences: If true, tlbimp.exe
from the appropriate target framework will be run out-of-proc to generate
the necessary wrapper assemblies. Aximp is always run out of proc.
paths to found/generated reference wrappers
paths to found modules (needed for isolation)
If ExecuteAsTool is true, this must be set to the SDK
tools path for the framework version being targeted.
Cache file for COM component timestamps. If not present, every run will regenerate all the wrappers.
The project target framework version.
Default is empty. which means there will be no filtering for the reference based on their target framework.
Main class for the COM reference resolution task
Main class for the COM reference resolution task
Main class for the COM reference resolution task
version 4.0
Task entry point.
Converts the string target framework value to a number.
Accepts both "v" prefixed and no "v" prefixed formats
if format is bad will log a message and return 0.
Target framework version value
Computes the path to TlbImp.exe for use in logging and for passing to the
nested TlbImp task.
True if the path is found (or it doesn't matter because we're executing in memory), false otherwise
Computes the path to AxImp.exe for use in logging and for passing to the
nested AxImp task.
True if the path is found, false otherwise
Try to get the path to the tool in the Windows SDK with the given .NET Framework version and
of the same architecture as we were currently given for TargetProcessorArchitecture.
Clean various caches and other state that should not be preserved between subsequent runs
Every ActiveX reference (aximp) requires a corresponding tlbimp reference. If the tlbimp reference is
missing from the project file we pretend it's there to save the user some useless typing.
Resolves the COM reference, and adds it to the appropriate item list.
Helper function - resolves a PIA COM classic reference given the type library attributes.
Information about the reference to be resolved
Name of reference
Information about wrapper locations
True if the reference was already found or successfully generated, false otherwise.
Return the set of item specs for the resolved assembly references.
Helper function - resolves a regular tlb COM classic reference given the type library attributes.
Information about the reference to be resolved
Directory the interop DLL should be written to
Name of reference
True if this is a top-level reference
List of dependency paths for that reference
Information about wrapper locations
True if the reference was already found or successfully generated, false otherwise.
Helper function - resolves an ActiveX reference given the type library attributes.
Information about the reference to be resolved
Directory the interop DLL should be written to
Name of reference
Information about wrapper locations
True if the reference was already found or successfully generated, false otherwise.
Set the CopyLocal metadata to false on all assemblies that are located in the GAC.
List of ITaskItems that will be outputted from the task
The GAC root path
Scan all the dependencies of the main project references and preresolve them
so that when we get asked about a previously unknown dependency in the form of a .NET assembly
we know what to do with it.
Defines the "AxImp" MSBuild task, which enables using AxImp.exe
to generate Windows Forms wrappers for ActiveX controls.
.ocx File the ActiveX controls being wrapped are defined in.
If true, will generate C# source code for the Windows Forms wrapper.
If true, suppresses displaying the logo
File name of assembly to be produced.
Name of assembly to use as a RuntimeCallableWrapper instead of generating one.
If true, prevents AxImp from displaying success message.
If true, AxImp prints more information.
Returns the name of the tool to execute
Fills the provided CommandLineBuilderExtension with all the command line options used when
executing this tool
Gets filled with command line commands
Validates the parameters passed to the task
True if parameters are valid
Passed to the "Transform" property on the TlbImp task to indicate
what transforms, if any, to apply to the type library during
assembly generation
No transforms should be applied.
Transforms [out, retval] parameters of methods on dispatch-only
interfaces into return values.
Mark all value classes as serializable.
Defines the "TlbImp" MSBuild task, which enables using TlbImp.exe
to generate assemblies from type libraries.
Type library being imported to an assembly.
Namespace of the generated assembly
Version of the generated assembly
Create an assembly for the specified machine type
Supported machine types:
X86
X64
Itanium
Agnostic
If true, suppresses displaying the logo
File name of assembly to be produced.
If true, prevents TlbImp from adding members to classes
If true, import the SAFEARRAY type as System.Arrays
If true, prevents AxImp from displaying success message.
Transformation to be applied to the resulting assembly.
If true, AxImp prints more information.
References to dependency assemblies.
Returns the name of the tool to execute
Fills the provided CommandLineBuilderExtension with all the command line options used when
executing this tool
Gets filled with command line commands
Validates the parameters passed to the task
True if parameters are valid
Returns the TlbImpTransformFlags value stored in the hashtable under the provided
parameter, or the default value passed if the value in the hashtable is null
The parameter used to retrieve the value from the hashtable
The default value to return if the hashtable value is null
The value contained in the hashtable, or if that's null, the default value passed to the method
Verifies that an allowed combination of TlbImpTransformFlags has been
passed to the Transform property.
True if Transform is valid and false otherwise
Converts a given flag to the equivalent parameter passed to the /transform:
option of tlbimp.exe
The TlbImpTransformFlags being converted
A string that can be passed to /transform: on the command line
Main class for the native reference resolution task.
ResolveNativeReference constructor
Task entry point.
Helper manifest resolution method. Cracks the manifest and extracts the different elements from it.
Registers a managed assembly for COM interop (equivalent of regasm.exe functionality, but this code
doesn't actually call the exe).
The cache file for Register/UnregisterAssembly. Necessary for UnregisterAssembly to do the proper clean up.
Task entry point
Helper unregistration method
Updates selected properties in a manifest and resigns.
Exports a managed assembly to a windows runtime metadata.
Set of references to pass to the winmdexp tool.
Warning codes to disable
Input documentation file
Output documentation file
Input PDB file
Output PDB file
WinMDModule to generate the WinMDFile for.
Output windows metadata file .winmd
Path to the SDK directory which contains this tool
Use output stream encoding as UTF-8.
Path to the SDK directory which contains this tool
The policy used for assembly unification.
The name of the tool to execute.
Overridable property specifying the encoding of the captured task standard output stream
Overridable property specifying the encoding of the captured task standard error stream
The full path of the tool to execute.
Validate parameters, log errors and warnings and return true if Execute should proceed.
Returns true if task execution is not necessary. Executed after ValidateParameters
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.
Gets an instance of a TaskLoggingHelperExtension class containing task logging methods.
The logging helper object.
Resolve searchpath type {GAC}
Delegate to get the assembly path in the GAC
Construct.
Like x86 or IA64\AMD64, the processor architecture being targeted.
The search path element.
Delegate to get the assembly name object.
Delegate to check if the file exists.
Delegate to get the runtime version.
The targeted runtime version.
Delegate to get assembly path in the GAC.
Methods for dealing with the GAC.
Default delegate to get the path based on a fusion name.
Default delegate to get the gac enumerator.
Lazy loaded cached root path of the GAC.
Gets the root path of the GAC.
Given a strong name, find its path in the GAC.
The assembly name.
Like x86 or IA64\AMD64.
Delegate to get the clr version of the file.
Version of the targetted runtime.
Delegate to check whether the file exists.
Delegate to get path to a file based on the fusion name.
Delegate to get the enumerator which will enumerate over the GAC.
Whether to check for a specific version.
The path to the assembly. Empty if none exists.
Given a strong name generate the gac enumerator.
Enumerate the gac and generate a list of assemblies which match the strongname by runtime.
Given a fusion name get the path to the assembly on disk.
If we know we have a full fusion name we can skip enumerating the gac and just query for the path. This will
not check the runtime version of the assembly.
Given a strong name, find its path in the GAC.
The strong name.
Like x86 or IA64\AMD64.
Delegate to get the runtime version from a file path
What version of the runtime are we targeting
Are we guaranteed to have a full fusion name. This really can only happen if we have already resolved the assembly
Delegate to check whether the file exists.
Delegate to get path to a file based on the fusion name.
Delegate to get the enumerator which will enumerate over the GAC.
Whether to check for a specific version.
The path to the assembly. Empty if none exists.
Given a strong name, find its path in the GAC.
The build engine
The strong name.
Like x86 or IA64\AMD64.
Delegate to get the runtime version from a file path
What version of the runtime are we targeting
Are we guranteed to have a full fusion name. This really can only happen if we have already resolved the assembly
Delegate to check whether the file exists.
Delegate to get path to a file based on the fusion name.
Delegate to get the enumerator which will enumerate over the GAC.
Whether to check for a specific version.
The path to the assembly. Empty if none exists.
Return the root path of the GAC.
This class is a caching mechanism for the Register/UnregisterAssembly task to keep track of registered assemblies to clean up
The list of registered assembly files.
The list of registered type library files.
The number of entries in the state file
Sets the entry with the specified index
Gets the entry with the specified index
internal constructor
task logger instance used for logging
true if this task should log only errors, no warnings or messages; false otherwise
callback interface for resolving dependent COM refs/NET assemblies
cached reference information (typelib pointer, original task item, typelib name etc.)
reference name (for better logging experience)
directory we should write the wrapper to
delay sign wrappers?
file containing public/private keys
container name for public/private keys
True if the interop name should include the typelib's version
Path to the SDK tools directory where aximp.exe can be found
BuildEngine of parent task; needed for logging purposes when generating wrapper out-of-proc
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.
Constructs the wrapper file name from a type library name.
Generates a wrapper for this reference.
Common abstract base for aximp and tlbimp COM reference wrapper classes.
They share the resolution method and only differ in constructing the wrapper file name.
internal constructor
task logger instance used for logging
true if this task should log only errors, no warnings or messages; false otherwise
callback interface for resolving dependent COM refs/NET assemblies
cached reference information (typelib pointer, original task item, typelib name etc.)
reference name (for better logging experience)
directory we should write the wrapper to
delay sign wrappers?
file containing public/private keys
container name for public/private keys
True if the interop name should include the typelib's version
True if GenerateWrapper() should generate the wrapper out-of-proc using aximp.exe or tlbimp.exe
Path to the SDK tools directory where aximp.exe or tlbimp.exe can be found
BuildEngine of parent task; needed for logging purposes when generating wrapper out-of-proc
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.
directory we should write the wrapper to
callback interface for resolving dependent COM refs/NET assemblies
container name for public/private keys
file containing public/private keys
True if generated wrappers should be delay signed
Property to allow multitargeting of ResolveComReferences: If true, tlbimp.exe and
aximp.exe from the appropriate target framework will be run out-of-proc to generate
the necessary wrapper assemblies.
The BuildEngine of the ResolveComReference instance that created this instance
of the class: necessary for passing to the AxImp or TlbImp task that is spawned
when ExecuteAsTool is set to true
Environment variables to pass to the tool.
If ExecuteAsTool is true, this must be set to the SDK
tools path for the framework version being targeted.
When true, we include the typelib version number in the name.
Checks if there's a preexisting wrapper for this reference.
Checks if the existing wrapper is up to date.
Constructs the wrapper file path.
Helper method for constructing wrapper file name.
Constructs the wrapper file name from a type library name. Specialized wrappers must override it if
they want to use the Resolve method from this class.
Static version of GetWrapperFileName for use when calling from the outside.
This version need only be used if the interop DLL needs to include the typelib version in the name
Default implementation
XXX, when the interop DLL is of the form XXX.typeLibName.[Y.Z.]dll
The typelib to generate the wrapper name for
True if the interop name should include the typelib's version
Major version number to append to the interop DLL's name
Minor version number to append to the interop DLL's name
Given our KeyFile, KeyContainer, and DelaySign parameters, generate the public / private
key pair and validate that it exists to the extent needed.
Compare the strong name signing state of the existing wrapper to the signing
state we are requesting in this run of the task. Return true if they match (e.g.
from a signing perspective, the wrapper is up-to-date) or false otherwise.
ToolTask that contains shared functionality between the AxImp and TlbImp tasks.
True if the keyfile only contains the public key data, and thus
we should pass the file using the /publickey: parameter instead of
/keyfile.
Force strong name delay signing. Used with KeyFile or KeyContainer.
Key container containing strong name key pair.
File containing strong name key pair.
Path to the SDK directory where AxImp.exe and TlbImp.exe can be found
Returns the name of the tool to execute. AxTlbBaseTask is not
executable, so return null for the ToolName -- And make sure that
Execute() logs an error!
Invokes the ToolTask with the given parameters
True if the task succeeded, false otherwise
Adds commands for the tool being executed, that cannot be put in a response file.
The CommandLineBuilderExtension to add the commands to
Generates the full path to the tool being executed by this ToolTask
A string containing the full path of this tool, or null if the tool was not found
Validates the parameters passed to the task
True if parameters are valid
Adds options involving strong name signing -- syntax is the same between
AxImp and TlbImp
The command line to add options to
Validates the parameters passed to the task that involve strong name signing --
DelaySign, KeyContainer, and KeyFile
true if the parameters are valid, false otherwise.
Resolves metadata for the specified set of assemblies.
Assembly paths.
Set of resolved assembly metadata.
Execute the task.
List of assembly paths.
Gets a list of resolved assembly metadata.
Creates a TaskItem and populates it with the given assembly attributes.
COM type library dependency walker class
List of exceptions thrown by the components during scanning
Internal constructor
The main entry point to the dependency walker
type library to be analyzed
Analyze the given type looking for dependencies on other type libraries
Returns true if we don't need to analyze this particular type.
For a given type, analyze recursively all the types implemented by it.
For a given type, analyze all the variables defined by it
For a given type, analyze all the functions implemented by it. That means all the argument and return types.
Analyze the given element (i.e. composite type of an argument) recursively
Get all the dependencies of the processed libraries
FOR UNIT-TESTING ONLY
Returns a list of the analyzed type names
Clear the dependency list so we can read dependencies incrementally but still have the advantage of
not scanning previously seen types
Clear the analyzed type cache. This is necessary if we have to resolve dependencies that are also
COM references in the project, or we may get an inaccurate view of what their dependencies are.
Abstract base class for COM reference wrappers providing common functionality.
This class hierarchy is used by the ResolveComReference task.Every class deriving from ComReference
provides functionality for wrapping Com type libraries in a given way(for example AxReference, or PiaReference).
Internal constructor
task logger instance used for logging
true if this task should log only errors, no warnings or messages; false otherwise
cached reference information (typelib pointer, original task item, typelib name etc.)
reference name (for better logging experience)
various data for this reference (type lib attrs, name, path, ITypeLib pointer etc)
item name as it appears in the project file
(used for logging purposes, we use the actual typelib name for interesting operations)
task used for logging messages
True if this class should only log errors, but no messages or warnings.
lazy-init property, returns true if ADO 2.7 is installed on the machine
Error message if Ado27 is not installed on the machine (usually something like "type lib not registered")
Only contains valid data if ADO 2.7 is not installed and Ado27Installed was called before
Given a TYPELIBATTR structure, generates a key that can be used in hashtables to identify it.
Compares two TYPELIBATTR structures
Helper method for retrieving type lib attributes for the given type lib
Helper method for retrieving type attributes for a given type info
Helper method for retrieving type attributes for a given type info
This method needs to also return the native pointer to be released when we're done with our VARDESC.
It's not really possible to copy everything to a managed struct and then release the ptr immediately
here, since VARDESCs contain other native pointers we may need to access.
Helper method for retrieving the function description structure for the given function index.
This method needs to also return the native pointer to be released when we're done with our FUNCDESC.
It's not really possible to copy everything to a managed struct and then release the ptr immediately
here, since FUNCDESCs contain other native pointers we may need to access.
Gets the name of given type library.
Gets the name of given type library.
Strips type library number from a type library path (for example, "ref.dll\2" becomes "ref.dll")
type library path with possible typelib number appended to it
Delegate to check whether the file exists
proper file path to the type library
Gets the type lib path for given type lib attributes(reused almost verbatim from vsdesigner utils code)
NOTE: If there's a typelib number at the end of the path, does NOT strip it.
Tries to remap an ADO type library to ADO 2.7. If the type library passed in is an older ADO tlb,
then remap it to ADO 2.7 if it's registered on the machine (!). Otherwise don't modify the typelib.
Returns true if the type library passed in was successfully remapped.
Finds an existing wrapper for the specified component
Internal class representing information about a COM reference.
ITypeLib pointer
type library attributes for the reference. Taken from the task item itself or type library if
reference is specified as file on disk.
type library name
path to the reference, with typelibrary number stripped, if any (so ref1.dll\2 becomes ref1.dll).
The full path is only used for loading the type library, and it's not necessary
to do it after the interface pointer is cached in this object.
When using TlbImp.exe, we need to make sure that we keep track of the non-stripped typelib path,
because that's what we need to pass to TlbImp.
reference to the original ITaskItem, if any
Path to the resolved reference.
The wrapper that resulted from resolving the COM reference.
List of the paths to COM wrapper assemblies that this reference is dependent upon.
Reference to the ITaskItem generated from the resolved reference, if any.
Default constructor
Construct a new ComReferenceInfo copying all state from the given ComReferenceInfo instance
Initialize the object with type library attributes
Initialize the object with a type library path
A unique id string of this reference, it's either the item spec or (in the case of a dependency ref)
guid and version from typelib attributes
Get the source item, if available. Null otherwise.
Release the COM ITypeLib pointer for this reference
Predefined XML attributes of a ComReference Item.
Internal exception thrown when there's an unrecoverable failure resolving a COM reference and we should
move on to the next one, if it makes sense.
Default constructor
Constructor that allows to preserve the original exception information
Deserializing constructor. It should not be necessary if everything goes well, but if it doesn't
then we don't want to crash when trying to deserialize the uncaught exception into another AppDomain.
Predefined typelib wrapper types.
returns true is refType equals tlbimp
returns true is refType equals aximp
returns true is refType equals pia
returns true if refType equals primaryortlbimp, which is basically an unknown reference type
Class containing info about wrapper location, used for caching.
Callback interface for COM references to resolve their dependencies
Resolves a COM classic reference given the type library attributes and the type of wrapper to use.
If wrapper type is not specified, this method will first look for an existing reference in the project,
fall back to looking for a PIA and finally try to generate a regular tlbimp wrapper.
This method is available for references to call back to resolve their dependencies
Resolves a .NET assembly reference using the list of resolved managed references supplied to the task.
This method is available for references to call back to resolve their dependencies
Resolves a COM wrapper assembly reference based on the COM references resolved so far. This method is necessary
for Ax wrappers only, so all necessary references will be resolved by then(since we resolve them in
the following order: pia, tlbimp, aximp)
This method is available for references to call back to resolve their dependencies
Create an RCW for the current context/apartment.
This improves performance of cross apartment calls as the CLR will only
cache marshalled pointers for an RCW created in the current context.
Type of the RCW object
The last RCW that was created for the current context.
Indicates if we created the RCW and therefore need to release it's com reference.
Constructor creates the new RCW in the current context.
The RCW created in the original context.
Finalizes an instance of the class.
Call this helper if your managed object is really an RCW to a COM object
and that COM object was created in a different apartment from where it is being accessed
A new RCW created in the current apartment context
Override for IDisposable::Dispose
We created an RCW for the current apartment. When this object goes out of scope
we need to release the COM object before the apartment is released (via COUninitialize)
Cleanup our RCW com object references if required.
COM reference wrapper class for the tlbimp tool using a PIA.
Gets the resolved assembly path for the typelib wrapper.
Stores timestamps of COM components processed in the last run. The problem here is that installing/uninstalling
COM components does not update their timestamps with the current time (for a good reason). So if you revert to
an earlier revision of a COM component, its timestamp can go back in time and we still need to regenerate its
wrapper. So in ResolveComReference we compare the stored timestamp with the current component timestamp, and if
they are different, we regenerate the wrapper.
Component timestamps.
Key: Component path on disk
Value: DateTime struct
indicates whether the cache contents have changed since it's been created
Construct.
Compares the tlbimp and aximp paths to what the paths were when the cache was created
If these are different return false.
True if both paths match what is in the cache, false otherwise
Gets or sets the timestamp associated with the specified component file
Internal exception thrown when there's an unrecoverable failure extracting public/private keys.
Default constructor
Constructor that allows to preserve the original exception information
Constructor to implement required constructors for serialization
Possible strong name states of an assembly
Strong naming utilities.
Reads contents of a key file. Reused from vsdesigner code.
Given a key file or container, extract private/public key data. Reused from vsdesigner code.
Given an assembly path, determine if the assembly is [delay] signed or not. This code is based on similar unmanaged
routines in vsproject and sn.exe (ndp tools) codebases.
Retrieves the relative virtual address of the COR20 header, given the address of the NT headers structure. The catch
here is that the NT headers struct can be either 32 or 64 bit version, and some fields have different sizes there. We
need to see if we're dealing with a 32bit header or a 64bit one first.
internal constructor
task logger instance used for logging
true if this task should log only errors, no warnings or messages; false otherwise
callback interface for resolving dependent COM refs/NET assemblies
List of referenc files
cached reference information (typelib pointer, original task item, typelib name etc.)
reference name (for better logging experience)
directory we should write the wrapper to
Whether it has a temporary wrapper
delay sign wrappers?
file containing public/private keys
container name for public/private keys
Whether it has no class members
Architecture to seek.
True if the interop name should include the typelib's version
True if GenerateWrapper() should generate the wrapper out-of-proc using tlbimp.exe
Path to the SDK tools directory where tlbimp.exe can be found
BuildEngine of parent task; needed for logging purposes when generating wrapper out-of-proc
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.
does this reference have a temporary (i.e. written to tmp directory) wrapper?
directory we should write the wrapper to
Static version of GetWrapperFileName, as it really doesn't depend on
anything specific to the class, and this way it can be called using
TlbReference.GetWrapperFileName from outside
The typelib to generate the wrapper name for
The appropriate wrapper filename
Static version of GetWrapperFileName, as it really doesn't depend on
anything specific to the class, and this way it can be called using
TlbReference.GetWrapperFileName from outside
The typelib to generate the wrapper name for
True if the interop name should include the typelib's version
Major version number to append to the interop DLL's name
Minor version number to append to the interop DLL's name
The appropriate wrapper filename
The list of active switches in the order they should be emitted.
The list of active switches in the order they should be emitted.
The dictionary that holds all set switches
The string is the name of the property, and the CommandLineToolSwitch holds all of the relevant information
i.e., switch, boolean value, type, etc.
Creates a generator that generates a command-line based on the specified Xaml file and parameters.
Creates a generator that generates a command-line based on the specified Xaml file and parameters.
Any additional options (as a literal string) that may have been specified in the project file
The template which, if set, will be used to govern formatting of the command line(s)
The string to append to the end of a non-templated commandline.
Generate the command-line
Appends a literal string containing the verbatim contents of any
"AdditionalOptions" parameter. This goes last on the command
line in case it needs to cancel any earlier switch.
Ideally this should never be needed because the MSBuild task model
is to set properties, not raw switches
Generates a part of the command line depending on the type
Depending on the type of the switch, the switch is emitted with the proper values appended.
e.g., File switches will append file names, directory switches will append filenames with "\" on the end
Verifies that the required args are present. This function throws if we have missing required args
Verifies that the dependencies are present, and if the dependencies are present, or if the property
doesn't have any dependencies, the switch gets emitted
Returns true if the property has a value in the list of active tool switches
Checks to see if the switch name is empty
Returns true if the property exists (regardless of whether it is
set or not) and false otherwise.
Emit a switch that's an array of task items
Generates the commands for the switches that may have an array of arguments
The switch may be empty.
For stringarray switches (e.g., Sources), the CommandLineToolSwitchName (if it exists) is emitted
along with each and every one of the file names separately (if no separator is included), or with all of the
file names separated by the separator.
e.g., AdditionalIncludeDirectores = "@(Files)" where Files has File1, File2, and File3, the switch
/IFile1 /IFile2 /IFile3 or the switch /IFile1;File2;File3 is emitted (the latter case has a separator
";" specified)
Substitute the value for the switch into the switch value where the [value] string is found, if it exists.
Generates the commands for switches that have integers appended.
For integer switches (e.g., WarningLevel), the CommandLineToolSwitchName is emitted
with the appropriate integer appended, as well as any arguments
e.g., WarningLevel = "4" will emit /W4
Generates the switches for switches that either have literal strings appended, or have
different switches based on what the property is set to.
The string switch emits a switch that depends on what the parameter is set to, with and
arguments
e.g., Optimization = "Full" will emit /Ox, whereas Optimization = "Disabled" will emit /Od
Gets the arguments required by the specified switch and collects them into a string.
Generates the switches that are nonreversible
A boolean switch is emitted if it is set to true. If it set to false, nothing is emitted.
e.g. nologo = "true" will emit /Og, but nologo = "false" will emit nothing.
Generates the command line for switches that are reversible
A reversible boolean switch will emit a certain switch if set to true, but emit that
exact same switch with a flag appended on the end if set to false.
e.g., GlobalOptimizations = "true" will emit /Og, and GlobalOptimizations = "false" will emit /Og-
Generates the command line using the standard algorithm.
Generates the command-line using the template specified.
This enumeration specifies the different types for each switch in a tool
The types are used in the documentation
The boolean type has a boolean value, and there are types: one that can have a flag appended on the end
and one that can't
e.g. GlobalOptimizations = "true" would be /Og, and GlobalOptimizations="false" would be /Og-, but
WarnAsError = "true" would be /WX, while WarnAsError = "false" would be nothing.
The integer switch is used for properties that have several different integer values,
and depending on the value the property is set to, appends an integer to the end
of a certain switch
e.g. WarningLevel = "0" is /W0, WarningLevel = "2" is /W2
The string switch is used for two kinds of properties.
The first is the kind that has multiple values, and has a different switch for each value
e.g. Optimization="disabled" is /Od, "Full" is /Ox
The second is the kind that has a literal string appended to the end of a switch.
This type is similar to the File type, but in this case, will never get quoted.
The stringarray switch is used for properties that may have more
than one string appended to the end of the switch
e.g. InjectPrecompiledHeaderReference = myfile is /Ylmyfile
The ITaskItemArray type is used for properties that pass multiple files, but
want to keep the metadata. Otherwise, it is used in the same way as a StringArray type.
The class CommandLineToolSwitch holds information about the properties
for each task
Boolean switch type
Integer switch type
ITaskItemArray switch type.
String array switch type.
The value for a boolean switch.
The value for the integer type.
The list of strings for a string array.
The list of task items for ITaskItemArray types.
The default constructor creates a new CommandLineToolSwitch to hold the name of
the tool, the attributes, the dependent switches, and the values (if they exist)
Overloaded constructor. Takes a CommandLineToolSwitchType and sets the type.
The name of the parameter
Specifies if this switch should be included on the command-line.
The Value of the parameter
Flag indicating if the switch is valid.
The SwitchValue of the parameter
The SwitchValue of the parameter
The arguments.
The DisplayName of the parameter
The Description of the parameter
The type of the switch, i.e., boolean, string, stringarray, etc.
Indicates whether or not the switch is emitted with a flag when false
True if multiple values are allowed.
The flag to append at the end of a switch when the switch is set to false
i.e., for all CL switches that are reversible, the FalseSuffix is "-"
The flag to append to the end of the switch when that switch is true
i.e., In the OptimizeForWindows98, the switch is OPT, the FalseSuffix is
:NOWIN98, and the TrueSuffix is :WIN98
The separator indicates the characters that go between the switch and the string
in the string typed case, the characters that go between each name for the
string array case, or the characters that go between the switch and the
appendage for the boolean case.
The Fallback attribute is used to specify which property to look at in the
case that the argument property is not set, or if the file that the
argument property indicates is nonexistent.
This attribute specifies whether or not an argument attribute is required.
This property indicates whether or not the property is required in the project file
This property indicates the parent of the dependency
This property indicates the parent of the dependency
The BooleanValue is used for the boolean switches, and are set to true
or false, depending on what you set it to.
The number is the number you wish to append to the end of integer switches
Returns the set of inputs to a switch
Returns the set of inputs to a switch that is a set of ITaskItems
Expresses a relationship between an argument and a property.
Constructor
Constructor.
The name of the argument
The value.
Flag indicating if the argument is required or not.
Derived class indicating how to separate values from the specified argument.
Constructor.
The separator.
Class describing the relationship between switches.
The RelationsParser class takes an xml file and parses the parameters for a task.
A boolean to see if the current file parsed is an import file.
The name of the task
The base type of the class
The namespace of the class
Namespace for the resources
The name of the executable
The default prefix for each switch
All of the parameters that were parsed
All of the parameters that have a default value
All of the properties that serve as fallbacks for unset properties
Returns the number of errors encountered
Returns the log of errors
The method that loads in an XML file.
the xml file containing switches and properties.
Overloaded method that reads from a stream to load.
the xml file containing switches and properties
Parses the xml file.
Parses the loaded xml file, creates toolSwitches and adds them to the properties list
Checks to see if the "name" attribute exists
Checks to see if the element's name is "task"
Gets all the attributes assigned in the xml file for this parameter or all of the nested switches for
this parameter group
Increases the error count by 1, and logs the error message
An XML document can have many root nodes, but usually we want the single root
element. Callers can test each root node in turn with this method, until it returns
true.
Candidate root node
true if node is the root element
The type of value this property takes.
The property has no value type specified
The property takes values of type Boolean
The property takes values of type String
The property takes values of type Integer
The property takes values of type String[]
The property takes values of type ITaskItem[]
The class Property holds information about the properties
for each task
The type of the switch, i.e., boolean, stringarray, etc.
Specifies if the property should be included on the command line.
Specifies whether the switch is reversible (has a false suffix) or not
The name of the switch, without the / in front of it
i.e., Od for the Optimization property
The name of the reverse switch, without the / in front of it
The flag to append at the end of a switch when the switch is set to false
i.e., for all CL switches that are reversible, the FalseSuffix is "-"
The flag to append to the end of the switch when that switch is true
i.e., In the OptimizeForWindows98, the switch is OPT, the FalseSuffix is
:NOWIN98, and the TrueSuffix is :WIN98
The max integer value an integer typed switch can have
An exception should be thrown in the number the user specifies is
larger than the max
The minimum integer value an integer typed switch can have
An exception should be thrown in the number the user specifies is
less than the minimum
The separator indicates the characters that go between the switch and the string
in the string typed case, the characters that go between each name for the
string array case, or the characters that go between the switch and the
appendage for the boolean case.
The default value for the switch to have (in the case of reversibles, true
or false, in the case of files, a default file name)
The argument specifies which property to look for when appending a
file name, and that property contains the actual file name.
i.e., UsePrecompiledHeader has the argument "PrecompiledHeaderThrough"
and the values "CreateUsingSpecific", "GenerateAuto", and "UseUsingSpecific"
that have the switches /Yc, /YX, and /Yu.
If PrecompiledHeaderThrough has the value "myfile", then the emitted switch
would be /Ycmyfile, /YXmyfile, or /Yumyfile
The Fallback attribute is used to specify which property to look at in the
case that the argument property is not set, or if the file that the
argument property indicates is nonexistent.
This property whether or not the property is required in the project file
This property indicates whether the property is an output, i.e., object files
The name of the property this one is dependent on.
The name of the property
The list of switches that are dependent with this one.
The different choices for each property, and the corresponding switch
The prefix for each switch.
The Category for each switch.
The Display Name for each switch.
The Description for each switch.
The arguments which apply to this property.
creates a new Property with the exact same information as this one
An enum value.
The name of the property
The switch Name of the property
The switch Name of the property
The switch Name of the property
The switch Name of the property
The prefix for each switch.
The switch Name of the property
An argument for the property.
The switch Name of the property
The switch Name of the property
The switch Name of the property
The TaskGenerator class creates code for the specified file
The property for the tool name.
IsOn
IsOff
The value attribute.
The boolean type
The integer type
The string type
The string array type
The ITaskItemArray type
The KeyValue pair type.
The import type.
The ToolSwitch.
The ToolSwitch type.
The switchToAdd field.
The ActiveToolSwitches property.
The switchMap field.
The MultiValues property.
The AddLast method.
The ValidateInteger method.
The ReadSwitchMap method.
The IsPropertySet method.
The IsSwitchValueSet method.
The AddDefaultsToActiveSwitchList method.
The AddFallbacksToActiveSwitchList method.
The ValidateRelations method.
The ReplaceToolSwitch method.
The Overrides method.
The Name property
The BooleanValue property
The FileName property
The TaskItemArray property
The StringList property
The Number property
The FalseSuffix property
The TrueSuffix property
The Separator property
The FallbackArgumentParameter property
The Output property
The ArgumentParameter property
The Required property
The Parents property
The Reversible property
The SwitchValue property
The Value property
The Required property
The DisplayName property
The Description property
The ReverseSwitchValue property
The IsValid property
Types to ignore.
The xml parsers
The relations parser
The default constructor
When set to true, the generated code will include comments.
Constructor that takes a parser
The platform
Removes properties that have types we are ignoring.
Generates the source code for the task in the specified file
Generates a method called "AddDefaultsToActiveSwitchList" that takes all of the properties that have
default values and adds them to the active switch list
Generates a method called "AddFallbacksToActiveSwitchList" that takes all of the properties that
are not set but have fallbacks and adds the fallbacks to the active list if they are set.
Generates code for the different properties in a task
Generates an assignment statment for the setters of properties, where the rhs is a string
e.g., switchToAdd.Name = "Optimizations";
Generates an assignment statment for the setters of properties, where the rhs is an expression
e.g., switchToAdd.ArgumentRequired = true;
Generates an assignment for the toolswitch, with a prefix included
i.e., switchToAdd.ToolSwitchName = "/Ox";
This method generates all of the common cases between different property types.
The common cases are:
1) A new ToolSwitch object has to be created for each property
2) The newly created ToolSwitch has to be added to the ActiveToolSwitches list
4) For all non-empty common attributes that don't need customization, set the property
These would be:
name, type, separator, argument, argumentRequired, fallback, dependencies
The property
The CodeDom property
The type of the property
The return type of the property
The lhs of the assignment statement lhs = value
Generates standart set statements for properties.
Generates an ITaskItem array property type.
This method generates all of the switches for integer typed properties.
This method generates the switches for all of the nonreversible properties.
This method generates all of the switches for the string type property.
Returns true if the property refers to the current platform.
Returns true if the switch value refers to the current platform.
This method generates overrides array
This method generates switches for all the properties that are of type
string array
This method generates the property that returns the tool exe value set by the ToolExe property
This method generates the code that appears at the top of each class (that imports other libraries)
This method generates the default constructor for the generated task
This method generates the relations which will be used at runtime to validate the command line
Increases the error count by 1, and logs the error message
Puts a string inside two quotes
Returns the number of errors encountered
Returns the log of errors
The TaskParser class takes an xml file and parses the parameters for a task.
The ordered list of how the switches get emitted.
The name of the task
The base type of the class
The namespace of the class
Namespace for the resources
The name of the executable
The default prefix for each switch
All of the parameters that were parsed
All of the parameters that have a default value
All of the properties that serve as fallbacks for unset properties
The ordered list of properties
Returns the log of errors
Parse the specified string, either as a file path or actual XML content.
Parse a Xaml document from a TextReader
Parse a Xaml document from a rule
Reads in the nodes of the xml file one by one and builds the data structure of all existing properties
Fills in the property data structure
Gets all the attributes assigned in the xml file for this parameter or all of the nested switches for
this parameter group
Part of the base class for tasks generated by the Xaml task factory.
True if we returned our commands directly from the command line generation and do not need to use the
response file (because the command-line is short enough)
The task logging helper
The command line for this task.
Constructor called by the generated task.
The command-line template to use, if any.
The additional options that have been set. These are raw switches that
go last on the command line.
Retrieves the list of acceptable non-zero exit codes.
Gets or set the dictionary of active tool switch values.
Ordered list of switches
Switches in declaration order
The list of all the switches that have been set
Overridden to use UTF16, which works better than UTF8 for older versions of CL, LIB, etc.
Made a property to abstract out the "if null, call GenerateCommands()" logic.
Returns true if the property has a value in the list of active tool switches
Replace an existing switch with the specifed one of the same name.
Add the value for a switch to the list of active values
Override Execute so that we can close the event handle we've created
For testing purposes only
Returns the generated command line
Checks to see if the switch name is empty
Determine if the return value is in the list of acceptable exit codes.
Validate the data
Validate relationships.
Validate the overrides.
Creates the command line and returns it as a string by:
1. Adding all switches with the default set to the active switch list
2. Customizing the active switch list (overridden in derived classes)
3. Iterating through the list and appending switches
Allows tool to handle the return code.
This method will only be called with non-zero exitCode. If the non zero code is an acceptable one then we return true
The return value of this method will be used as the task return value
Generates the command line for the tool.
A method that will validate the integer type arguments
If the min or max is set, and the value a property is set to is not within
the range, the build fails
A method for the enumerated values a property can have
This method checks the value a property is set to, and finds the corresponding switch
The switch that a certain value is mapped to
A method for the enumerated values a property can have
This method checks the value a property is set to, and finds the corresponding switch
The switch that a certain value is mapped to
Gets a switch value by concatenating the switch's base value (usually the switch itself) with its argument, if any.
Default constructor
This method is called to find the tool if ToolPath wasn't specified.
We just return the name of the tool so it can be found on the path.
Deriving classes can choose to do something else.
Validates all of the set properties that have either a string type or an integer type
Generate the command line if it is less than 32k.
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.
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
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 live wrapper over a collection.
It does not prevent modification of the values themselves.
There is a type with the same name in the BCL, but it is actually a ReadOnlyList and does not accept an ICollection>T<.
Thus this is an omission from the BCL.
Type of element in the collection
Backing live enumerable.
May be a collection.
Construct a read only wrapper around the current contents
of the IEnumerable, or around the backing collection if the
IEnumerable is in fact a collection.
Return the number of items in the backing collection
Returns true.
Whether collection is synchronized
Sync root
Get a backing ICollection.
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
Pass through for underlying collection
NOTE: This does NOT cause a copy into a List, since the
backing enumerable suffices.
Pass through for underlying collection
NOTE: This does NOT cause a copy into a List, since the
backing enumerable suffices.
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
The methods here are designed to aid in transition from the v2 StrongName APIs on mscoree.dll to the
v4 metahost APIs (which are in-proc SxS aware).
This is a managed wrapper for the IClrStrongName interface defined in metahost.idl
This uses IntPtrs in some places where you'd normally expect a byte[] in order to
be compatible with callers who wrote their PInvoke signatures that way.
Ideally we'd probably just simplify all such callers to using byte[] and remove this
version of the interface.
This is a managed wrapper for the IClrStrongName interface defined in metahost.idl
This is very similar to the standard RCWs provided in
ndp/fx/src/hosting/interop/microsoft/runtime/hosting/interop, but we don't want to
reference that assembly (part of the SDK only, not .NET redist). Also, our version
is designed specifically for easy migration from the old mscoree APIs, for example
all APIs return HResults rather than throw exceptions.
The reason you need provider type 24, is because that’s the only RSA provider type that supports SHA-2 operations. (For instance, PROV_RSA_FULL does not support SHA-2).
As for official guidance – I’m not sure of any. For workarounds though, if you’re using the Microsoft software CSPs, they share the underlying key store. You can get the key container name from your RSA object, then open up a new RSA object with the same key container name but with PROV_RSA_AES. At that point, you should be able to use SHA-2 algorithms.
Whether to use sha256