Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade to net6.0 version + add explicit apphost loading for specific platforms #224

Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samples/BuilderApp/BuilderApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net472;netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\MSBuildLocator\key.snk</AssemblyOriginatorKeyFile>
Expand Down
13 changes: 12 additions & 1 deletion src/MSBuildLocator/Microsoft.Build.Locator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net46;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net46;net6.0</TargetFrameworks>
<DebugType>full</DebugType>

<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
Expand All @@ -25,6 +25,11 @@
<PackageReference Include="Microsoft.VisualStudio.SDK.EmbedInteropTypes" Version="15.0.36" PrivateAssets="all" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net6.0'">
<!-- These package references help to resolve assemblies in runtime for platforms, where these are not loaded to AppContext by default (e.g MacOS). -->
<PackageReference Include="Microsoft.NETCore.DotNetAppHost" Version="7.0.9" />
Copy link
Member

Choose a reason for hiding this comment

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

MSBuildLocator targeting net6.0 suggests to me that we should be using the latest 6.0.x version of this package - how do consumers on different TFMs need to resolve this package? Is the DotNetAppHost package something that needs to be 'linked' to the final caller's TFM, so that net8.0 maps to 8.0 packages, net7.0 to 7.0.x packages, etc?

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 just wanted to avoid adding this package for Framework target.
Probably either @rainersigwald or @ladipro can answer these questions.

Copy link
Member

Choose a reason for hiding this comment

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

Presumably the latest hosting library works with older versions of the runtime, as I think for us it is a requirement to be able to locate a .NET 7 MSBuild using MSBuildLocator built against .NET 6. @vitek-karas, can you please confirm?

Copy link
Member

Choose a reason for hiding this comment

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

Thet nethost (which is the one thing used from this package) is definitely fully backward compatible. There's obviously no 100% forward compatibility forever, but in general we will try really hard to keep it forward compatible for as long as possible.
So in that sense, use the latest version of the package regardless of what TFM you target (just like it's a good idea to use the latest SDK to build your app regardless of the TFM) - and upgrade this often (once 8 ships, upgrade to that and so on).

</ItemGroup>

<ItemGroup>
<PackageReference Include="MicroBuild.Core" Version="0.3.0" PrivateAssets="all" />
<Content Include="build\Microsoft.Build.Locator.props">
Expand All @@ -34,6 +39,10 @@
<Content Include="build\Microsoft.Build.Locator.targets">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
<PackagePath>build\</PackagePath>
</Content>
<Content Include="build\TraverseRuntimeIdentifiers.targets">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
<PackagePath>build\</PackagePath>
</Content>
</ItemGroup>

Expand All @@ -43,4 +52,6 @@
</FilesToSign>
</ItemGroup>

<Import Project="..\..\src\MSBuildLocator\build\TraverseRuntimeIdentifiers.targets" />

</Project>
31 changes: 31 additions & 0 deletions src/MSBuildLocator/build/TraverseRuntimeIdentifiers.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="TraverseRuntimeIdentifiers" AfterTargets="Restore">
<PropertyGroup>
<RuntimeIdentifiers>
YuliiaKovalova marked this conversation as resolved.
Show resolved Hide resolved
linux-x64;
linux-musl-x64;
linux-arm;
linux-arm64;
linux-bionic-arm64;
linux-musl-arm64;
linux-musl-arm;
linux-bionic-x64;
osx-x64;
osx-arm64
</RuntimeIdentifiers>
</PropertyGroup>

<PropertyGroup>
<RuntimeIdentifierArray>$(RuntimeIdentifiers.Split(';'))</RuntimeIdentifierArray>
</PropertyGroup>

<ItemGroup>
<CurrentRuntimeIdentifier Include="$(RuntimeIdentifierArray)" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="runtime.%(CurrentRuntimeIdentifier.Identity).Microsoft.NETCore.DotNetAppHost" Version="7.0.9" />
YuliiaKovalova marked this conversation as resolved.
Show resolved Hide resolved
</ItemGroup>

</Target>
</Project>
Loading