diff --git a/FSharp.Dnx.sln b/FSharp.Dnx.sln index aaa7e20..89a2224 100644 --- a/FSharp.Dnx.sln +++ b/FSharp.Dnx.sln @@ -17,14 +17,14 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "HelloFSharp", "sample\Hello EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "HelloMvc", "sample\HelloMvc\HelloMvc.xproj", "{F1623F56-EA17-429D-989A-99CB6F2E8EEA}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "HelloMvc.Views", "sample\HelloMvc.Views\HelloMvc.Views.xproj", "{4437BEFB-4824-406C-9B43-745F90C748D2}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C8628CB9-DE7A-44B7-8097-874690D0B030}" ProjectSection(SolutionItems) = preProject global.json = global.json NuGet.Config = NuGet.Config EndProjectSection EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "FSharp.Dnx.UnitTests", "test\FSharp.Dnx.UnitTests\FSharp.Dnx.UnitTests.xproj", "{92972DE0-CAE0-42F8-A78B-4C77CAF1DF66}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -47,10 +47,10 @@ Global {F1623F56-EA17-429D-989A-99CB6F2E8EEA}.Debug|Any CPU.Build.0 = Debug|Any CPU {F1623F56-EA17-429D-989A-99CB6F2E8EEA}.Release|Any CPU.ActiveCfg = Release|Any CPU {F1623F56-EA17-429D-989A-99CB6F2E8EEA}.Release|Any CPU.Build.0 = Release|Any CPU - {4437BEFB-4824-406C-9B43-745F90C748D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4437BEFB-4824-406C-9B43-745F90C748D2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4437BEFB-4824-406C-9B43-745F90C748D2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4437BEFB-4824-406C-9B43-745F90C748D2}.Release|Any CPU.Build.0 = Release|Any CPU + {92972DE0-CAE0-42F8-A78B-4C77CAF1DF66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {92972DE0-CAE0-42F8-A78B-4C77CAF1DF66}.Debug|Any CPU.Build.0 = Debug|Any CPU + {92972DE0-CAE0-42F8-A78B-4C77CAF1DF66}.Release|Any CPU.ActiveCfg = Release|Any CPU + {92972DE0-CAE0-42F8-A78B-4C77CAF1DF66}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -60,6 +60,6 @@ Global {BF35EB0A-4C51-4685-BFD8-8B5EB3DEA5CA} = {48B5D8BF-426D-4221-BB16-0C76E9792999} {4DC29E60-1C63-477F-AA34-67B5E65775FB} = {4BC77B28-AC2E-416A-8D2F-491819D5FFD5} {F1623F56-EA17-429D-989A-99CB6F2E8EEA} = {4BC77B28-AC2E-416A-8D2F-491819D5FFD5} - {4437BEFB-4824-406C-9B43-745F90C748D2} = {4BC77B28-AC2E-416A-8D2F-491819D5FFD5} + {92972DE0-CAE0-42F8-A78B-4C77CAF1DF66} = {48B5D8BF-426D-4221-BB16-0C76E9792999} EndGlobalSection EndGlobal diff --git a/NuGet.Config b/NuGet.Config index 1cae61c..d9db626 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -6,5 +6,6 @@ + diff --git a/README.md b/README.md new file mode 100644 index 0000000..39fdb37 --- /dev/null +++ b/README.md @@ -0,0 +1,79 @@ +FSharp.Dnx +=== + +This project depends on [aspnet/dnx](github.com/aspnet/dnx) + +| branch | aspnet/dnx version | +|---------|---------------------| +| master | latest development version ( now 1.0.0-rc2-* ) | +| release | 1.0.0-rc1-final | + +# Usage + +Examples app: + +- command line, see `sample/HelloFSharp` +- asp.net mvc, see `sample/HelloMvc` + +# Development + +more info in `docs/development.md` + +prepare the environment + +``` +dnvm upgrade -u +dnu restore +``` + +After that, you can: + +- use the `FSharp.Dnx.sln` solution +- execute commands from a shell + +NOTE: the `dnvm upgrade -u` install latest unstable version and change +the `default` alias ( it's a global config per user, used by ides like Visual Studio ) +To revert to latest stable, do `dnvm upgrade` + +## From shell + +### run a sample command line app + +from `sample/HelloFSharp` directory + +``` +dnx run +``` + +expected + +``` +Hello from F#, running on DNX v4.5.1 +``` + +### run a sample asp.net mvc app + +from `sample/HelloMvc` directory + +``` +dnx web +``` + +expected + +``` +Hosting environment: Production +Now listening on: http://localhost:5000 +Application started. Press Ctrl+C to shut down. +``` + +open a brower in [http://localhost:5000](http://localhost:5000) + + +### execute tests + +from `test/FSharp.Dnx.Test` directory + +``` +dnx test +``` diff --git a/docs/development.md b/docs/development.md new file mode 100644 index 0000000..401fb75 --- /dev/null +++ b/docs/development.md @@ -0,0 +1,56 @@ +The flow is + +1. upgrade dnvm to latest unstable ( or install latest unstable and use that ) +2. restore dependencies with `dnu restore` +3. run samples with `dnx run`/`dnx web` or tests with `dnx test` + +NOTE: + +Upgrading dnvm change the `default` alias and the dnvm version in `PATH`. + +It's a global config per user, and `default` alias is used by ide like Visual Studio if sdk property +in global.json file is not specified. + +dnvm doesnt [care about global.json](https://github.com/aspnet/dnvm/issues/271) + +## How to revert to latest stable version of dnvm + +To revert to latest stable version of dnvm do + +``` +dnvm upgrade +``` + +### 1- Upgrade to latest unstable dnvm + +Open a shell inside this repository directory + +``` +dnvm upgrade -u +``` + +### 2- Restore dependencies + +You can use the command + +``` +dnu restore +``` + +# Useful tips for dnvm/dnu/dnx + +## enable trace info for debugging + +set `DNX_TRACE` environment variable to `1` + + +for example + +``` +set DNX_TRACE=1 +dnu build +``` + +should print lots of logging info + + diff --git a/sample/HelloFSharp/project.json b/sample/HelloFSharp/project.json index 3fc50fe..9e61458 100644 --- a/sample/HelloFSharp/project.json +++ b/sample/HelloFSharp/project.json @@ -3,6 +3,12 @@ "dependencies": { "FSharp.Dnx": { "type": "build", "version": "" } }, + "compilationOptions": { + "emitEntryPoint": true + }, + "commands": { + "HelloFSharp": "HelloFSharp" + }, "frameworks": { "dnx451": { } }, diff --git a/sample/HelloMvc.Views/Views/Home/Index.cshtml b/sample/HelloMvc.Views/Views/Home/Index.cshtml deleted file mode 100644 index 3943ddc..0000000 --- a/sample/HelloMvc.Views/Views/Home/Index.cshtml +++ /dev/null @@ -1,2 +0,0 @@ -

