question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create targets and tasks for authoring a shared framework

See original GitHub issue

There are 3 different shared frameworks built by .NET teams - NETCore.App, AspNetCore.App, and WindowsDesktop.App. We share similar requirements and similar code. I think we should commonize these into a shared package to reduce the maintenance burden of building shared frameworks ‘the right way.’

Desired usage

Projects which need to author a framework can create two project files, one for the targeting pack and another for the runtime packs. Both projects use a custom MSBuild SDK, “Microsoft.NET.SharedFramework.Sdk” and set some well-known properties which will inform the custom SDK how to build a shared framework.

Requirements

  • Generate a shared framework (gather binaries into a single folder)
  • Generate a shared framework layout ($dotnet_root$/shared/$name$/$version$)
  • The SDK can generate the manifests which all shared frameworks are supposed to include
    • .deps.json
    • .runtimeconfig.json
    • PackageOverrides.txt
    • PlatformManifest.txt
  • The SDK can produce .nupkgs with the correct layout and content for
    • The ref pack
    • The runtime pack
  • The SDK can crossgen assemblies in the shared framework
    • By default, enabled only when Configuration == Release

Out of scope

  • Generalizing support for building msi/deb/rpm/zip/tgz installers and archives.
  • Generating the AppHost packages (out of scope for now)
  • FrameworkList.xml - spec for this still unclear

Project file API

Example usage for the runtime project

<Project Sdk="Microsoft.NET.SharedFramework.Sdk">
  <PropertyGroup>
     <!-- Required properties -->
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
    <SharedFrameworkName>Microsoft.Banana.App</SharedFrameworkName>
    <PlatformPackageType>RuntimePack</PlatformPackageType>
    
    <!--  This will be the default, but be overridden by the project file. -->
    <PackageId>Microsoft.Banana.App.Runtime.$(RuntimeIdentifier)</PackageId>
  </PropertyGroup>
  
  <ItemGroup>
    <FrameworkReference Include="Microsoft.NETCore.App" RuntimeFrameworkVersion="3.0.0" />
    
    <ProjectReference Include="..\..\MyAssembly1\MyAssembly1.csproj" />
    <ProjectReference Include="..\..\MyAssembly2\MyAssembly2.csproj" />
    
    <NativeRuntimeAsset Include="linux-x64/libmydep.so" Condition=" '$(RuntimeIdentifier)' == 'linux-x64' " />
  </ItemGroup>
  
</Project>

Example usage for the targeting pack project

<Project Sdk="Microsoft.NET.SharedFramework.Sdk">
  <PropertyGroup>
     <!-- Required properties -->
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <SharedFrameworkName>Microsoft.Banana.App</SharedFrameworkName>
    <PlatformPackageType>TargetingPack</PlatformPackageType>
    
    <!--  This will be the default, but be overridden by the project file. -->
    <PackageId>Microsoft.Banana.App.Ref</PackageId>
  </PropertyGroup>
  
  <ItemGroup>
    <ProjectReference Include="..\..\MyAssembly1\MyAssembly1.csproj" />
    <ProjectReference Include="..\..\MyAssembly2\MyAssembly2.csproj" />
    
    <!--  Optimization for assemblies that are provided in both a targeting pack and an OOB NuGet package.  -->
    <ProvidesPackage Include="MyAssembly1" Version="1.0.0" />
  </ItemGroup>
</Project>

cc @ericstj @dagood

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:27 (27 by maintainers)

github_iconTop GitHub Comments

1reaction
jkoritzinskycommented, May 28, 2020

I’ve started working on this, using lessons learned from the shared framework SDK used by dotnet/runtime and dotnet/windowsdesktop and the proposed UX in the start of this issue as a starting point.

1reaction
markwilkiecommented, Aug 30, 2019

Assigned this to you @dagood for whenver you get to it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating a Framework
Once you create your project, you simply add two targets to it: one for your application and one for your framework.
Read more >
Build your first SharePoint client-side web part (Hello World ...
Start the local web server & launch the hosted workbench. This command executes a series of gulp tasks to create and start a...
Read more >
User Stories | Examples and Template
User stories are development tasks often expressed as “persona + need + purpose.” ... A user story is the smallest unit of work...
Read more >
SMART Goals: A How to Guide
We've also created an easy-to-use S.M.A.R.T. goals template and worksheet to help you get started.
Read more >
60+ OKR Examples - How To Write Effective OKRs 2023
Looking for good OKR examples? This article covers over 60 practical OKRs, why they work, and tips for the writing process.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found