This repository has been archived by the owner on Oct 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from enricosada/update_to_rc2
upgrade to rc2, add embedded resources, fix test/dnx run/dnx web
- Loading branch information
Showing
31 changed files
with
336 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
sample/HelloMvc.Views/compiler/preprocess/RazorPreCompilation.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<h1>Hello from F#</h1> | ||
<h2>(by Razor)</h2> | ||
|
||
Page generated: @Html.Encode(string.Format("{0}", System.DateTime.Now)) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.