Skip to content

Instantly share code, notes, and snippets.

@livarcocc
Forked from davidfowl/OutputPath-Args.md
Created January 30, 2016 01:13
Show Gist options
  • Save livarcocc/3ef6cf603c16ba7c9789 to your computer and use it in GitHub Desktop.
Save livarcocc/3ef6cf603c16ba7c9789 to your computer and use it in GitHub Desktop.
CLI Stuff

Several commands have an --output parameter:

dotnet build --output /myoutputfolder

Output folder

bin/Debug/dnxcore50/Foo.dll
bin/Debug/dnxcore50/Foo.pdb

Target folder

/myoutputfolder/Foo.dll
/myoutputfolder/Foo.pdb
dotnet pack --output /myoutputfolder

Output folder

bin/Debug/dnxcore50/Foo.dll
bin/Debug/dnxcore50/Foo.pdb

Target folder

/myoutputfolder/Foo.nupkg
/myoutputfolder/Foo.symbols.nupkg
dotnet publish --output /myoutputfolder

Output folder

bin/Debug/dnxcore50/Foo.dll
bin/Debug/dnxcore50/Foo.pdb

Target folder

/myoutputfolder/Foo
/myoutputfolder/Foo.deps
/myoutputfolder/Foo.dll
/myoutputfolder/Foo.pdb
/myoutputfolder/ProjectDependency.dll
/myoutputfolder/ProjectDependency.pdb
/myoutputfolder/PackageDependency.dll

Output paths (redux)

Console app

Foo/project.json

{
    "compilationOptions": {
        "emitEntryPoint": true
    },
    "dependencies": {
        "ProjectDependency": "1.0.0-*",
        "PackageDependency": "1.0.0-*"
    },
    "frameworks": {
        "dnxcore50":{ }
    }
}

Build output

Command:

dotnet build

Compile assets

bin/Debug/dnxcore50/Foo.dll
bin/Debug/dnxcore50/Foo.pdb

Runtime assets

bin/Debug/dnxcore50/win7-x64/Foo
bin/Debug/dnxcore50/win7-x64/Foo.deps
bin/Debug/dnxcore50/win7-x64/Foo.dll
bin/Debug/dnxcore50/win7-x64/Foo.pdb
bin/Debug/dnxcore50/win7-x64/ProjectDependency.dll
bin/Debug/dnxcore50/win7-x64/ProjectDependency.pdb

Publish output

Command:

dotnet publish

Do we publish to the same place as build? They can stomp on each other if we do. If we change the folder it should be under bin so that .gitignore files don't need to be updated.

bin/Debug/dnxcore50/win7-x64/Foo
bin/Debug/dnxcore50/win7-x64/Foo.deps
bin/Debug/dnxcore50/win7-x64/Foo.dll
bin/Debug/dnxcore50/win7-x64/Foo.pdb
bin/Debug/dnxcore50/win7-x64/ProjectDependency.dll
bin/Debug/dnxcore50/win7-x64/ProjectDependency.pdb
bin/Debug/dnxcore50/win7-x64/PackageDependency.dll

Pack output

Command:

dotnet pack

Dependencies end up in the nuspec of the package.

bin/Debug/Foo.nupkg
bin/Debug/Foo.symbols.nupkg
bin/Debug/dnxcore50/Foo.dll
bin/Debug/dnxcore50/Foo.pdb

Class Library

{
    "dependencies": {
        "ProjectDependency": "1.0.0-*",
        "PackageDependency": "1.0.0-*"
    },
    "frameworks": {
        "dnxcore50":{ }
    }
}

Build output

Compile and Runtime assets

bin/Debug/dnxcore50/Foo.dll
bin/Debug/dnxcore50/Foo.pdb

Publish output

bin/Debug/dnxcore50/Foo.dll
bin/Debug/dnxcore50/Foo.pdb
bin/Debug/dnxcore50/ProjectDependency.dll
bin/Debug/dnxcore50/ProjectDependency.pdb
bin/Debug/dnxcore50/PackageDependency.dll

Pack output

Dependencies end up in the nuspec of the package.

bin/Debug/Foo.nupkg
bin/Debug/Foo.symbols.nupkg
bin/Debug/dnxcore50/Foo.dll
bin/Debug/dnxcore50/Foo.pdb

.NET Framework

Console application

Foo/project.json

{
    "compilationOptions": {
        "emitEntryPoint": true
    },
    "dependencies": {
        "ProjectDependency": "1.0.0-*",
        "PackageDependency": "1.0.0-*"
    },
    "frameworks": {
        "net451": { }
    }
}

Build output

Compile time assets

bin/Debug/net451/Foo.exe
bin/Debug/net451/Foo.pdb

Runtime assets

bin/Debug/net451/win7-x64/Foo.exe
bin/Debug/net451/win7-x64/Foo.exe.config
bin/Debug/net451/win7-x64/Foo.pdb
bin/Debug/net451/win7-x64/ProjectDependency.dll
bin/Debug/net451/win7-x64/ProjectDependency.pdb
bin/Debug/net451/win7-x64/PackageDependency.dll
bin/Debug/net451/win7-x64/PackageDependency.pdb

Class Library

{
    "dependencies": {
        "ProjectDependency": "1.0.0-*",
        "PackageDependency": "1.0.0-*"
    },
    "frameworks": {
        "net451": { }
    }
}

Compile time and Runtime assets

bin/Debug/net451/Foo.dll
bin/Debug/net451/Foo.pdb

Handling of TFM and Runtime args

Behavior:

Default runtime: x64 Default framework: dnxcore50/netstandardapp

  • If no runtime and framework specified and a single framework exists, then use it.
  • If no runtime and framework specified then use the default framework and runtime id If it's not in project.json then fail.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment