|
| 1 | +<?xml version="1.0" encoding="utf-8"?> |
| 2 | +<!-- |
| 3 | +*********************************************************************************************** |
| 4 | +Microsoft.NET.Sdk.IL.targets |
| 5 | +
|
| 6 | +WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have |
| 7 | + created a backup copy. Incorrect changes to this file will make it |
| 8 | + impossible to load or build your projects from the command-line or the IDE. |
| 9 | +
|
| 10 | +Copyright (c) .NET Foundation. All rights reserved. |
| 11 | +*********************************************************************************************** |
| 12 | +--> |
| 13 | +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| 14 | + |
| 15 | + <PropertyGroup> |
| 16 | + <MSBuildAllProjects>$(MSBuildThisFileFullPath);$(MSBuildAllProjects)</MSBuildAllProjects> |
| 17 | + <DefaultLanguageSourceExtension>.il</DefaultLanguageSourceExtension> |
| 18 | + <Language>IL</Language> |
| 19 | + <TargetRuntime>Managed</TargetRuntime> |
| 20 | + </PropertyGroup> |
| 21 | + |
| 22 | + <PropertyGroup> |
| 23 | + <_OSPlatform Condition="$([MSBuild]::IsOSPlatform('windows'))">win</_OSPlatform> |
| 24 | + <_OSPlatform Condition="$([MSBuild]::IsOSPlatform('linux'))">linux</_OSPlatform> |
| 25 | + <_OSPlatform Condition="$([MSBuild]::IsOSPlatform('osx'))">osx</_OSPlatform> |
| 26 | + <_OSArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)</_OSArchitecture> |
| 27 | + |
| 28 | + <MicrosoftNetCoreIlasmPackageRuntimeId Condition="'$(MicrosoftNetCoreIlasmPackageRuntimeId)' == ''">$(_OSPlatform)-$(_OSArchitecture.ToLower())</MicrosoftNetCoreIlasmPackageRuntimeId> |
| 29 | + <MicrosoftNetCoreIlasmPackageVersion Condition="'$(MicrosoftNetCoreIlasmPackageVersion)' == ''">3.0.0</MicrosoftNetCoreIlasmPackageVersion> |
| 30 | + <MicrosoftNetCoreIlasmPackageName>runtime.$(MicrosoftNetCoreIlasmPackageRuntimeId).microsoft.netcore.ilasm</MicrosoftNetCoreIlasmPackageName> |
| 31 | + <MicrosoftNetCoreRuntimeCoreClrPackageName>runtime.$(MicrosoftNetCoreIlasmPackageRuntimeId).microsoft.netcore.runtime.coreclr</MicrosoftNetCoreRuntimeCoreClrPackageName> |
| 32 | + |
| 33 | + <ToolsDir Condition="'$(ToolsDir)' == ''">$([System.IO.Path]::Combine($([System.IO.Path]::GetTempPath()), $([System.IO.Path]::GetRandomFileName())))</ToolsDir> |
| 34 | + </PropertyGroup> |
| 35 | + |
| 36 | + <ItemGroup> |
| 37 | + <PackageReference Include="$(MicrosoftNetCoreIlasmPackageName)" Version="$(MicrosoftNetCoreIlasmPackageVersion)" PrivateAssets="all" IsImplicitlyDefined="true" /> |
| 38 | + <PackageReference Include="$(MicrosoftNetCoreRuntimeCoreClrPackageName)" Version="$(MicrosoftNetCoreIlasmPackageVersion)" PrivateAssets="all" IsImplicitlyDefined="true" /> |
| 39 | + </ItemGroup> |
| 40 | + |
| 41 | + <PropertyGroup> |
| 42 | + <CreateManifestResourceNamesDependsOn></CreateManifestResourceNamesDependsOn> |
| 43 | + </PropertyGroup> |
| 44 | + |
| 45 | + <Target Name="CreateManifestResourceNames" |
| 46 | + Condition="'@(EmbeddedResource)' != ''" |
| 47 | + DependsOnTargets="$(CreateManifestResourceNamesDependsOn)"> |
| 48 | + <!-- Required by Microsoft.Common.targets --> |
| 49 | + </Target> |
| 50 | + |
| 51 | + <Target Name="CoreCompile" |
| 52 | + Inputs="$(MSBuildAllProjects); |
| 53 | + @(Compile)" |
| 54 | + Outputs="@(IntermediateAssembly)" |
| 55 | + Returns="" |
| 56 | + DependsOnTargets="$(CoreCompileDependsOn)"> |
| 57 | + <ItemGroup> |
| 58 | + <_IlasmSourceFiles Include="$(NuGetPackageRoot)\$(MicrosoftNetCoreIlasmPackageName)\$(MicrosoftNetCoreIlasmPackageVersion)\runtimes\$(MicrosoftNetCoreIlasmPackageRuntimeId)\native\**\*" /> |
| 59 | + <_IlasmSourceFiles Include="$(NuGetPackageRoot)\$(MicrosoftNetCoreRuntimeCoreClrPackageName)\$(MicrosoftNetCoreIlasmPackageVersion)\runtimes\$(MicrosoftNetCoreIlasmPackageRuntimeId)\native\**\*" /> |
| 60 | + </ItemGroup> |
| 61 | + |
| 62 | + <PropertyGroup> |
| 63 | + <_IlasmDir>$(ToolsDir)\ilasm</_IlasmDir> |
| 64 | + |
| 65 | + <_OutputTypeArgument Condition="'$(OutputType)' == 'Library'">-DLL</_OutputTypeArgument> |
| 66 | + <_OutputTypeArgument Condition="'$(OutputType)' == 'Exe'">-EXE</_OutputTypeArgument> |
| 67 | + |
| 68 | + <_KeyFileArgument Condition="'$(KeyOriginatorFile)' != ''">-KEY=$(KeyOriginatorFile)</_KeyFileArgument> |
| 69 | + |
| 70 | + <_IlasmSwitches>-QUIET -NOLOGO</_IlasmSwitches> |
| 71 | + <_IlasmSwitches Condition="'$(FoldIdenticalMethods)' == 'True'">$(_IlasmSwitches) -FOLD</_IlasmSwitches> |
| 72 | + <_IlasmSwitches Condition="'$(SizeOfStackReserve)' != ''">$(_IlasmSwitches) -STACK=$(SizeOfStackReserve)</_IlasmSwitches> |
| 73 | + <_IlasmSwitches Condition="'$(DebugType)' == 'Full'">$(_IlasmSwitches) -DEBUG</_IlasmSwitches> |
| 74 | + <_IlasmSwitches Condition="'$(DebugType)' == 'Impl'">$(_IlasmSwitches) -DEBUG=IMPL</_IlasmSwitches> |
| 75 | + <_IlasmSwitches Condition="'$(DebugType)' == 'PdbOnly'">$(_IlasmSwitches) -DEBUG=OPT</_IlasmSwitches> |
| 76 | + <_IlasmSwitches Condition="'$(Optimize)' == 'True'">$(_IlasmSwitches) -OPTIMIZE</_IlasmSwitches> |
| 77 | + </PropertyGroup> |
| 78 | + |
| 79 | + <!-- Having to copy these binaries is really inefficient. https://github.com/dotnet/coreclr/issues/18892 tracks making the ilasm tool self-contained --> |
| 80 | + <MakeDir Directories="$(_IlasmDir)" /> |
| 81 | + <Copy DestinationFolder="$(_IlasmDir)" SourceFiles="@(_IlasmSourceFiles)" /> |
| 82 | + |
| 83 | + <Exec Command="$(_IlasmDir)\ilasm $(_IlasmSwitches) $(_OutputTypeArgument) $(IlasmFlags) -OUTPUT=@(IntermediateAssembly) $(_KeyFileArgument) @(Compile, ' ')"> |
| 84 | + <Output TaskParameter="ExitCode" PropertyName="_ILAsmExitCode" /> |
| 85 | + </Exec> |
| 86 | + |
| 87 | + <Error Text="ILAsm failed" Condition="'$(_ILAsmExitCode)' != '0'" /> |
| 88 | + |
| 89 | + <CallTarget Targets="$(TargetsTriggeredByCompilation)" Condition="'$(TargetsTriggeredByCompilation)' != ''"/> |
| 90 | + </Target> |
| 91 | + |
| 92 | + <Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" /> |
| 93 | + |
| 94 | +</Project> |
0 commit comments