Hello from F#

-

(by Razor)

diff --git a/sample/HelloMvc.Views/compiler/preprocess/RazorPreCompilation.cs b/sample/HelloMvc.Views/compiler/preprocess/RazorPreCompilation.cs deleted file mode 100644 index 7057150..0000000 --- a/sample/HelloMvc.Views/compiler/preprocess/RazorPreCompilation.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc.Razor.Precompilation; -using Microsoft.Dnx.Compilation.CSharp; - -namespace HelloMvc.Views -{ - public class TagHelperPrecompilation : RazorPreCompileModule - { - public TagHelperPrecompilation() - { - GenerateSymbols = true; - } - - protected override bool EnablePreCompilation(BeforeCompileContext context) - { - return true; - } - } -} diff --git a/sample/HelloMvc.Views/project.json b/sample/HelloMvc.Views/project.json deleted file mode 100644 index 3080a83..0000000 --- a/sample/HelloMvc.Views/project.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1.0.0-beta-*", - "dependencies": { - "Microsoft.AspNet.Mvc": "6.0.0-*", - "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-*", - "Microsoft.Dnx.Runtime.Abstractions": "1.0.0-*" - }, - "frameworks": { - "dnx451": { } - } -} diff --git a/sample/HelloMvc/EmbeddedResources/Views/Home/Index.cshtml b/sample/HelloMvc/EmbeddedResources/Views/Home/Index.cshtml new file mode 100644 index 0000000..9490453 --- /dev/null +++ b/sample/HelloMvc/EmbeddedResources/Views/Home/Index.cshtml @@ -0,0 +1,4 @@ +

