in src/Tasks/Microsoft.NET.Build.Tasks/GenerateShims.cs [72:117]
protected override void ExecuteCore()
{
var embeddedApphostPaths = new List<ITaskItem>();
foreach (var runtimeIdentifier in ShimRuntimeIdentifiers.Select(r => r.ItemSpec))
{
var resolvedApphostAssetPath = GetApphostAsset(ApphostsForShimRuntimeIdentifiers, runtimeIdentifier);
var packagedShimOutputDirectoryAndRid = Path.Combine(
PackagedShimOutputDirectory,
runtimeIdentifier);
var appHostDestinationFilePath = Path.Combine(
packagedShimOutputDirectoryAndRid,
ToolCommandName + ExecutableExtension.ForRuntimeIdentifier(runtimeIdentifier));
Directory.CreateDirectory(packagedShimOutputDirectoryAndRid);
// per https://github.com/dotnet/cli/issues/9870 nuget layout (as in {packageid}/{packageversion}/tools/)is normalized version
var normalizedPackageVersion = NuGetVersion.Parse(PackageVersion).ToNormalizedString();
// This is the embedded string. We should normalize it on forward slash, so the file won't be different according to
// build machine.
var appBinaryFilePath = string.Join("/",
new[] {
".store",
PackageId.ToLowerInvariant(),
normalizedPackageVersion,
PackageId.ToLowerInvariant(),
normalizedPackageVersion,
"tools",
NuGetUtils.ParseFrameworkName(TargetFrameworkMoniker).GetShortFolderName(),
"any",
ToolEntryPoint});
AppHost.Create(
resolvedApphostAssetPath,
appHostDestinationFilePath,
appBinaryFilePath
);
var item = new TaskItem(appHostDestinationFilePath);
item.SetMetadata(MetadataKeys.ShimRuntimeIdentifier, runtimeIdentifier);
embeddedApphostPaths.Add(item);
}
EmbeddedApphostPaths = embeddedApphostPaths.ToArray();
}