Skip to content

Commit

Permalink
Resolve RuntimeFrameworkVersion from version of Microsoft.NETCore.App…
Browse files Browse the repository at this point in the history
…, not TFM

Workaround dotnet/sdk#686

Also, fix casing of the serviceable assembly attribute
  • Loading branch information
DotDeveloper95 committed Jan 19, 2017
1 parent 4b56eca commit f53b7c0
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Generates assembly attributes for ASP.NET Core binaries
<_InternalAspNetCoreAttributes Remove="@(_InternalAspNetCoreAttributes)" />
<_InternalAspNetCoreAttributes Include="System.Reflection.AssemblyMetadata" Condition="'$(Serviceable)'!='false'">
<_Parameter1>Serviceable</_Parameter1>
<_Parameter2>true</_Parameter2>
<_Parameter2>True</_Parameter2>
</_InternalAspNetCoreAttributes>
<!-- TODO embed commit hash -->
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ for use outside of Microsoft.
<Project ToolsVersion="15.0">
<Import Project="$(MSBuildThisFileDirectory)..\targets\BuildNumber.targets" />
<Import Project="$(MSBuildThisFileDirectory)GenerateAssemblyInfo.targets" />
<Import Project="$(MSBuildThisFileDirectory)Workarounds.targets" />
</Project>
35 changes: 35 additions & 0 deletions src/Internal.AspNetCore.Sdk/build/Workarounds.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!--
WARNING: These targets are intended for building Microsoft's ASP.NET Core repos, and is not intended
for use outside of Microsoft.
This file is dedicated to working around issues in Microsoft.NET.Sdk
-->
<Project ToolsVersion="15.0">
<!-- workaround https://github.com/dotnet/sdk/issues/686 -->
<Target Name="SetRuntimeFrameworkVersionToPackageVersion"
Condition="'$(OutputType)'=='Exe' AND '$(TargetFrameworkIdentifier)'=='.NETCoreApp'"
DependsOnTargets="_DefaultMicrosoftNETPlatformLibrary"
BeforeTargets="GenerateBuildRuntimeConfigurationFiles">

<ResolvePackageDependencies
ProjectPath="$(MSBuildProjectFullPath)"
ProjectAssetsFile="$(ProjectAssetsFile)"
ProjectLanguage="$(Language)">

<Output TaskParameter="PackageDefinitions" ItemName="_PackageDefinitions" />
</ResolvePackageDependencies>

<ItemGroup>
<_FilteredDefinitions Remove="@(_FilteredDefinitions)" />
<_FilteredDefinitions Include="@(_PackageDefinitions)" Condition="'%(_PackageDefinitions.Name)'=='$(MicrosoftNETPlatformLibrary)'" />
</ItemGroup>

<PropertyGroup Condition="'@(_FilteredDefinitions->Count())' == 1">
<_ResolvedNetCoreAppVersion>@(_FilteredDefinitions -> '%(Version)')</_ResolvedNetCoreAppVersion>
<RuntimeFrameworkVersion Condition="'$(_ResolvedNetCoreAppVersion)'!=''">$(_ResolvedNetCoreAppVersion)</RuntimeFrameworkVersion>
</PropertyGroup>

<Message Importance="normal" Text="[$(TargetFramework)] resolved RuntimeFrameworkVersion to '$(RuntimeFrameworkVersion)'" />
</Target>
<!-- end workaround -->
</Project>
24 changes: 0 additions & 24 deletions src/Microsoft.AspNetCore.BuildTools.ApiCheck/project.json

This file was deleted.

0 comments on commit f53b7c0

Please sign in to comment.