Hello from F#

+

(by Razor)

+ +Page generated: @Html.Encode(string.Format("{0}", System.DateTime.Now)) diff --git a/sample/HelloMvc.Views/Views/Shared/_Layout.cshtml b/sample/HelloMvc/EmbeddedResources/Views/Shared/_Layout.cshtml similarity index 100% rename from sample/HelloMvc.Views/Views/Shared/_Layout.cshtml rename to sample/HelloMvc/EmbeddedResources/Views/Shared/_Layout.cshtml diff --git a/sample/HelloMvc.Views/Views/_GlobalImport.cshtml b/sample/HelloMvc/EmbeddedResources/Views/_GlobalImport.cshtml similarity index 100% rename from sample/HelloMvc.Views/Views/_GlobalImport.cshtml rename to sample/HelloMvc/EmbeddedResources/Views/_GlobalImport.cshtml diff --git a/sample/HelloMvc.Views/Views/_ViewStart.cshtml b/sample/HelloMvc/EmbeddedResources/Views/_ViewStart.cshtml similarity index 100% rename from sample/HelloMvc.Views/Views/_ViewStart.cshtml rename to sample/HelloMvc/EmbeddedResources/Views/_ViewStart.cshtml diff --git a/sample/HelloMvc/project.json b/sample/HelloMvc/project.json index 22d516e..a0a1803 100644 --- a/sample/HelloMvc/project.json +++ b/sample/HelloMvc/project.json @@ -1,12 +1,17 @@ { "version": "1.0.0-beta-*", + "resource": "EmbeddedResources/**", "dependencies": { "FSharp.Dnx": { "type": "build", "version": "" }, - "HelloMvc.Views": "", "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", + "Microsoft.Extensions.Logging.Console": "1.0.0-*", + "Microsoft.AspNet.Diagnostics": "1.0.0-*", "Microsoft.AspNet.Mvc": "6.0.0-*", + "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-*", + "Microsoft.AspNet.Server.WebListener": "1.0.0-*", "Microsoft.AspNet.StaticFiles": "1.0.0-*", - "Microsoft.AspNet.Diagnostics": "1.0.0-*" + "Microsoft.AspNet.Tooling.Razor": "1.0.0-*", + "Microsoft.AspNet.FileProviders.Embedded": "1.0.0-*" }, "frameworks": { "dnx451": { } diff --git a/sample/HelloMvc/startup.fs b/sample/HelloMvc/startup.fs index 2382ee3..0e7fd4f 100644 --- a/sample/HelloMvc/startup.fs +++ b/sample/HelloMvc/startup.fs @@ -1,34 +1,34 @@ namespace HelloMvc -open System +open System.Reflection open Microsoft.AspNet.Builder +open Microsoft.AspNet.FileProviders +open Microsoft.AspNet.Mvc.Razor open Microsoft.Extensions.DependencyInjection -open Microsoft.Extensions.Logging -open Microsoft.AspNet.Hosting -type Startup(env: IHostingEnvironment) = +type Startup() = // Set up application services member public x.ConfigureServices (services: IServiceCollection) = - let mvcBuilder = services.AddMvc () - - let viewAssemblies = - [ "HelloMvc.Views" ] - |> List.map Reflection.Assembly.Load - |> Array.ofList - - mvcBuilder.AddPrecompiledRazorViews viewAssemblies |> ignore - //Microsoft.Extensions.DependencyInjection.MvcRazorMvcBuilderExtensions.AddPrecompiledRazorViews (mvcBuilder, System.Reflection.Assembly.Load "HelloMvc.Views") |> ignore + services.AddMvc () |> ignore + + services.Configure(fun (options: RazorViewEngineOptions) -> + // Base namespace matches the resources added to the assembly from the EmbeddedResources folder. + options.FileProvider <- new EmbeddedFileProvider( + (x.GetType().GetTypeInfo().Assembly), + "HelloMvc.EmbeddedResources") + ) |> ignore + () // Configure pipeline - member public x.Configure (app: IApplicationBuilder, loggerFactory: ILoggerFactory) = + member public x.Configure (app: IApplicationBuilder) = //loggerFactory.AddConsole (fun (name, logLevel) -> true) app.UseDeveloperExceptionPage () |> ignore app.UseStaticFiles () |> ignore app.UseMvc (fun routes -> - routes.MapRoute (name = "default", template = "{controller=Home}/{action=Index}/{id?}") |> ignore - - ()) |> ignore + routes.MapRoute (name = "default", template = "{controller=Home}/{action=Index}/{id?}") + |> ignore ) + |> ignore diff --git a/src/FSharp.Dnx/CompilationContext.cs b/src/FSharp.Dnx/CompilationContext.cs index 8420e45..a1a4565 100644 --- a/src/FSharp.Dnx/CompilationContext.cs +++ b/src/FSharp.Dnx/CompilationContext.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Linq; -using Microsoft.Dnx.Compilation; +using Microsoft.Extensions.CompilationAbstractions; namespace FSharp.Dnx { diff --git a/src/FSharp.Dnx/FSharpCompilationException.cs b/src/FSharp.Dnx/FSharpCompilationException.cs index 9878638..7d8dd1d 100644 --- a/src/FSharp.Dnx/FSharpCompilationException.cs +++ b/src/FSharp.Dnx/FSharpCompilationException.cs @@ -2,8 +2,7 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; -using Microsoft.Dnx.Compilation; -using Microsoft.Extensions.PlatformAbstractions; +using Microsoft.Extensions.CompilationAbstractions; namespace FSharp.Dnx { diff --git a/src/FSharp.Dnx/FSharpCompilationFailure.cs b/src/FSharp.Dnx/FSharpCompilationFailure.cs index c4a7914..58a2a3b 100644 --- a/src/FSharp.Dnx/FSharpCompilationFailure.cs +++ b/src/FSharp.Dnx/FSharpCompilationFailure.cs @@ -3,8 +3,7 @@ using System.Collections.Immutable; using System.IO; using System.Linq; -using Microsoft.Dnx; -using Microsoft.Dnx.Compilation; +using Microsoft.Extensions.CompilationAbstractions; namespace FSharp.Dnx { diff --git a/src/FSharp.Dnx/FSharpCompiler.cs b/src/FSharp.Dnx/FSharpCompiler.cs index ad85ac5..e5dcdc2 100644 --- a/src/FSharp.Dnx/FSharpCompiler.cs +++ b/src/FSharp.Dnx/FSharpCompiler.cs @@ -5,8 +5,8 @@ using System.IO; using System.Linq; using System.Runtime.InteropServices; -using Microsoft.Dnx.Compilation; -using Microsoft.Dnx.Compilation.Caching; +using Microsoft.Extensions.CompilationAbstractions.Caching; +using Microsoft.Extensions.CompilationAbstractions; using Microsoft.Dnx.Runtime; using Microsoft.FSharp.Compiler.SimpleSourceCodeServices; using YoloDev.Dnx.Json; @@ -82,6 +82,18 @@ public CompilationContext CompileProject( args.Add($"--doc:{Path.ChangeExtension(outFile, ".xml")}"); args.AddRange(projectInfo.Files); + var resourcesDir = files.CreateDir(); + foreach (var r in resourcesResolver()) + { + Logger.TraceInformation("[{0}]: Resource: '{1}' ( filename: '{2}' )", GetType().Name, r.Name, r.FileName); + string resourcePath = Path.Combine(resourcesDir, r.FileName); + using (var fs = File.Create(resourcePath)) + { + r.StreamFactory().CopyTo(fs); + } + args.Add($"--resource:{resourcePath},{r.Name}"); + } + // These are the metadata references being used by your project. // Everything in your project.json is resolved and normailzed here: // - Project references @@ -107,7 +119,10 @@ public CompilationContext CompileProject( args.Add($"-r:{fileName}"); } - //Console.WriteLine(string.Join(Environment.NewLine, args)); +#if DEBUG + Logger.TraceInformation("[{0}]: Arguments '{1}'", GetType().Name, string.Join(Environment.NewLine, args)); +#endif + var scs = new SimpleSourceCodeServices(); var result = scs.Compile(args.ToArray()); var errors = result.Item1.Select(FSharpDiagnosticMessage.CompilationMessage); diff --git a/src/FSharp.Dnx/FSharpDiagnosticMessage.cs b/src/FSharp.Dnx/FSharpDiagnosticMessage.cs index 1e11194..ee91e56 100644 --- a/src/FSharp.Dnx/FSharpDiagnosticMessage.cs +++ b/src/FSharp.Dnx/FSharpDiagnosticMessage.cs @@ -1,4 +1,4 @@ -using Microsoft.Extensions.PlatformAbstractions; +using Microsoft.Extensions.CompilationAbstractions; using Microsoft.FSharp.Compiler; namespace FSharp.Dnx diff --git a/src/FSharp.Dnx/FSharpDiagnosticResult.cs b/src/FSharp.Dnx/FSharpDiagnosticResult.cs index afd26b3..89c8841 100644 --- a/src/FSharp.Dnx/FSharpDiagnosticResult.cs +++ b/src/FSharp.Dnx/FSharpDiagnosticResult.cs @@ -2,7 +2,7 @@ using System.Collections.Immutable; using System.Linq; using Microsoft.FSharp.Compiler; -using Microsoft.Extensions.PlatformAbstractions; +using Microsoft.Extensions.CompilationAbstractions; namespace FSharp.Dnx { diff --git a/src/FSharp.Dnx/FSharpProjectCompiler.cs b/src/FSharp.Dnx/FSharpProjectCompiler.cs index b8b741b..bf7ae7c 100644 --- a/src/FSharp.Dnx/FSharpProjectCompiler.cs +++ b/src/FSharp.Dnx/FSharpProjectCompiler.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -using Microsoft.Dnx.Compilation; -using Microsoft.Dnx.Compilation.Caching; +using Microsoft.Extensions.CompilationAbstractions; +using Microsoft.Extensions.CompilationAbstractions.Caching; using Microsoft.Extensions.PlatformAbstractions; namespace FSharp.Dnx @@ -28,7 +28,8 @@ public FSharpProjectCompiler( public IMetadataProjectReference CompileProject( CompilationProjectContext projectContext, Func referenceResolver, - Func> resourcesResolver) + Func> resourcesResolver, + string configuration) { var export = referenceResolver(); if (export == null) diff --git a/src/FSharp.Dnx/FSharpProjectReference.cs b/src/FSharp.Dnx/FSharpProjectReference.cs index e641ba2..25d439b 100644 --- a/src/FSharp.Dnx/FSharpProjectReference.cs +++ b/src/FSharp.Dnx/FSharpProjectReference.cs @@ -4,7 +4,7 @@ using System.Linq; using System.IO; using System.Reflection; -using Microsoft.Dnx.Compilation; +using Microsoft.Extensions.CompilationAbstractions; using Microsoft.Dnx.Runtime; using Microsoft.Extensions.PlatformAbstractions; diff --git a/src/FSharp.Dnx/FSharpSourceReference.cs b/src/FSharp.Dnx/FSharpSourceReference.cs index c9de398..6c3f5eb 100644 --- a/src/FSharp.Dnx/FSharpSourceReference.cs +++ b/src/FSharp.Dnx/FSharpSourceReference.cs @@ -1,5 +1,5 @@ using System; -using Microsoft.Dnx.Compilation; +using Microsoft.Extensions.CompilationAbstractions; namespace FSharp.Dnx { diff --git a/src/FSharp.Dnx/FileWriteTimeCacheDependency.cs b/src/FSharp.Dnx/FileWriteTimeCacheDependency.cs new file mode 100644 index 0000000..a115d1c --- /dev/null +++ b/src/FSharp.Dnx/FileWriteTimeCacheDependency.cs @@ -0,0 +1,42 @@ +using Microsoft.Extensions.CompilationAbstractions.Caching; +using System; +using System.IO; + +namespace FSharp.Dnx +{ + public class FileWriteTimeCacheDependency : ICacheDependency + { + private readonly string _path; + private readonly DateTime _lastWriteTime; + + public FileWriteTimeCacheDependency(string path) + { + _path = path; + _lastWriteTime = File.GetLastWriteTime(path); + } + + public bool HasChanged + { + get + { + return _lastWriteTime < File.GetLastWriteTime(_path); + } + } + + public override string ToString() + { + return _path; + } + + public override bool Equals(object obj) + { + var token = obj as FileWriteTimeCacheDependency; + return token != null && token._path.Equals(_path, StringComparison.OrdinalIgnoreCase); + } + + public override int GetHashCode() + { + return _path.GetHashCode(); + } + } +} diff --git a/src/FSharp.Dnx/ResolveHooker.cs b/src/FSharp.Dnx/ResolveHooker.cs index 195e516..f3e2641 100644 --- a/src/FSharp.Dnx/ResolveHooker.cs +++ b/src/FSharp.Dnx/ResolveHooker.cs @@ -3,10 +3,10 @@ using System.Linq; using System.Collections.Generic; using System.Collections.Immutable; -using Microsoft.Dnx; -using Microsoft.Dnx.Compilation; +using Microsoft.Extensions.CompilationAbstractions; using Microsoft.FSharp.Compiler; using Microsoft.FSharp.Compiler.SimpleSourceCodeServices; +using Microsoft.Dnx.Runtime; namespace FSharp.Dnx { @@ -28,8 +28,13 @@ public void Dispose() private System.Reflection.Assembly HandleResolve(object sender, ResolveEventArgs args) { - if (args.Name.StartsWith("FSharp.Core", StringComparison.OrdinalIgnoreCase)) + if (args.Name.StartsWith("FSharp.Core,", StringComparison.OrdinalIgnoreCase)) { + +#if DEBUG + Logger.TraceInformation("[{0}]: HandleResolve '{1}'", GetType().Name, args.Name); +#endif + lock (l) { if (inner) diff --git a/src/FSharp.Dnx/project.json b/src/FSharp.Dnx/project.json index 9402783..20cdc06 100644 --- a/src/FSharp.Dnx/project.json +++ b/src/FSharp.Dnx/project.json @@ -5,16 +5,23 @@ "warningsAsErrors": true }, "dependencies": { - "Microsoft.Dnx.Compilation.Abstractions": "1.0.0-*", - "Microsoft.Dnx.Compilation": "1.0.0-*", + "Microsoft.Extensions.PlatformAbstractions": "1.0.0-*", + "Microsoft.Extensions.CompilationAbstractions": "1.0.0-*", + "Microsoft.Extensions.Logging": "1.0.0-*", "FSharp.Compiler.Service": "1.4.0.6", "FSharp.Core": "4.0.0.1", + "System.Collections.Immutable": "1.1.37", "YoloDev.Dnx.Json": { "type": "build", "version": "1.0.0-*" }, "Microsoft.Dnx.Runtime.Sources": { "type": "build", "version": "1.0.0-*" } }, "frameworks": { "dnx451": { - "frameworkAssemblies": { "System.Runtime": "" } + "frameworkAssemblies": { + "System.Collections": "", + "System.IO": "", + "System.Threading.Tasks": "", + "System.Text.Encoding": "" + } } }, "repository": { diff --git a/test/FSharp.Dnx.Test/project.json b/test/FSharp.Dnx.Test/project.json index 806a760..9aa3053 100644 --- a/test/FSharp.Dnx.Test/project.json +++ b/test/FSharp.Dnx.Test/project.json @@ -8,12 +8,12 @@ "dependencies": { "FSharp.Dnx": { "type": "build", "version": "" }, - "Microsoft.AspNet.Testing": "1.0.0-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "xunit": "2.1.0", + "xunit.runner.dnx": "2.1.0-*" }, "commands": { - "test": "xunit.runner.aspnet" + "test": "xunit.runner.dnx" }, "frameworks": { diff --git a/sample/HelloMvc.Views/HelloMvc.Views.xproj b/test/FSharp.Dnx.UnitTests/FSharp.Dnx.UnitTests.xproj similarity index 82% rename from sample/HelloMvc.Views/HelloMvc.Views.xproj rename to test/FSharp.Dnx.UnitTests/FSharp.Dnx.UnitTests.xproj index 62ebacf..08fba8d 100644 --- a/sample/HelloMvc.Views/HelloMvc.Views.xproj +++ b/test/FSharp.Dnx.UnitTests/FSharp.Dnx.UnitTests.xproj @@ -6,14 +6,16 @@ - 4437befb-4824-406c-9b43-745f90c748d2 - HelloMvc.Views + 92972de0-cae0-42f8-a78b-4c77caf1df66 + FSharp.Dnx.UnitTests ..\..\artifacts\obj\$(MSBuildProjectName) ..\..\artifacts\bin\$(MSBuildProjectName)\ - 2.0 + + + \ No newline at end of file diff --git a/test/FSharp.Dnx.UnitTests/Properties/AssemblyInfo.cs b/test/FSharp.Dnx.UnitTests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d120d8f --- /dev/null +++ b/test/FSharp.Dnx.UnitTests/Properties/AssemblyInfo.cs @@ -0,0 +1,23 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("FSharp.Dnx.UnitTests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("HP")] +[assembly: AssemblyProduct("FSharp.Dnx.UnitTests")] +[assembly: AssemblyCopyright("Copyright © HP 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("92972de0-cae0-42f8-a78b-4c77caf1df66")] diff --git a/test/FSharp.Dnx.UnitTests/XUnitSmoke.cs b/test/FSharp.Dnx.UnitTests/XUnitSmoke.cs new file mode 100644 index 0000000..a9d46d9 --- /dev/null +++ b/test/FSharp.Dnx.UnitTests/XUnitSmoke.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Xunit; + +namespace FSharp.Dnx.UnitTests +{ + /// Check xunit works + public class XUnitSmoke + { + [Fact] + public void PassingTest() + { + Assert.Equal(4, Add(2, 2)); + } + + int Add(int x, int y) + { + return x + y; + } + } +} diff --git a/test/FSharp.Dnx.UnitTests/project.json b/test/FSharp.Dnx.UnitTests/project.json new file mode 100644 index 0000000..2ecbb90 --- /dev/null +++ b/test/FSharp.Dnx.UnitTests/project.json @@ -0,0 +1,16 @@ +{ + "version": "1.0.0-*", + "description": "FSharp.Dnx.UnitTests Class Library", + "projectUrl": "", + "licenseUrl": "", + "dependencies": { + "xunit": "2.1.0", + "xunit.runner.dnx": "2.1.0-*" + }, + "commands": { + "test": "xunit.runner.dnx" + }, + "frameworks": { + "dnx451": { } + } +}