├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── appveyor.yml ├── examples └── preview2 │ ├── console │ ├── Program.fs │ └── project.json │ └── lib │ ├── Library.fs │ └── project.json └── scripts ├── run-tests.ps1 ├── run-tests.sh ├── show-dotnet-info.ps1 └── show-dotnet-info.sh /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | .dotnetrepo 5 | test/test-dotnet-new/* 6 | .dotnet 7 | scripts/obtain/install* 8 | 9 | # User-specific files 10 | *.suo 11 | *.user 12 | *.userosscache 13 | *.sln.docstates 14 | 15 | # User-specific files (MonoDevelop/Xamarin Studio) 16 | *.userprefs 17 | 18 | # Build results 19 | [Dd]ebug/ 20 | [Dd]ebugPublic/ 21 | [Rr]elease/ 22 | [Rr]eleases/ 23 | x64/ 24 | x86/ 25 | bld/ 26 | [Bb]in/ 27 | [Oo]bj/ 28 | 29 | # Visual Studio 2015 cache/options directory 30 | .vs/ 31 | # Uncomment if you have tasks that create the project's static files in wwwroot 32 | #wwwroot/ 33 | 34 | # MSTest test Results 35 | [Tt]est[Rr]esult*/ 36 | [Bb]uild[Ll]og.* 37 | 38 | # NUNIT 39 | *.VisualState.xml 40 | TestResult.xml 41 | 42 | # Build Results of an ATL Project 43 | [Dd]ebugPS/ 44 | [Rr]eleasePS/ 45 | dlldata.c 46 | 47 | # DNX 48 | project.lock.json 49 | artifacts/ 50 | 51 | *_i.c 52 | *_p.c 53 | *_i.h 54 | *.ilk 55 | *.meta 56 | *.obj 57 | *.pch 58 | *.pdb 59 | *.pgc 60 | *.pgd 61 | *.rsp 62 | *.sbr 63 | *.tlb 64 | *.tli 65 | *.tlh 66 | *.tmp 67 | *.tmp_proj 68 | *.log 69 | *.vspscc 70 | *.vssscc 71 | .builds 72 | *.pidb 73 | *.svclog 74 | *.scc 75 | 76 | # Chutzpah Test files 77 | _Chutzpah* 78 | 79 | # Visual C++ cache files 80 | ipch/ 81 | *.aps 82 | *.ncb 83 | *.opendb 84 | *.opensdf 85 | *.sdf 86 | *.cachefile 87 | 88 | # Visual Studio profiler 89 | *.psess 90 | *.vsp 91 | *.vspx 92 | *.sap 93 | 94 | # TFS 2012 Local Workspace 95 | $tf/ 96 | 97 | # Guidance Automation Toolkit 98 | *.gpState 99 | 100 | # ReSharper is a .NET coding add-in 101 | _ReSharper*/ 102 | *.[Rr]e[Ss]harper 103 | *.DotSettings.user 104 | 105 | # JustCode is a .NET coding add-in 106 | .JustCode 107 | 108 | # TeamCity is a build add-in 109 | _TeamCity* 110 | 111 | # DotCover is a Code Coverage Tool 112 | *.dotCover 113 | 114 | # NCrunch 115 | _NCrunch_* 116 | .*crunch*.local.xml 117 | nCrunchTemp_* 118 | 119 | # MightyMoose 120 | *.mm.* 121 | AutoTest.Net/ 122 | 123 | # Web workbench (sass) 124 | .sass-cache/ 125 | 126 | # Installshield output folder 127 | [Ee]xpress/ 128 | 129 | # DocProject is a documentation generator add-in 130 | DocProject/buildhelp/ 131 | DocProject/Help/*.HxT 132 | DocProject/Help/*.HxC 133 | DocProject/Help/*.hhc 134 | DocProject/Help/*.hhk 135 | DocProject/Help/*.hhp 136 | DocProject/Help/Html2 137 | DocProject/Help/html 138 | 139 | # Click-Once directory 140 | publish/ 141 | 142 | # Publish Web Output 143 | *.[Pp]ublish.xml 144 | *.azurePubxml 145 | # TODO: Comment the next line if you want to checkin your web deploy settings 146 | # but database connection strings (with potential passwords) will be unencrypted 147 | *.pubxml 148 | *.publishproj 149 | 150 | # NuGet Packages 151 | *.nupkg 152 | # The packages folder can be ignored because of Package Restore 153 | **/packages/* 154 | # except build/, which is used as an MSBuild target. 155 | !**/packages/build/ 156 | # Uncomment if necessary however generally it will be regenerated when needed 157 | #!**/packages/repositories.config 158 | # NuGet v3's project.json files produces more ignoreable files 159 | *.nuget.props 160 | *.nuget.targets 161 | 162 | # Microsoft Azure Build Output 163 | csx/ 164 | *.build.csdef 165 | 166 | # Microsoft Azure Emulator 167 | ecf/ 168 | rcf/ 169 | 170 | # Microsoft Azure ApplicationInsights config file 171 | ApplicationInsights.config 172 | 173 | # Windows Store app package directory 174 | AppPackages/ 175 | BundleArtifacts/ 176 | 177 | # Visual Studio cache files 178 | # files ending in .cache can be ignored 179 | *.[Cc]ache 180 | # but keep track of directories ending in .cache 181 | !*.[Cc]ache/ 182 | 183 | # Others 184 | ClientBin/ 185 | ~$* 186 | *~ 187 | *.dbmdl 188 | *.dbproj.schemaview 189 | *.pfx 190 | *.publishsettings 191 | node_modules/ 192 | orleans.codegen.cs 193 | 194 | # RIA/Silverlight projects 195 | Generated_Code/ 196 | 197 | # Backup & report files from converting an old project file 198 | # to a newer Visual Studio version. Backup files are not needed, 199 | # because we have git ;-) 200 | _UpgradeReport_Files/ 201 | Backup*/ 202 | UpgradeLog*.XML 203 | UpgradeLog*.htm 204 | 205 | # SQL Server files 206 | *.mdf 207 | *.ldf 208 | 209 | # Business Intelligence projects 210 | *.rdl.data 211 | *.bim.layout 212 | *.bim_*.settings 213 | 214 | # Microsoft Fakes 215 | FakesAssemblies/ 216 | 217 | # GhostDoc plugin setting file 218 | *.GhostDoc.xml 219 | 220 | # Node.js Tools for Visual Studio 221 | .ntvs_analysis.dat 222 | 223 | # Visual Studio 6 build log 224 | *.plg 225 | 226 | # Visual Studio 6 workspace options file 227 | *.opt 228 | 229 | # Visual Studio LightSwitch build output 230 | **/*.HTMLClient/GeneratedArtifacts 231 | **/*.DesktopClient/GeneratedArtifacts 232 | **/*.DesktopClient/ModelManifest.xml 233 | **/*.Server/GeneratedArtifacts 234 | **/*.Server/ModelManifest.xml 235 | _Pvt_Extensions 236 | 237 | # Paket dependency manager 238 | .paket/paket.exe 239 | 240 | # FAKE - F# Make 241 | .fake/ 242 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: csharp 2 | 3 | matrix: 4 | include: 5 | - os: linux # Ubuntu 14.04 6 | dist: trusty 7 | sudo: required 8 | mono: none 9 | dotnet: 1.0.0-preview2-003121 10 | - os: osx # OSX 10.11 11 | osx_image: xcode7.2 12 | mono: none 13 | dotnet: 1.0.0-preview2-003121 14 | 15 | script: 16 | # dotnet info 17 | - dotnet --info 18 | # Run example: lib 19 | - pushd "examples/preview2/lib" 20 | - dotnet restore 21 | - dotnet --verbose build 22 | - popd 23 | # Run example: console 24 | - pushd "examples/preview2/console" 25 | - dotnet restore 26 | - dotnet --verbose run -- a b 27 | - popd 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Enrico Sada 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # F# samples using .NET CLI 2 | 3 | [![Build Status](https://travis-ci.org/enricosada/fsharp-dotnet-cli-samples.svg?branch=rel%2F1.0.0-preview2)](https://travis-ci.org/enricosada/fsharp-dotnet-cli-samples) 4 | [![Build Status](https://ci.appveyor.com/api/projects/status/fjyw71v46oyftr3d/branch/rel/1.0.0-preview2?svg=true)](https://ci.appveyor.com/project/enricosada/fsharp-dotnet-cli-samples/branch/rel/1.0.0-preview2) 5 | 6 | [F#](http://fsharp.org/) and the [.NET CLI](http://dotnet.github.io/) working together 7 | 8 | **More info about F# and .NET CLI in the [wiki](https://github.com/enricosada/fsharp-dotnet-cli-samples/wiki)** 9 | 10 | This repository build F# projects using dotnet/cli from: 11 | 12 | | alias | | 13 | |-------------|-----| 14 | | `latest` | Latest dotnet cli binaries (see [dotnet/cli README](https://github.com/dotnet/cli/blob/rel/1.0.0/README.md) ) | 15 | | `lkg` | Latest known good cli binaries, current is 1.0.0-preview2-003121 | 16 | 17 | More info (with direct download links) in [Status in the wiki](https://github.com/enricosada/fsharp-dotnet-cli-samples/wiki/Status) 18 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | os: Visual Studio 2015 2 | 3 | build_script: 4 | # dotnet info 5 | - ps: dotnet --info 6 | # Run example: console 7 | - ps: Push-Location .\examples\preview2\lib\ 8 | - ps: dotnet restore 9 | - ps: dotnet --verbose build 10 | - ps: Pop-Location 11 | # Run example: console 12 | - ps: Push-Location .\examples\preview2\console\ 13 | - ps: dotnet restore 14 | - ps: dotnet --verbose run -- a b 15 | - ps: Pop-Location 16 | 17 | 18 | test: off 19 | version: 0.0.1.{build} 20 | -------------------------------------------------------------------------------- /examples/preview2/console/Program.fs: -------------------------------------------------------------------------------- 1 | // Learn more about F# at http://fsharp.org 2 | 3 | open System 4 | 5 | [] 6 | let main argv = 7 | printfn "Hello World!" 8 | printfn "%A" argv 9 | 0 // return an integer exit code 10 | -------------------------------------------------------------------------------- /examples/preview2/console/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0.0-*", 3 | "buildOptions": { 4 | "debugType": "portable", 5 | "emitEntryPoint": true, 6 | "compilerName": "fsc", 7 | "compile": { 8 | "includeFiles": [ 9 | "Program.fs" 10 | ] 11 | } 12 | }, 13 | "dependencies": { 14 | "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-*" 15 | }, 16 | "frameworks": { 17 | "netcoreapp1.0": { 18 | "dependencies": { 19 | "Microsoft.NETCore.App": { 20 | "type": "platform", 21 | "version": "1.0.0" 22 | } 23 | }, 24 | "imports": "dnxcore50" 25 | } 26 | }, 27 | "tools": { 28 | "dotnet-compile-fsc": { 29 | "version": "1.0.0-preview2-*", 30 | "imports": "dnxcore50" 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /examples/preview2/lib/Library.fs: -------------------------------------------------------------------------------- 1 | namespace Library 2 | 3 | module Say = 4 | let hello name = 5 | printfn "Hello %s" name 6 | -------------------------------------------------------------------------------- /examples/preview2/lib/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0.0-*", 3 | "buildOptions": { 4 | "debugType": "portable", 5 | "compilerName": "fsc", 6 | "compile": { 7 | "includeFiles": [ 8 | "Library.fs" 9 | ] 10 | } 11 | }, 12 | "dependencies": { 13 | "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-*" 14 | }, 15 | "frameworks": { 16 | "netstandard1.6": { 17 | "dependencies": { 18 | "NETStandard.Library": "1.6.0" 19 | } 20 | } 21 | }, 22 | "tools": { 23 | "dotnet-compile-fsc": { 24 | "version": "1.0.0-preview2-*", 25 | "imports": "dnxcore50" 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /scripts/run-tests.ps1: -------------------------------------------------------------------------------- 1 | #make path absolute 2 | $rootDir = Split-Path -parent (Split-Path -parent $PSCommandPath) 3 | 4 | # restore and compile 5 | 6 | Write-Host "Testing HelloConsole..." 7 | 8 | Push-Location "$rootDir\HelloConsole" 9 | 10 | dotnet restore 11 | if ($LastExitCode -ne 0) { 12 | throw "Command failed with exit code $LastExitCode." 13 | } 14 | 15 | dotnet --verbose build 16 | if ($LastExitCode -ne 0) { 17 | throw "Command failed with exit code $LastExitCode." 18 | } 19 | 20 | Pop-Location 21 | 22 | # dotnet new 23 | 24 | Write-Host "Testing dotnet new..." 25 | 26 | Remove-Item "$rootDir\test\test-dotnet-new" -Recurse -ErrorAction Ignore 27 | 28 | mkdir "$rootDir\test\test-dotnet-new" -Force | Push-Location 29 | 30 | if ($LastExitCode -ne 0) { 31 | throw "Command failed with exit code $LastExitCode." 32 | } 33 | 34 | dotnet new --lang f# 35 | if ($LastExitCode -ne 0) { 36 | throw "Command failed with exit code $LastExitCode." 37 | } 38 | 39 | dotnet restore 40 | if ($LastExitCode -ne 0) { 41 | throw "Command failed with exit code $LastExitCode." 42 | } 43 | 44 | dotnet --verbose build 45 | if ($LastExitCode -ne 0) { 46 | throw "Command failed with exit code $LastExitCode." 47 | } 48 | 49 | dotnet --verbose run a b 50 | if ($LastExitCode -ne 0) { 51 | throw "Command failed with exit code $LastExitCode." 52 | } 53 | 54 | Pop-Location 55 | -------------------------------------------------------------------------------- /scripts/run-tests.sh: -------------------------------------------------------------------------------- 1 | #make path absolute 2 | RootDir=$(dirname $(dirname $0)) 3 | 4 | # restore and compile 5 | 6 | echo "Testing HelloConsole..." 7 | 8 | pushd "$RootDir/HelloConsole" 9 | 10 | dotnet restore 11 | if [ $? -ne 0 ]; then 12 | exit 1 13 | fi 14 | 15 | dotnet --verbose build 16 | if [ $? -ne 0 ]; then 17 | exit 1 18 | fi 19 | 20 | popd 21 | 22 | # dotnet new 23 | 24 | echo "Testing dotnet new..." 25 | 26 | rm -rf "$RootDir/test/test-dotnet-new" 27 | 28 | mkdir -p "$RootDir/test/test-dotnet-new" && pushd "$RootDir/test/test-dotnet-new" 29 | 30 | if [ $? -ne 0 ]; then 31 | exit 1 32 | fi 33 | 34 | dotnet new --lang f# 35 | if [ $? -ne 0 ]; then 36 | exit 1 37 | fi 38 | 39 | dotnet restore 40 | if [ $? -ne 0 ]; then 41 | exit 1 42 | fi 43 | 44 | dotnet --verbose build 45 | if [ $? -ne 0 ]; then 46 | exit 1 47 | fi 48 | 49 | dotnet --verbose run a b 50 | if [ $? -ne 0 ]; then 51 | exit 1 52 | fi 53 | 54 | popd 55 | 56 | exit 0 57 | -------------------------------------------------------------------------------- /scripts/show-dotnet-info.ps1: -------------------------------------------------------------------------------- 1 | 2 | if (Get-Command dotnet -errorAction SilentlyContinue) { 3 | Write-Host "Using dotnet '$((Get-Command dotnet).Path)'" 4 | dotnet --version 5 | } 6 | else { 7 | Write-Host "dotnet.exe not found" 8 | } 9 | 10 | -------------------------------------------------------------------------------- /scripts/show-dotnet-info.sh: -------------------------------------------------------------------------------- 1 | 2 | which dotnet 3 | if [ $? -eq 0 ]; then 4 | echo "Using dotnet:" 5 | dotnet --version 6 | else 7 | echo "dotnet.exe not found" 8 | fi 9 | --------------------------------------------------------------------------------