-
Notifications
You must be signed in to change notification settings - Fork 109
Add target to set default target manifest #31
Conversation
<ResolvedRuntimeIdentifier Condition="'$(AspNetCoreTargetManifestRuntimeIdentifier)'=='' and '$(OS)'=='Unix'">linux-x64</ResolvedRuntimeIdentifier> | ||
</PropertyGroup> | ||
|
||
<Message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this.
|
||
<PropertyGroup> | ||
<ResolvedRuntimeIdentifier>$(AspNetCoreTargetManifestRuntimeIdentifier)</ResolvedRuntimeIdentifier> | ||
<ResolvedRuntimeIdentifier Condition="'$(AspNetCoreTargetManifestRuntimeIdentifier)'=='' and '$(OS)'=='Windows_NT' and '$(Platform)'!='x86'">win7-x64</ResolvedRuntimeIdentifier> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Platform can be: x86, x64 and AnyCPU. Not sure if this works as expected and I'll test on an actual 32bit windows machine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't quite work, Platform defaults to AnyCPU regardless whether the os is x86 or x64, but PlatformTarget seems to be correct.
<ResolvedRuntimeIdentifier>$(AspNetCoreTargetManifestRuntimeIdentifier)</ResolvedRuntimeIdentifier> | ||
<ResolvedRuntimeIdentifier Condition="'$(AspNetCoreTargetManifestRuntimeIdentifier)'=='' and '$(OS)'=='Windows_NT' and '$(Platform)'!='x86'">win7-x64</ResolvedRuntimeIdentifier> | ||
<ResolvedRuntimeIdentifier Condition="'$(AspNetCoreTargetManifestRuntimeIdentifier)'=='' and '$(OS)'=='Windows_NT' and '$(Platform)'=='x86'">win7-x86</ResolvedRuntimeIdentifier> | ||
<ResolvedRuntimeIdentifier Condition="'$(AspNetCoreTargetManifestRuntimeIdentifier)'=='' and '$(OS)'=='OSX'">osx.10.12-x64</ResolvedRuntimeIdentifier> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On macOS, $(OS) == 'Unix'
😢 . Instead,
$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))
cref dotnet/msbuild#1926
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't aware that we had access to RuntimeInformation, that makes things a lot easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only in MSBuild 15.3. dotnet-CLI 1.0.0 has MSBuild 15.1. Using it will require users to upgrade VS and dotnet-CLI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple nits
@@ -147,4 +147,9 @@ | |||
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="$(AspNetCoreVersion)" PrivateAssets="None" Condition="'$(BUILD_PACKAGE_CACHE)' == 'true'" /> | |||
</ItemGroup> | |||
|
|||
<ItemGroup> | |||
<Content Include="build\**\*.xml" Pack="true" PackagePath="%(Identity)" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Pack="true" is default for Content
@@ -0,0 +1,42 @@ | |||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
|
|||
<!--<Import Project="Microsoft.NET.RuntimeIdentifierInference.targets" />--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: remove
🆙📅 |
Condition="'$(PublishWithAspNetCoreTargetManifest)'=='true' and '$(PublishableProject)'=='true'" > | ||
|
||
<PropertyGroup> | ||
<ManifestRuntimeIdentifier>$(AspNetCoreTargetManifestRuntimeIdentifier)</ManifestRuntimeIdentifier> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also pick up $(RuntimeIdentifier)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit trickier to pick up RuntimeIdentifier
. We will eventually generate runtime package store for win-x64, win-x86, osx-x64, linux-x64
only. We can use the RuntimeIdentifier
for cross-publishing scenarios but that would require logic to potentially resolve ubuntu.16.04-x64
to linux-x64
.
@@ -0,0 +1,49 @@ | |||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the xmlns
?
|
||
<PropertyGroup> | ||
<ManifestRuntimeIdentifier>$(AspNetCoreTargetManifestRuntimeIdentifier)</ManifestRuntimeIdentifier> | ||
<ManifestRuntimeIdentifier Condition="'$(AspNetCoreTargetManifestRuntimeIdentifier)'=='' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we declare this in a separate propertygroup so we shouldn't have to repeat '$(AspNetCoreTargetManifestRuntimeIdentifier)'==''
?
<Message | ||
Text="Appending default ASP.NET Core runtime package store manifest for use during publish based for the runtime $(ManifestRuntimeIdentifier)." | ||
Importance="normal" | ||
Condition="'$(ManifestRuntimeIdentifier)'!=''" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't need the condition. The Error
should handle this for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't sure if it should be an error. If we couldn't resolve the manifest, maybe we should just give a warning and publish without manifest.
|
||
<Message | ||
Text="Appending default ASP.NET Core runtime package store manifest for use during publish based for the runtime $(ManifestRuntimeIdentifier)." | ||
Importance="normal" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Low
? Is this a useful piece of information for most folks to know?
Condition="'$(ManifestRuntimeIdentifier)'!=''" /> | ||
|
||
<PropertyGroup> | ||
<TargetManifest Condition="'$(ManifestRuntimeIdentifier)'!=''">$(TargetManifest);$(MSBuildThisFileDirectory)manifest.$(ManifestRuntimeIdentifier).xml</TargetManifest> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need the condition
<TargetManifest Condition="'$(ManifestRuntimeIdentifier)'!=''">$(TargetManifest);$(MSBuildThisFileDirectory)manifest.$(ManifestRuntimeIdentifier).xml</TargetManifest> | ||
</PropertyGroup> | ||
</Target> | ||
</Project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing newline
@@ -147,4 +147,9 @@ | |||
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="$(AspNetCoreVersion)" PrivateAssets="None" Condition="'$(BUILD_PACKAGE_CACHE)' == 'true'" /> | |||
</ItemGroup> | |||
|
|||
<ItemGroup> | |||
<Content Include="build\**\*.xml" PackagePath="%(Identity)" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Package="true"
and remove PackagePath
. Also, what's the xml file that's being added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will be adding the manifests. This has to be done in Coherence-PackageCache though since that's when we actually generate the runtime store.
@@ -0,0 +1,3 @@ | |||
<Project> | |||
<Import Project="$(MSBuildThisFileDirectory)..\PublishWithAspNetCoreTargetManifest.targets" /> | |||
</Project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing new line
7664b8b
to
3c4ecd9
Compare
3c4ecd9
to
87c513b
Compare
#20
Adding this target to set target manifest used before publish based on the current OS and Platform. The actual manifest.RID.xml will be added to this package during the build when it's generated by dotnet store. For cross-publish scenarios,
AspNetCoreTargetManifestRuntimeIdentifier
can be set in the project.PublishWithAspNetCoreTargetManifest
can be set to false to publish without manifest.