Skip to content

Instantly share code, notes, and snippets.

View davidfowl's full-sized avatar

David Fowler davidfowl

View GitHub Profile
@davidfowl
davidfowl / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@davidfowl
davidfowl / gist:0fc85f3215adf4eab294
Created May 19, 2015 06:15
project structure DSL in C# 6.0
public class Program
{
public void Main()
{
var solution = new Directory
{
["global.json"] = new JObject
{
["projects"] = new JArray { "src", "test" }
},
@davidfowl
davidfowl / typesafeparams.md
Last active December 14, 2015 01:55
Typesafe params

In the new ASP.NET 5 stack dependency injection is pervasive. We let users wire up their dependencies in the Startup class:

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddTransient<IFoo, Foo>();
    }
    
@davidfowl
davidfowl / UseMapMiddleware.cs
Created August 12, 2015 05:03
Middleware that rejoins the parent pipeline
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
namespace WebApplication58
{
public class MapUseMiddleware
@davidfowl
davidfowl / loadcontextredux.txt
Last active August 29, 2015 14:27
LoadContext strikes again
A (project) -> B (package)
(build)-> CustomCompiler (project) (build)-> FSharpCompiler (project) -> System.Runtime (package)
public interface ILoadContextProvider {
IAssemblyLoadContext GetLoadContext(Project project, FrameworkName targetFramework);
}
var loadContextProvider = ...
Compile(A)
@davidfowl
davidfowl / spec.md
Last active May 19, 2016 12:16
RID specific dependencies.md

RID (Runtime idetifier) specific dependencies

As nuget has expanded to support cross platform .NET code, they were features added to allow.

Today NuGet v3 supports a concept of lineup files. These files allow a suite of software to bring in RID specific dependencies. The intent of this feature is to allow package authors to split the API surface from runtime implementations.

Runtime IDs

https://github.com/dotnet/corefx/blob/master/pkg/Microsoft.NETCore.Platforms/runtime.json

runtime.json

Several commands have an --output parameter:

dotnet build

dotnet build --output /myoutputfolder

Output folder

@davidfowl
davidfowl / spec.md
Last active January 30, 2017 22:07
csproj/xproj integration

xproj -> csproj redux

  1. Adding a project reference will add an entry in the xproj file. There will be no check to see if the TFM for the csproj is compatible.
  2. Running dotnet restore or nuget restore in the xproj folder will generate a lock file with project references to the csproj. NuGet walks the msbuild P2P graph in order to achieve this. The lock file will have entries for each of the projects in the graph, but will not have paths to assets. This will happen at compile time by dotnet build. This is because the output path can change based on arbitrary msbuild properties.
  3. There an entry for the csproj reference in the project.json file.
{
"dependencies": {
@davidfowl
davidfowl / doit.md
Last active May 19, 2016 12:15
Proposal

MyApplication

Publish shared runtime

{
    "version": "1.0.0-*",
    "compilationOptions": {
        "emitEntryPoint": true
 },
@davidfowl
davidfowl / Generated.cs
Last active May 19, 2016 12:15
Compile DI
public class MyAppContainer : ConsoleApp1.Container
{
public MyAppContainer()
{
}
public MyAppContainer(ConsoleApp1.Container container) : base(container)
{
}