Skip to content
This repository has been archived by the owner on Nov 21, 2018. It is now read-only.

Add target to set default target manifest #31

Merged
merged 1 commit into from
Apr 18, 2017
Merged

Conversation

JunTaoLuo
Copy link
Contributor

#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.

<ResolvedRuntimeIdentifier Condition="'$(AspNetCoreTargetManifestRuntimeIdentifier)'=='' and '$(OS)'=='Unix'">linux-x64</ResolvedRuntimeIdentifier>
</PropertyGroup>

<Message
Copy link
Contributor Author

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>
Copy link
Contributor Author

@JunTaoLuo JunTaoLuo Apr 17, 2017

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.

Copy link
Contributor Author

@JunTaoLuo JunTaoLuo Apr 17, 2017

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>
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor

@natemcmaster natemcmaster left a 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)" />
Copy link
Contributor

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" />-->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: remove

@JunTaoLuo
Copy link
Contributor Author

🆙📅

Condition="'$(PublishWithAspNetCoreTargetManifest)'=='true' and '$(PublishableProject)'=='true'" >

<PropertyGroup>
<ManifestRuntimeIdentifier>$(AspNetCoreTargetManifestRuntimeIdentifier)</ManifestRuntimeIdentifier>
Copy link
Contributor

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)?

Copy link
Contributor Author

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">
Copy link
Contributor

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)'==''
Copy link
Contributor

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)'!=''" />
Copy link
Contributor

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.

Copy link
Contributor Author

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"
Copy link
Contributor

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>
Copy link
Contributor

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>
Copy link
Contributor

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)" />
Copy link
Contributor

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?

Copy link
Contributor Author

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>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing new line

@JunTaoLuo JunTaoLuo merged commit 87c513b into dev Apr 18, 2017
@JunTaoLuo JunTaoLuo deleted the johluo/publish-target branch June 7, 2017 18:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants