From 02f54a52c16e074a2f54cc7c12715620ca3d9ff3 Mon Sep 17 00:00:00 2001 From: Ryland <41491307+ryalanms@users.noreply.github.com> Date: Tue, 20 Jul 2021 12:52:51 -0700 Subject: [PATCH 1/4] Use preview language version for WPF --- eng/WpfArcadeSdk/Sdk/Sdk.props | 2 +- .../src/Common/src/System/AppContextDefaultValues.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/WpfArcadeSdk/Sdk/Sdk.props b/eng/WpfArcadeSdk/Sdk/Sdk.props index 2c86e4c285c..2c72d3fa24b 100644 --- a/eng/WpfArcadeSdk/Sdk/Sdk.props +++ b/eng/WpfArcadeSdk/Sdk/Sdk.props @@ -14,7 +14,7 @@ $(WpfArcadeSdkToolsDir)GenXmlStringTable.pl - 8.0 + preview true true diff --git a/src/Microsoft.DotNet.Wpf/src/Common/src/System/AppContextDefaultValues.cs b/src/Microsoft.DotNet.Wpf/src/Common/src/System/AppContextDefaultValues.cs index 690e33084a0..81a5baec8e3 100644 --- a/src/Microsoft.DotNet.Wpf/src/Common/src/System/AppContextDefaultValues.cs +++ b/src/Microsoft.DotNet.Wpf/src/Common/src/System/AppContextDefaultValues.cs @@ -204,7 +204,7 @@ private static bool TryParseFrameworkName(String frameworkName, out String ident /// This is a partial method. This method is responsible for populating the default values based on a TFM. /// It is partial because each library should define this method in their code to contain their defaults. - static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version); + static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int targetFrameworkVersion); } } From 3c0876976bd9e22fc21252df23e2b20a1e085b53 Mon Sep 17 00:00:00 2001 From: Ryland <41491307+ryalanms@users.noreply.github.com> Date: Fri, 23 Jul 2021 09:45:00 -0700 Subject: [PATCH 2/4] Replace IL injection with ModuleInitializer attribute. --- eng/WpfArcadeSdk/Sdk/Sdk.targets | 1 - .../tools/InjectModuleInitializer.targets | 413 ----------------- .../AddModuleConstructorTask.cs | 82 ---- .../InjectModuleInitializer/ILAsmTask.cs | 301 ------------- .../InjectModuleInitializer/ILDasmTask.cs | 212 --------- .../ModuleInitializer.il | 59 --- .../MsCorLibAssemblySection.il | 5 - .../CreateTemporaryTargetAssemblyProject.cs | 414 ------------------ .../GenerateTemporaryTargetAssembly.cs | 4 +- .../GenerateTemporaryTargetAssembly2.cs | 332 -------------- .../PresentationBuildTasks.csproj | 2 - .../src/PresentationCore/ModuleInitializer.cs | 2 + .../PresentationCore/PresentationCore.csproj | 3 +- 13 files changed, 5 insertions(+), 1825 deletions(-) delete mode 100644 eng/WpfArcadeSdk/tools/InjectModuleInitializer.targets delete mode 100644 eng/WpfArcadeSdk/tools/InjectModuleInitializer/AddModuleConstructorTask.cs delete mode 100644 eng/WpfArcadeSdk/tools/InjectModuleInitializer/ILAsmTask.cs delete mode 100644 eng/WpfArcadeSdk/tools/InjectModuleInitializer/ILDasmTask.cs delete mode 100644 eng/WpfArcadeSdk/tools/InjectModuleInitializer/ModuleInitializer.il delete mode 100644 eng/WpfArcadeSdk/tools/InjectModuleInitializer/MsCorLibAssemblySection.il delete mode 100644 src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/CreateTemporaryTargetAssemblyProject.cs delete mode 100644 src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/GenerateTemporaryTargetAssembly2.cs diff --git a/eng/WpfArcadeSdk/Sdk/Sdk.targets b/eng/WpfArcadeSdk/Sdk/Sdk.targets index a09ea4a9860..db8530fd1d2 100644 --- a/eng/WpfArcadeSdk/Sdk/Sdk.targets +++ b/eng/WpfArcadeSdk/Sdk/Sdk.targets @@ -21,7 +21,6 @@ - diff --git a/eng/WpfArcadeSdk/tools/InjectModuleInitializer.targets b/eng/WpfArcadeSdk/tools/InjectModuleInitializer.targets deleted file mode 100644 index c80e2749bd0..00000000000 --- a/eng/WpfArcadeSdk/tools/InjectModuleInitializer.targets +++ /dev/null @@ -1,413 +0,0 @@ - - - - - - - - - - - - - $(Pkgruntime_win-x86_Microsoft_NETCore_ILDAsm)\runtimes\$(WpfRuntimeIdentifier)\native\ - $(Pkgruntime_win-x86_Microsoft_NETCore_ILAsm)\runtimes\$(WpfRuntimeIdentifier)\native\ - $(Pkgruntime_win-x86_Microsoft_NETCore_Runtime_CoreCLR)\runtimes\$(WpfRuntimeIdentifier)\native\ - - - - $(Pkgruntime_win-x64_Microsoft_NETCore_ILDAsm)\runtimes\$(WpfRuntimeIdentifier)\native\ - $(Pkgruntime_win-x64_Microsoft_NETCore_ILAsm)\runtimes\$(WpfRuntimeIdentifier)\native\ - $(Pkgruntime_win-x64_Microsoft_NETCore_Runtime_CoreCLR)\runtimes\$(WpfRuntimeIdentifier)\native\ - - - - $(Pkgruntime_win-arm64_Microsoft_NETCore_ILDAsm)\runtimes\$(WpfRuntimeIdentifier)\native\ - $(Pkgruntime_win-arm64_Microsoft_NETCore_ILAsm)\runtimes\$(WpfRuntimeIdentifier)\native\ - $(Pkgruntime_win-arm64_Microsoft_NETCore_Runtime_CoreCLR)\runtimes\$(WpfRuntimeIdentifier)\native\ - - - - $(ArtifactsTmpDir)\iltools\$(PackageRuntimeIdentifierPrefix)\ - $(ILToolsPath)ildasm.exe - $(ILToolsPath)ilasm.exe - - - - - - - $(RepositoryToolsDir)native\bin\net-framework-472-iltools\$(NetFramework472IlToolsVersion)\ - $(Net472IlToolsDir)ildasm.exe - $(Net472IlToolsDir)ilasm.exe - - - - - - RoslynCodeTaskFactory - $(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)$(AssemblyName)$(TargetExt)')) - $([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)$(AssemblyName).il')) - - - - - - - - - - - - $([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)$(AssemblyName).il')) - $(WpfArcadeSdkToolsDir)InjectModuleInitializer\ModuleInitializer.il - $(WpfArcadeSdkToolsDir)InjectModuleInitializer\MsCorLibAssemblySection.il - - - - - - - - - - $([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)$(AssemblyName)$(TargetExt)')) - $([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)$(AssemblyName).res')) - $([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)$(AssemblyName).il')) - - - - - false - true - - - - - - - - - - - diff --git a/eng/WpfArcadeSdk/tools/InjectModuleInitializer/AddModuleConstructorTask.cs b/eng/WpfArcadeSdk/tools/InjectModuleInitializer/AddModuleConstructorTask.cs deleted file mode 100644 index 2dec64303ea..00000000000 --- a/eng/WpfArcadeSdk/tools/InjectModuleInitializer/AddModuleConstructorTask.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Diagnostics; -using System.IO; -using System.Text.RegularExpressions; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace WpfArcadeSdk.Build.Tasks -{ - /// - /// Append the supplied module constructor to the supplied IL file. - /// Using this requires that the DLL has implemented a static class named - /// ModuleInitializer with a static void Initialize function. This class - /// is called from the module initializer. - /// - public class AddModuleConstructorTask : Task - { - /// - /// The original IL file to manipulate - /// - [Required] - public string ILFile { get; set; } - - /// - /// Contains the IL section referencing mscorlib. - /// This is inserted if not already present. - /// - [Required] - public string MsCorLibAssemblySectionIL { get; set; } - - /// - /// Contains the IL of the module constructor - /// - [Required] - public string ModuleConstructorIL { get; set; } - - public override bool Execute() - { - try - { - var moduleConstructorIL = File.ReadAllText(ModuleConstructorIL); - var msCorLibAssemblySectionIL = File.ReadAllText(MsCorLibAssemblySectionIL); - var sourceIL = File.ReadAllText(ILFile); - string ilToInject = msCorLibAssemblySectionIL + Environment.NewLine + moduleConstructorIL; - - using (var outputIL = new StreamWriter(File.Open(ILFile, FileMode.Truncate))) - { - if (Regex.Match(sourceIL, @"\.class.+?ModuleInitializer.+?\.method.+?static.+?Initialize\(\).+?end of class ModuleInitializer", RegexOptions.Singleline) == Match.Empty) - { - Log.LogError("Inserting a module initializer requires the assembly to implement a class named ModuleInitializer with a static parameterless method named Initialize."); - return false; - } - - if (Regex.Match(sourceIL, @"\.class private auto ansi '\'.+?\.method private hidebysig specialname rtspecialname static void \.cctor \(\) cil managed ", RegexOptions.Singleline) != Match.Empty) - { - Log.LogError("Cannot insert a module initializer into an assembly that already contains one."); - return false; - } - - // Attempt to replace an existing mscorlib reference with the reference + module initializer. - string modifiedIL = Regex.Replace(sourceIL, @"\.assembly extern mscorlib.+};", ilToInject, RegexOptions.Singleline); - - // If we are given the same string back, there was nothing to replace. - // In that case write out the reference and initializer from scratch. - if (object.ReferenceEquals(modifiedIL, sourceIL)) - { - outputIL.WriteLine(ilToInject); - } - - outputIL.WriteLine(modifiedIL); - } - - return true; - } - catch (Exception e) - { - Log.LogError(e.ToString() + Environment.NewLine + e.StackTrace); - return false; - } - } - } -} diff --git a/eng/WpfArcadeSdk/tools/InjectModuleInitializer/ILAsmTask.cs b/eng/WpfArcadeSdk/tools/InjectModuleInitializer/ILAsmTask.cs deleted file mode 100644 index dc52629d247..00000000000 --- a/eng/WpfArcadeSdk/tools/InjectModuleInitializer/ILAsmTask.cs +++ /dev/null @@ -1,301 +0,0 @@ -using System; -using System.Diagnostics; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace WpfArcadeSdk.Build.Tasks -{ - /// - /// Runs ILAsm from the path supplied on the assembly supplied. - /// - public class ILAsmTask : Task - { - /// - /// The full path to ILAsm.exe - /// - [Required] - public string ILAsm { get; set; } - - /// - /// The source file to assemble - /// - [Required] - public string SourceFile { get; set; } - - /// - /// The output path - /// - [Required] - public string Out { get; set; } - - /// - /// /NOLOGO Don't type the logo - /// - public bool NoLogo { get; set; } - - /// - /// /QUIET Don't report assembly progress - /// - public bool Quiet { get; set; } - - /// - /// /NOAUTOINHERIT Disable inheriting from System.Object by default - /// - public bool NoAutoInherit { get; set; } - - /// - /// /DLL Compile to.dll - /// - public bool Dll { get; set; } - - /// - /// /EXE Compile to.exe(default) - /// - public bool Exe { get; set; } - - /// - /// /PDB Create the PDB file without enabling debug info tracking - /// - public bool Pdb { get; set; } - - /// - /// /APPCONTAINER Create an AppContainer exe or dll - /// - public bool AppContainer { get; set; } - - /// - /// /DEBUG Disable JIT optimization, create PDB file, use sequence points from PDB - /// - public bool Debug { get; set; } - - /// - /// /DEBUG=IMPL Disable JIT optimization, create PDB file, use implicit sequence points - /// - public bool DebugDisableJitOptimization { get; set; } - - - /// - /// / DEBUG = OPT Enable JIT optimization, create PDB file, use implicit sequence points - /// - public bool DebugEnableJitOptimization { get; set; } - - - /// - /// / OPTIMIZE Optimize long instructions to short - /// - public bool Optimize { get; set; } - - - /// - /// / FOLD Fold the identical method bodies into one - /// - public bool Fold { get; set; } - - - /// - /// / CLOCK Measure and report compilation times - /// - public bool Clock { get; set; } - - - /// - /// / RESOURCE =< res_file > Link the specified resource file(*.res) into resulting.exe or.dll - /// - public string Resource { get; set; } - - - /// - /// / CVRES =< path_to_file > Set path to cvtres tool: /CVR= cvtres.exe / CVR = tool\cvtres.cmd /CVR= D:\tool\ - /// - public string CvRes { get; set; } - - /// - /// /KEY =< keyfile > Compile with strong signature - /// ( contains private key) - /// - public string KeyFile { get; set; } - - /// - /// /KEY=@ Compile with strong signature - /// ( is the private key source name) - /// - public string KeySource { get; set; } - - /// - /// /INCLUDE= Set path to search for #include'd files - /// - public string Include { get; set; } - - /// - /// /SUBSYSTEM= Set Subsystem value in the NT Optional header - /// - public string SubSystem { get; set; } - - /// - /// /SSVER=. Set Subsystem version number in the NT Optional header - /// - public string SubSystemVersion { get; set; } - - /// - /// /FLAGS= Set CLR ImageFlags value in the CLR header - /// - public string Flags { get; set; } - - /// - /// /ALIGNMENT= Set FileAlignment value in the NT Optional header - /// - public string Alignment { get; set; } - - /// - /// /BASE= Set ImageBase value in the NT Optional header(max 2GB for 32-bit images) - /// - public string Base { get; set; } - - /// - /// /STACK= Set SizeOfStackReserve value in the NT Optional header - /// - public string Stack { get; set; } - - /// - /// /MDV= Set Metadata version string - /// - public string MetadataVersion { get; set; } - - /// - /// /MSV=. Set Metadata stream version(.) - /// - public string MetadataStreamVersion { get; set; } - - /// - /// /PE64 Create a 64bit image(PE32+) - /// - public string PE64 { get; set; } - - /// - /// /HIGHENTROPYVA Set High Entropy Virtual Address capable PE32+ images(default for /APPCONTAINER) - /// - public string HighEntropyVirtualAddress { get; set; } - - /// - /// /NOCORSTUB Suppress generation of CORExeMain stub - /// - public string NoCorStub { get; set; } - - /// - /// /STRIPRELOC Indicate that no base relocations are needed - /// - public string StripReLoc { get; set; } - - /// - /// /ITANIUM Target processor: Intel Itanium - /// - public string Itanium { get; set; } - - /// - /// /X64 Target processor: 64bit AMD processor - /// - public string X64 { get; set; } - - /// - /// /ARM Target processor: ARM processor - /// - public string Arm { get; set; } - - /// - /// /32BITPREFERRED Create a 32BitPreferred image(PE32) - /// - public string Prefer32Bit { get; set; } - - /// - /// /ENC= Create Edit-and-Continue deltas from specified source file - /// - public string ENC { get; set; } - - public override bool Execute() - { - try - { - string commandLine = "/OUT=" + Out; - if (NoLogo) commandLine += " /NOLOGO"; - if (Quiet) commandLine += " /QUIET"; - if (NoAutoInherit) commandLine += " /NOAUTOINHERIT"; - if (Dll) commandLine += " /DLL"; - if (Exe) commandLine += " /EXE"; - if (Pdb) commandLine += " /PDB"; - if (AppContainer) commandLine += " /APPCONTAINER"; - if (Debug) commandLine += " /DEBUG"; - if (DebugDisableJitOptimization) commandLine += " /DEBUG=IMPL"; - if (DebugEnableJitOptimization) commandLine += " /DEBUG=OPT"; - if (Optimize) commandLine += " /OPTIMIZE"; - if (Fold) commandLine += " /FOLD"; - if (Clock) commandLine += " /CLOCK"; - if (!string.IsNullOrEmpty(Resource)) commandLine += " /RESOURCE=" + Resource; - if (!string.IsNullOrEmpty(CvRes)) commandLine += " /CVRES=" + CvRes; - if (!string.IsNullOrEmpty(KeyFile)) commandLine += " /KeyFile=" + KeyFile; - if (!string.IsNullOrEmpty(KeySource)) commandLine += " /CVRES=@" + KeySource; - if (!string.IsNullOrEmpty(Include)) commandLine += " /INCLUDE=" + Include; - - int subSystem = -1; - if (!string.IsNullOrEmpty(SubSystem) && Int32.TryParse(SubSystem, out subSystem)) commandLine += " /SUBSYSTEM=" + subSystem; - if (!string.IsNullOrEmpty(SubSystemVersion)) commandLine += " /SUBSYSTEMVERSION=" + SubSystemVersion; - - int flags = -1; - if (!string.IsNullOrEmpty(Flags) && Int32.TryParse(Flags, out flags)) commandLine += " /FLAGS=" + flags; - - int alignment = -1; - if (!string.IsNullOrEmpty(Alignment) && Int32.TryParse(Alignment, out alignment)) commandLine += " /ALIGNMENT=" + alignment; - - int @base = -1; - if (!string.IsNullOrEmpty(Base) && Int32.TryParse(Base, out @base)) commandLine += " /BASE=" + @base; - - int stack = -1; - if (!string.IsNullOrEmpty(Stack) && Int32.TryParse(Stack, out stack)) commandLine += " /STACK=" + stack; - - if (!string.IsNullOrEmpty(MetadataVersion)) commandLine += " /MDV=" + MetadataVersion; - if (!string.IsNullOrEmpty(MetadataStreamVersion)) commandLine += " /MSV=" + MetadataStreamVersion; - - bool pe64 = false; - if (!string.IsNullOrEmpty(PE64) && bool.TryParse(PE64, out pe64)) commandLine += " /PE64=" + pe64; - - bool highEntropyVA = false; - if (!string.IsNullOrEmpty(HighEntropyVirtualAddress) && bool.TryParse(HighEntropyVirtualAddress, out highEntropyVA)) commandLine += " /HIGHENTROPYVA=" + highEntropyVA; - - bool noCorStub = false; - if (!string.IsNullOrEmpty(NoCorStub) && bool.TryParse(NoCorStub, out noCorStub)) commandLine += " /NOCORSTUB=" + noCorStub; - - bool stripreloc = false; - if (!string.IsNullOrEmpty(StripReLoc) && bool.TryParse(StripReLoc, out stripreloc)) commandLine += " /STRIPRELOC=" + stripreloc; - - bool itanium = false; - if (!string.IsNullOrEmpty(Itanium) && bool.TryParse(Itanium, out itanium)) commandLine += " /ITANIUM=" + itanium; - - bool x64 = false; - if (!string.IsNullOrEmpty(X64) && bool.TryParse(X64, out x64)) commandLine += " /X64=" + x64; - - bool arm = false; - if (!string.IsNullOrEmpty(Arm) && bool.TryParse(Arm, out arm)) commandLine += " /ARM=" + arm; - - bool prefer32bit = false; - if (!string.IsNullOrEmpty(Prefer32Bit) && bool.TryParse(Prefer32Bit, out prefer32bit)) commandLine += " /32BITPREFERRED=" + prefer32bit; - - if (!string.IsNullOrEmpty(ENC)) commandLine += " /ENC=" + ENC; - - - ProcessStartInfo startInfo = new ProcessStartInfo(ILAsm); - startInfo.CreateNoWindow = true; - startInfo.UseShellExecute = false; - startInfo.Arguments = SourceFile + " " + commandLine; - - Log.LogMessage("Starting process: " + startInfo.FileName + " " + startInfo.Arguments); - - Process.Start(startInfo).WaitForExit(); - return true; - } - catch (Exception e) - { - Log.LogError(e.ToString() + e.StackTrace); - return false; - } - } - } -} diff --git a/eng/WpfArcadeSdk/tools/InjectModuleInitializer/ILDasmTask.cs b/eng/WpfArcadeSdk/tools/InjectModuleInitializer/ILDasmTask.cs deleted file mode 100644 index b31903647dd..00000000000 --- a/eng/WpfArcadeSdk/tools/InjectModuleInitializer/ILDasmTask.cs +++ /dev/null @@ -1,212 +0,0 @@ -using System; -using System.Diagnostics; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace WpfArcadeSdk.Build.Tasks -{ - /// - /// Runs ILDAsm from the path supplied on the assembly supplied. - /// - public class ILDAsmTask : Task - { - [Required] - public string ILDAsm { get; set; } - - [Required] - public string Assembly { get; set; } - - [Required] - public string Out { get; set; } - - /// - /// Output in HTML format - /// - public bool Html { get; set; } - - /// - /// Output in rich text format - /// - public bool Rtf { get; set; } - - /// - /// Show actual bytes(in hex) as instruction comments - /// - public bool Bytes { get; set; } - - /// - /// Show exception handling clauses in raw form - /// - public bool RawEH { get; set; } - - /// - /// Show metadata tokens of classes and members - /// - public bool Tokens { get; set; } - - /// - /// Show original source lines as comments - /// - public bool Source { get; set; } - - /// - /// Include references to original source lines - /// - public bool LineNum { get; set; } - - /// - /// =[+...] Only disassemble the items with specified - /// visibility. ( = PUB | PRI | FAM | ASM | FAA | FOA | PSC) - /// - public string Visibility { get; set; } - - /// - /// Only disassemble the public items(same as /VIS= PUB) - /// - public bool PubOnly { get; set; } - - /// - /// Include all names into single quotes - /// - public bool QuoteAllNames { get; set; } - - /// - /// Suppress output of custom attributes - /// - public bool NoCA { get; set; } - - /// - /// Output CA blobs in verbal form(default - in binary form) - /// - public bool CAVerbal { get; set; } - - /// - /// Suppress disassembly progress bar window pop-up - /// - public bool NoBar { get; set; } - - /// - /// Use UTF-8 encoding for output(default - ANSI) - /// - public bool Utf8 { get; set; } - - /// - /// Use UNICODE encoding for output - /// - public bool Unicode { get; set; } - - /// - /// Suppress IL assembler code output - /// - public bool NoIL { get; set; } - - /// - /// Use forward class declaration - /// - public bool Forward { get; set; } - - /// - /// Output full list of types(to preserve type ordering in round-trip) - /// - public bool TypeList { get; set; } - - /// - /// Display.NET projection view if input is a.winmd file - /// - public bool Project { get; set; } - - /// - /// Include file headers information in the output - /// - public bool Headers { get; set; } - - /// - /// =[::[(< sig >)] Disassemble the specified item only - /// - public string Item { get; set; } - - /// - /// Include statistics on the image - /// - public bool Stats { get; set; } - - /// - /// Include list of classes defined in the module - /// - public bool ClassList { get; set; } - - /// - /// Combination of /HEADER,/BYTES,/STATS,/CLASSLIST,/TOKENS - /// - public bool All { get; set; } - - /// - /// Options for EXE,DLL,OBJ and LIB files: - /// /METADATA[=< specifier >] Show MetaData, where is: - /// /MDHEADER Show MetaData header information and sizes. - /// /HEX Show more things in hex as well as words. - /// /CSV Show the record counts and heap sizes. - /// /UNREX Show unresolved externals. - /// /SCHEMA Show the MetaData header and schema information. - /// /RAW Show the raw MetaData tables. - /// /HEAPS Show the raw heaps. - /// /VALIDATE Validate the consistency of the metadata. - /// - public string Metadata { get; set; } - - /// - /// Options for LIB files only: - /// /OBJECTFILE=< obj_file_name > Show MetaData of a single object file in library - /// - public string ObjectFile { get; set; } - - public override bool Execute() - { - try - { - string commandLine = "/OUT=" + Out; - if (Html) commandLine += " /HTML"; - if (Rtf) commandLine += " /RTF"; - if (Bytes) commandLine += " /BYTES"; - if (RawEH) commandLine += " /RAWEH"; - if (Tokens) commandLine += " /TOKENS"; - if (Source) commandLine += " /SOURCE"; - if (LineNum) commandLine += " /LINENUM"; - if (Visibility != null && Visibility.Trim() != string.Empty) commandLine += " /VISIBILITY=" + Visibility; - if (PubOnly) commandLine += " /PUBONLY"; - if (QuoteAllNames) commandLine += " /QUOTEALLNAMES"; - if (NoCA) commandLine += " /NOCA"; - if (CAVerbal) commandLine += " /CAVERBAL"; - if (NoBar) commandLine += " /NOBAR"; - if (Utf8) commandLine += " /UTF8"; - if (Unicode) commandLine += " /UNICODE"; - if (NoIL) commandLine += " /NOIL"; - if (Forward) commandLine += " /FORWARD"; - if (TypeList) commandLine += " /TYPELIST"; - if (Headers) commandLine += " /HEADERS"; - if (Item != null && Item.Trim() != string.Empty) commandLine += " /ITEM=" + Item; - if (Stats) commandLine += " /STATS"; - if (ClassList) commandLine += " /CLASSLIST"; - if (All) commandLine += " /ALL"; - if (Metadata != null && Metadata.Trim() != string.Empty) commandLine += " /METADATA=" + Metadata; - if (ObjectFile != null && ObjectFile.Trim() != string.Empty) commandLine += " /OBJECTFILE=" + ObjectFile; - - ProcessStartInfo startInfo = new ProcessStartInfo(ILDAsm); - startInfo.CreateNoWindow = true; - startInfo.UseShellExecute = false; - startInfo.Arguments = Assembly + " " + commandLine; - - - Log.LogMessage("Starting process: " + startInfo.FileName + " " + startInfo.Arguments); - - Process.Start(startInfo).WaitForExit(); - return true; - } - catch (Exception e) - { - Log.LogError(e.ToString() + e.StackTrace); - return false; - } - } - } -} diff --git a/eng/WpfArcadeSdk/tools/InjectModuleInitializer/ModuleInitializer.il b/eng/WpfArcadeSdk/tools/InjectModuleInitializer/ModuleInitializer.il deleted file mode 100644 index 3c49d33d2bc..00000000000 --- a/eng/WpfArcadeSdk/tools/InjectModuleInitializer/ModuleInitializer.il +++ /dev/null @@ -1,59 +0,0 @@ -.class private auto ansi '' -{ - .method private hidebysig specialname rtspecialname static void .cctor () cil managed - { - // Code size 76 (0x4c) - .maxstack 3 - - .locals init (class [mscorlib]System.Type V_0, bool V_1, class [mscorlib]System.Reflection.MethodInfo V_2, bool V_3) - IL_0000: nop - IL_0001: call class [mscorlib]System.Reflection.Assembly [mscorlib]System.Reflection.Assembly::GetExecutingAssembly() - IL_0006: ldstr "ModuleInitializer" - IL_000b: callvirt instance class [mscorlib]System.Type [mscorlib]System.Reflection.Assembly::GetType(string) - IL_0010: stloc.0 - IL_0011: ldloc.0 - IL_0012: ldnull - IL_0013: call bool [mscorlib]System.Type::op_Inequality(class [mscorlib]System.Type, class [mscorlib]System.Type) - IL_0018: stloc.1 - IL_0019: ldloc.1 - IL_001a: brfalse.s IL_004b - - IL_001c: nop - IL_001d: ldloc.0 - IL_001e: ldstr "Initialize" - IL_0023: ldc.i4.s 24 - IL_0025: callvirt instance class [mscorlib]System.Reflection.MethodInfo [mscorlib]System.Type::GetMethod(string, valuetype [mscorlib]System.Reflection.BindingFlags) - IL_002a: stloc.2 - IL_002b: ldloc.2 - IL_002c: ldnull - IL_002d: call bool [mscorlib]System.Reflection.MethodInfo::op_Inequality(class [mscorlib]System.Reflection.MethodInfo, class [mscorlib]System.Reflection.MethodInfo) - IL_0032: stloc.3 - IL_0033: ldloc.3 - IL_0034: brfalse.s IL_004a - - IL_0036: nop - .try - { - IL_0037: nop - IL_0038: ldloc.2 - IL_0039: ldnull - IL_003a: ldnull - IL_003b: callvirt instance object [mscorlib]System.Reflection.MethodBase::Invoke(object, object[]) - IL_0040: pop - IL_0041: nop - IL_0042: leave.s IL_0049 - - } // end .try - catch [mscorlib]System.Exception - { - IL_0044: pop - IL_0045: nop - IL_0046: nop - IL_0047: leave.s IL_0049 - - } // end handler - IL_0049: nop - IL_004a: nop - IL_004b: ret - } -} diff --git a/eng/WpfArcadeSdk/tools/InjectModuleInitializer/MsCorLibAssemblySection.il b/eng/WpfArcadeSdk/tools/InjectModuleInitializer/MsCorLibAssemblySection.il deleted file mode 100644 index b159214ce12..00000000000 --- a/eng/WpfArcadeSdk/tools/InjectModuleInitializer/MsCorLibAssemblySection.il +++ /dev/null @@ -1,5 +0,0 @@ -.assembly extern mscorlib -{ - .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) - .ver 4:0:0:0 -}; diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/CreateTemporaryTargetAssemblyProject.cs b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/CreateTemporaryTargetAssemblyProject.cs deleted file mode 100644 index 3e2e95ac121..00000000000 --- a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/CreateTemporaryTargetAssemblyProject.cs +++ /dev/null @@ -1,414 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.IO; -using System.Collections; -using System.Collections.Generic; - -using System.Globalization; -using System.Diagnostics; -using System.Reflection; -using System.Resources; -using System.Xml; - -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using MS.Utility; -using MS.Internal.Tasks; - -// Since we disable PreSharp warnings in this file, PreSharp warning is unknown to C# compiler. -// We first need to disable warnings about unknown message numbers and unknown pragmas. -#pragma warning disable 1634, 1691 - -namespace Microsoft.Build.Tasks.Windows -{ - /// - /// This task is used to generate a temporary target assembly project. - /// - /// The generated project file is based on current project file, with below - /// modification: - /// - /// A: Add the generated code files (.g.cs) to Compile Item list. - /// B: Replace Reference Item list with ReferencePath item list. - /// So that it doesn't need to rerun time-consuming task - /// ResolveAssemblyReference (RAR) again. - /// - /// - public sealed class CreateTemporaryTargetAssemblyProject : Task - { - /// - /// Constructor - /// - public CreateTemporaryTargetAssemblyProject() - : base(SR.SharedResourceManager) - { - } - - /// - /// ITask Execute method - /// - /// - /// Catching all exceptions in this method is appropriate - it will allow the build process to resume if possible after logging errors - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] - public override bool Execute() - { - bool retValue = true; - - // Verification - try - { - // Create a random file name - // This can fix the problem of project cache in VS.NET environment. - // - // GetRandomFileName( ) could return any possible file name and extension - // Since this temporary file will be used to represent an MSBUILD project file, - // we will use the same extension as that of the current project file - // - string currentProjectName = Path.GetFileNameWithoutExtension(CurrentProject); - string currentProjectExtension = Path.GetExtension(CurrentProject); - - string randomFileName = Path.GetFileNameWithoutExtension(Path.GetRandomFileName()); - string tempProjPrefix = string.Join("_", currentProjectName, randomFileName, WPFTMP); - TemporaryTargetAssemblyProjectName = tempProjPrefix + currentProjectExtension; - - XmlDocument xmlProjectDoc = null; - - xmlProjectDoc = new XmlDocument( ); - xmlProjectDoc.Load(CurrentProject); - - // remove all the WinFX specific item lists - // ApplicationDefinition, Page, MarkupResource and Resource - RemoveItemsByName(xmlProjectDoc, APPDEFNAME); - RemoveItemsByName(xmlProjectDoc, PAGENAME); - RemoveItemsByName(xmlProjectDoc, MARKUPRESOURCENAME); - RemoveItemsByName(xmlProjectDoc, RESOURCENAME); - - // Add properties required for temporary assembly compilation - var properties = new List<(string PropertyName, string PropertyValue)> - { - ( nameof(AssemblyName), AssemblyName ), - ( nameof(IntermediateOutputPath), IntermediateOutputPath ), - ( "AppendTargetFrameworkToOutputPath", "false"), - ( "_TargetAssemblyProjectName", Path.GetFileNameWithoutExtension(CurrentProject)), - ( nameof(MSBuildProjectExtensionsPath), MSBuildProjectExtensionsPath), - ( nameof(Analyzers), Analyzers) - }; - - AddNewProperties(xmlProjectDoc, properties); - - // Replace the Reference Item list with ReferencePath - RemoveItemsByName(xmlProjectDoc, REFERENCETYPENAME); - AddNewItems(xmlProjectDoc, ReferencePathTypeName, ReferencePath); - - // Add GeneratedCodeFiles to Compile item list. - AddNewItems(xmlProjectDoc, CompileTypeName, GeneratedCodeFiles); - - // Save the xmlDocument content into the temporary project file. - xmlProjectDoc.Save(TemporaryTargetAssemblyProjectName); - } - catch (Exception e) - { - Log.LogErrorFromException(e); - retValue = false; - } - - return retValue; - } - - /// - /// CurrentProject - /// The full path of current project file. - /// - [Required] - public string CurrentProject - { get; set; } - - /// - /// GeneratedCodeFiles - /// A list of generated code files, it could be empty. - /// The list will be added to the Compile item list in new generated project file. - /// - public ITaskItem[] GeneratedCodeFiles - { get; set; } - - /// - /// CompileTypeName - /// The appropriate item name which can be accepted by managed compiler task. - /// It is "Compile" for now. - /// - /// Adding this property is to make the type name configurable, if it is changed, - /// No code is required to change in this task, but set a new type name in project file. - /// - [Required] - public string CompileTypeName - { get; set; } - - /// - /// ReferencePath - /// A list of resolved reference assemblies. - /// The list will replace the original Reference item list in generated project file. - /// - public ITaskItem[] ReferencePath - { get; set; } - - /// - /// ReferencePathTypeName - /// The appropriate item name which is used to keep the Reference list in managed compiler task. - /// It is "ReferencePath" for now. - /// - /// Adding this property is to make the type name configurable, if it is changed, - /// No code is required to change in this task, but set a new type name in project file. - /// - [Required] - public string ReferencePathTypeName - { get; set; } - - /// - /// IntermediateOutputPath - /// - /// The value which is set to IntermediateOutputPath property in current project file. - /// - /// Passing this value explicitly is to make sure to generate temporary target assembly - /// in expected directory. - /// - [Required] - public string IntermediateOutputPath - { get; set; } - - /// - /// AssemblyName - /// - /// The value which is set to AssemblyName property in current project file. - /// Passing this value explicitly is to make sure to generate the expected - /// temporary target assembly. - /// - /// - [Required] - public string AssemblyName - { get; set; } - - /// - /// MSBuildProjectExtensionsPath - /// - /// Required for NuGet PackageReferences (*.nuget.g.props/targets, project.assets, etc.) - /// - /// - [Required] - public string MSBuildProjectExtensionsPath - { get; set; } - - /// - /// Analyzers - /// - /// Required for Source Generator support. May be null. - /// - /// - public string Analyzers - { get; set; } - - [Output] - public string TemporaryTargetAssemblyProjectName - { get; set; } - - // - // Remove specific items from project file. Every item should be under an ItemGroup. - // - private void RemoveItemsByName(XmlDocument xmlProjectDoc, string sItemName) - { - if (xmlProjectDoc == null || String.IsNullOrEmpty(sItemName)) - { - // When the parameters are not valid, simply return it, instead of throwing exceptions. - return; - } - - // - // The project file format is always like below: - // - // - // - // ...... - // - // - // ... - // - // - // .... - // - // - // .... - // - // ... - // - // - // ... - // - // - // - // - // The order of children nodes under Project Root element is random - // - - XmlNode root = xmlProjectDoc.DocumentElement; - - if (root.HasChildNodes == false) - { - // If there is no child element in this project file, just return immediatelly. - return; - } - - for (int i = 0; i < root.ChildNodes.Count; i++) - { - XmlElement nodeGroup = root.ChildNodes[i] as XmlElement; - - if (nodeGroup != null && String.Compare(nodeGroup.Name, ITEMGROUP_NAME, StringComparison.OrdinalIgnoreCase) == 0) - { - // - // This is ItemGroup element. - // - if (nodeGroup.HasChildNodes) - { - List itemToRemove = new List(); - - for (int j = 0; j < nodeGroup.ChildNodes.Count; j++) - { - XmlElement nodeItem = nodeGroup.ChildNodes[j] as XmlElement; - - if (nodeItem != null && String.Compare(nodeItem.Name, sItemName, StringComparison.OrdinalIgnoreCase) == 0) - { - // This is the item that need to remove. - // Add it into the temporary array list. - // Don't delete it here, since it would affect the ChildNodes of parent element. - // - itemToRemove.Add(nodeItem); - } - } - - // - // Now it is the right time to delete the elements. - // - if (itemToRemove.Count > 0) - { - foreach (XmlElement item in itemToRemove) - { - // Remove this item from its parent node. - // the parent node should be nodeGroup. - nodeGroup.RemoveChild(item); - } - } - } - - // - // Removed all the items with given name from this item group. - // - // Continue the loop for the next ItemGroup. - } - - } // end of "for i" statement. - - } - - // - // Add a list of files into an Item in the project file, the ItemName is specified by sItemName. - // - private void AddNewItems(XmlDocument xmlProjectDoc, string sItemName, ITaskItem[] pItemList) - { - if (xmlProjectDoc == null || String.IsNullOrEmpty(sItemName) || pItemList == null) - { - // When the parameters are not valid, simply return it, instead of throwing exceptions. - return; - } - - XmlNode root = xmlProjectDoc.DocumentElement; - - // Create a new ItemGroup element - XmlNode nodeItemGroup = xmlProjectDoc.CreateElement(ITEMGROUP_NAME, root.NamespaceURI); - - // Append this new ItemGroup item into the list of children of the document root. - root.AppendChild(nodeItemGroup); - - XmlElement embedItem = null; - - for (int i = 0; i < pItemList.Length; i++) - { - // Create an element for the given sItemName - XmlElement nodeItem = xmlProjectDoc.CreateElement(sItemName, root.NamespaceURI); - - // Create an Attribute "Include" - XmlAttribute attrInclude = xmlProjectDoc.CreateAttribute(INCLUDE_ATTR_NAME); - - ITaskItem pItem = pItemList[i]; - - // Set the value for Include attribute. - attrInclude.Value = pItem.ItemSpec; - - // Add the attribute to current item node. - nodeItem.SetAttributeNode(attrInclude); - - if (TRUE == pItem.GetMetadata(EMBEDINTEROPTYPES)) - { - embedItem = xmlProjectDoc.CreateElement(EMBEDINTEROPTYPES, root.NamespaceURI); - embedItem.InnerText = TRUE; - nodeItem.AppendChild(embedItem); - } - - string aliases = pItem.GetMetadata(ALIASES); - if (!String.IsNullOrEmpty(aliases)) - { - embedItem = xmlProjectDoc.CreateElement(ALIASES, root.NamespaceURI); - embedItem.InnerText = aliases; - nodeItem.AppendChild(embedItem); - } - - // Add current item node into the children list of ItemGroup - nodeItemGroup.AppendChild(nodeItem); - } - } - - private void AddNewProperties(XmlDocument xmlProjectDoc, List<(string PropertyName, string PropertyValue)> properties ) - { - if (xmlProjectDoc == null || properties == null ) - { - // When the parameters are not valid, simply return it, instead of throwing exceptions. - return; - } - - XmlNode root = xmlProjectDoc.DocumentElement; - - // Create a new ItemGroup element - XmlNode nodeItemGroup = xmlProjectDoc.CreateElement("PropertyGroup", root.NamespaceURI); - root.InsertAfter(nodeItemGroup, root.FirstChild); - - // Append this new ItemGroup item into the list of children of the document root. - foreach(var property in properties) - { - // Skip empty properties - if (!string.IsNullOrEmpty(property.PropertyValue)) - { - // Create an element for the given propertyName - XmlElement nodeItem = xmlProjectDoc.CreateElement(property.PropertyName, root.NamespaceURI); - nodeItem.InnerText = property.PropertyValue; - - // Add current item node into the PropertyGroup - nodeItemGroup.AppendChild(nodeItem); - } - } - - } - - private const string ALIASES = "Aliases"; - private const string REFERENCETYPENAME = "Reference"; - private const string EMBEDINTEROPTYPES = "EmbedInteropTypes"; - private const string APPDEFNAME = "ApplicationDefinition"; - private const string PAGENAME = "Page"; - private const string MARKUPRESOURCENAME = "MarkupResource"; - private const string RESOURCENAME = "Resource"; - - private const string ITEMGROUP_NAME = "ItemGroup"; - private const string INCLUDE_ATTR_NAME = "Include"; - - private const string TRUE = "True"; - private const string WPFTMP = "wpftmp"; - } -} diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/GenerateTemporaryTargetAssembly.cs b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/GenerateTemporaryTargetAssembly.cs index 69da007addb..e77e6a6efa4 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/GenerateTemporaryTargetAssembly.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/GenerateTemporaryTargetAssembly.cs @@ -271,8 +271,8 @@ private bool ExecuteGenerateTemporaryTargetAssemblyWithPackageReferenceSupport() ( nameof(AssemblyName), AssemblyName ), ( nameof(IntermediateOutputPath), IntermediateOutputPath ), ( nameof(BaseIntermediateOutputPath), BaseIntermediateOutputPath ), - ( nameof(MSBuildProjectExtensionsPath), MSBuildProjectExtensionsPath), - ( "_TargetAssemblyProjectName", Path.GetFileNameWithoutExtension(CurrentProject)), + ( nameof(MSBuildProjectExtensionsPath), MSBuildProjectExtensionsPath ), + ( "_TargetAssemblyProjectName", Path.GetFileNameWithoutExtension(CurrentProject) ), ( nameof(Analyzers), Analyzers ) }; diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/GenerateTemporaryTargetAssembly2.cs b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/GenerateTemporaryTargetAssembly2.cs deleted file mode 100644 index c9d09c3e89b..00000000000 --- a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/GenerateTemporaryTargetAssembly2.cs +++ /dev/null @@ -1,332 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -//--------------------------------------------------------------------------- -// -// Description: This is a MSBuild task which generates a temporary target assembly -// if current project contains a xaml file with local-type-reference. -// -// It generates a temporary project file and then call build-engine -// to compile it. -// -// The new project file will replace all the Reference Items with the -// resolved ReferencePath, add all the generated code file into Compile -// Item list. -// -//--------------------------------------------------------------------------- - -using System; -using System.IO; -using System.Collections; - -using System.Globalization; -using System.Diagnostics; -using System.Reflection; -using System.Resources; -using System.Xml; - -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -using MS.Utility; -using MS.Internal.Tasks; - -// Since we disable PreSharp warnings in this file, PreSharp warning is unknown to C# compiler. -// We first need to disable warnings about unknown message numbers and unknown pragmas. -#pragma warning disable 1634, 1691 - -namespace Microsoft.Build.Tasks.Windows -{ - #region GenerateTemporaryTargetAssembly2 Task class - - /// - /// This task is used to generate a temporary target assembly. It generates - /// a temporary project file and then compile it. - /// - /// The generated project file is based on current project file, with below - /// modification: - /// - /// A: Add the generated code files (.g.cs) to Compile Item list. - /// B: Replace Reference Item list with ReferenctPath item list. - /// So that it doesn't need to rerun time-consuming task - /// ResolveAssemblyReference (RAR) again. - /// - /// - public sealed class GenerateTemporaryTargetAssembly2 : Task - { - //------------------------------------------------------ - // - // Constructors - // - //------------------------------------------------------ - - #region Constructors - - /// - /// Constructor - /// - public GenerateTemporaryTargetAssembly2() - : base(SR.SharedResourceManager) - { - } - - #endregion Constructors - - //------------------------------------------------------ - // - // Public Methods - // - //------------------------------------------------------ - - #region Public Methods - - /// - /// ITask Execute method - /// - /// - /// Catching all exceptions in this method is appropriate - it will allow the build process to resume if possible after logging errors - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] - public override bool Execute() - { - bool retValue = true; - - // Verification - try - { - retValue = BuildEngine.BuildProjectFile(TemporaryTargetAssemblyProjectName, new string[] { CompileTargetName }, null, null); - - // Delete the temporary project file and generated files unless diagnostic mode has been requested - if (!GenerateTemporaryTargetAssemblyDebuggingInformation) - { - try - { - File.Delete(TemporaryTargetAssemblyProjectName); - - DirectoryInfo intermediateOutputPath = new DirectoryInfo(IntermediateOutputPath); - foreach (FileInfo temporaryProjectFile in intermediateOutputPath.EnumerateFiles(string.Concat(Path.GetFileNameWithoutExtension(TemporaryTargetAssemblyProjectName), "*"))) - { - temporaryProjectFile.Delete(); - } - } - catch (IOException e) - { - // Failure to delete the file is a non fatal error - Log.LogWarningFromException(e); - } - } - } - catch (Exception e) - { - Log.LogErrorFromException(e); - retValue = false; - } - - return retValue; - } - - #endregion Public Methods - - //------------------------------------------------------ - // - // Public Properties - // - //------------------------------------------------------ - - #region Public Properties - - /// - /// TemporaryTargetAssemblyProjectName - /// The name of the randomly generated project name for the temporary assembly - /// - [Required] - public string TemporaryTargetAssemblyProjectName - { get; set; } - - /// - /// CurrentProject - /// The full path of current project file. - /// - [Required] - public string CurrentProject - { - get { return _currentProject; } - set { _currentProject = value; } - } - - /// - /// MSBuild Binary Path. - /// This is required for Project to work correctly. - /// - [Required] - public string MSBuildBinPath - { - get { return _msbuildBinPath; } - set { _msbuildBinPath = value; } - } - - /// - /// GeneratedCodeFiles - /// A list of generated code files, it could be empty. - /// The list will be added to the Compile item list in new generated project file. - /// - public ITaskItem[] GeneratedCodeFiles - { - get { return _generatedCodeFiles; } - set { _generatedCodeFiles = value; } - } - - /// - /// CompileTypeName - /// The appropriate item name which can be accepted by managed compiler task. - /// It is "Compile" for now. - /// - /// Adding this property is to make the type name configurable, if it is changed, - /// No code is required to change in this task, but set a new type name in project file. - /// - [Required] - public string CompileTypeName - { - get { return _compileTypeName; } - set { _compileTypeName = value; } - } - - - /// - /// ReferencePath - /// A list of resolved reference assemblies. - /// The list will replace the original Reference item list in generated project file. - /// - public ITaskItem[] ReferencePath - { - get { return _referencePath; } - set { _referencePath = value; } - } - - /// - /// ReferencePathTypeName - /// The appropriate item name which is used to keep the Reference list in managed compiler task. - /// It is "ReferencePath" for now. - /// - /// Adding this property is to make the type name configurable, if it is changed, - /// No code is required to change in this task, but set a new type name in project file. - /// - [Required] - public string ReferencePathTypeName - { - get { return _referencePathTypeName; } - set { _referencePathTypeName = value; } - } - - - /// - /// IntermediateOutputPath - /// - /// The value which is set to IntermediateOutputPath property in current project file. - /// - /// Passing this value explicitly is to make sure to generate temporary target assembly - /// in expected directory. - /// - [Required] - public string IntermediateOutputPath - { - get { return _intermediateOutputPath; } - set { _intermediateOutputPath = value; } - } - - /// - /// AssemblyName - /// - /// The value which is set to AssemblyName property in current project file. - /// Passing this value explicitly is to make sure to generate the expected - /// temporary target assembly. - /// - /// - [Required] - public string AssemblyName - { - get { return _assemblyName; } - set { _assemblyName = value; } - } - - /// - /// CompileTargetName - /// - /// The msbuild target name which is used to generate assembly from source code files. - /// Usually it is "CoreCompile" - /// - /// - [Required] - public string CompileTargetName - { - get { return _compileTargetName; } - set { _compileTargetName = value; } - } - - /// - /// Optional task parameter - /// - /// When true, debugging information is enabled for the - /// Task. At this time, the only debugging information that is generated consists of the temporary project that is - /// created to generate the temporary target assembly. This temporary project is normally deleted at the end of this - /// MSBUILD task; when is enable, this temporary project - /// will be retained for inspection by the developer. - /// - /// This is a diagnostic parameter, and it defaults to false. - /// - public bool GenerateTemporaryTargetAssemblyDebuggingInformation - { - get { return _generateTemporaryTargetAssemblyDebuggingInformation; } - set { _generateTemporaryTargetAssemblyDebuggingInformation = value; } - } - - #endregion Public Properties - - //------------------------------------------------------ - // - // Private Fields - // - //------------------------------------------------------ - - #region Private Fields - - private string _currentProject = String.Empty; - - private ITaskItem[] _generatedCodeFiles; - private ITaskItem[] _referencePath; - - private string _referencePathTypeName; - private string _compileTypeName; - - private string _msbuildBinPath; - - private string _intermediateOutputPath; - private string _assemblyName; - private string _compileTargetName; - private bool _generateTemporaryTargetAssemblyDebuggingInformation = false; - - private const string intermediateOutputPathPropertyName = "IntermediateOutputPath"; - private const string assemblyNamePropertyName = "AssemblyName"; - - private const string ALIASES = "Aliases"; - private const string REFERENCETYPENAME = "Reference"; - private const string EMBEDINTEROPTYPES = "EmbedInteropTypes"; - private const string APPDEFNAME = "ApplicationDefinition"; - private const string PAGENAME = "Page"; - private const string MARKUPRESOURCENAME = "MarkupResource"; - private const string RESOURCENAME = "Resource"; - - private const string ITEMGROUP_NAME = "ItemGroup"; - private const string INCLUDE_ATTR_NAME = "Include"; - - private const string TRUE = "True"; - private const string WPFTMP = "wpftmp"; - - private const string targetAssemblyProjectNamePropertyName = "_TargetAssemblyProjectName"; - - #endregion Private Fields - - } - - #endregion GenerateTemporaryTargetAssembly2 Task class -} diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/PresentationBuildTasks.csproj b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/PresentationBuildTasks.csproj index eeaf8b37079..2730e445a8b 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/PresentationBuildTasks.csproj +++ b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/PresentationBuildTasks.csproj @@ -300,8 +300,6 @@ - - diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/ModuleInitializer.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/ModuleInitializer.cs index aae7e047532..6644f8edb86 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/ModuleInitializer.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/ModuleInitializer.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Runtime.CompilerServices; internal static class ModuleInitializer { @@ -14,6 +15,7 @@ internal static class ModuleInitializer /// operations are carried out. To do this, we simply call LoadDwrite /// as the module constructor for DirectWriteForwarder would do this anyway. /// + [ModuleInitializer] public static void Initialize() { MS.Internal.NativeWPFDLLLoader.LoadDwrite(); diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/PresentationCore.csproj b/src/Microsoft.DotNet.Wpf/src/PresentationCore/PresentationCore.csproj index 2599aee8497..88cf61d2ade 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/PresentationCore.csproj +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/PresentationCore.csproj @@ -1,4 +1,4 @@ - + $(DefineConstants);CORE_NATIVEMETHODS;PRESENTATION_CORE;COMMONDPS @@ -9,7 +9,6 @@ MS.Internal.PresentationCore None AnyCPU;x64;arm64 - true From 83248bc6a9bdc5bc24ac28a9b1465f90f486aafe Mon Sep 17 00:00:00 2001 From: Ryland <41491307+ryalanms@users.noreply.github.com> Date: Fri, 23 Jul 2021 10:06:20 -0700 Subject: [PATCH 3/4] Remove ILTools from global.json and versions.props. --- eng/Versions.props | 1 - global.json | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 08b6322000a..41d5a8fc46d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -68,7 +68,6 @@ 5.28.1.1-1 0.0.0.1 - 0.0.0.1 diff --git a/global.json b/global.json index e4bbfcbadc3..d0761a56598 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,6 @@ "native-tools": { "strawberry-perl": "5.28.1.1-1", "net-framework-48-ref-assemblies": "0.0.0.1", - "dotnet-api-docs_net5.0": "0.0.0.3", - "net-framework-472-iltools": "0.0.0.1" + "dotnet-api-docs_net5.0": "0.0.0.3" } } From e02521e0c53196219edd81ef89762230ff754eeb Mon Sep 17 00:00:00 2001 From: Ryland <41491307+ryalanms@users.noreply.github.com> Date: Fri, 23 Jul 2021 16:53:54 -0700 Subject: [PATCH 4/4] Only set langversion to preview for previews and release candidates. Otherwise fix version to 10. --- eng/WpfArcadeSdk/Sdk/Sdk.props | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eng/WpfArcadeSdk/Sdk/Sdk.props b/eng/WpfArcadeSdk/Sdk/Sdk.props index 2c72d3fa24b..f4bd71bf1ef 100644 --- a/eng/WpfArcadeSdk/Sdk/Sdk.props +++ b/eng/WpfArcadeSdk/Sdk/Sdk.props @@ -14,7 +14,8 @@ $(WpfArcadeSdkToolsDir)GenXmlStringTable.pl - preview + preview + 10 true true