Update F# templates (#190)

This commit is contained in:
Phillip Carter 2018-01-04 10:56:54 -08:00 committed by Jass Bagga
parent 22da82ff8a
commit 5b34474502
12 changed files with 97 additions and 23 deletions

View File

@ -15,6 +15,9 @@
<ItemGroup Condition="'$(TargetFrameworkOverride)' == ''">
<PackageReference Include="Microsoft.AspNetCore.All" Version="${MicrosoftAspNetCoreAllPackageVersion}" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkOverride)' != ''">
<PackageReference Include="Microsoft.AspNetCore" Version="${MicrosoftAspNetCorePackageVersion}" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkOverride)' != ''">
<PackageReference Include="Microsoft.AspNetCore" Version="${MicrosoftAspNetCorePackageVersion}" />

View File

@ -23,6 +23,7 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="${MicrosoftAspNetCoreMvcPackageVersion}" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation" Version="${MicrosoftAspNetCoreMvcRazorViewCompilationPackageVersion}" PrivateAssets="All" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="${MicrosoftAspNetCoreStaticFilesPackageVersion}" />
<PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="${MicrosoftAspNetCoreHttpsPolicyPackageVersion}" />
</ItemGroup>
</Project>

View File

@ -19,6 +19,7 @@
<ItemGroup Condition="'$(TargetFrameworkOverride)' != ''">
<PackageReference Include="Microsoft.AspNetCore" Version="${MicrosoftAspNetCorePackageVersion}" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="${MicrosoftAspNetCoreMvcPackageVersion}" />
<PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="${MicrosoftAspNetCoreHttpsPolicyPackageVersion}" />
</ItemGroup>
</Project>

View File

@ -13,6 +13,16 @@
"longName": "no-restore",
"shortName": ""
},
"HttpPort": {
"isHidden": true
},
"HttpsPort": {
"isHidden": true
},
"ExcludeLaunchSettings": {
"longName": "exclude-launch-settings",
"shortName": ""
},
"RuntimeFrameworkVersion": {
"longName": "runtime-framework-version",
"shortName": "fv",
@ -22,4 +32,4 @@
"usageExamples": [
""
]
}
}

View File

@ -26,6 +26,12 @@
"exclude": [
"app.config"
]
},
{
"condition": "(ExcludeLaunchSettings)",
"exclude": [
"Properties/launchSettings.json"
]
}
]
}
@ -37,6 +43,12 @@
"datatype": "string",
"defaultValue": "2.1.0-preview2-25624-02"
},
"ExcludeLaunchSettings": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "false",
"description": "Whether to exclude launchSettings.json from the generated template."
},
"TargetFrameworkOverride": {
"type": "parameter",
"description": "Overrides the target framework",

View File

@ -0,0 +1,28 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:8080",
"sslPort": 44300
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_HTTPS_PORT": "44300"
}
},
"Company.WebApplication1": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_URLS": "https://localhost:44300;http://localhost:8080"
}
}
}
}

View File

@ -1,6 +1,5 @@
namespace Company.WebApplication1
open System
open Microsoft.AspNetCore.Builder
open Microsoft.AspNetCore.Hosting
open Microsoft.AspNetCore.Http
@ -8,12 +7,14 @@ open Microsoft.Extensions.DependencyInjection
type Startup() =
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
member this.ConfigureServices(services: IServiceCollection) =
()
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
member this.Configure(app: IApplicationBuilder, env: IHostingEnvironment) =
if env.IsDevelopment() then app.UseDeveloperExceptionPage() |> ignore
if env.IsDevelopment() then
app.UseDeveloperExceptionPage() |> ignore
app.Run(fun context -> context.Response.WriteAsync("Hello World!"))
()
app.Run(fun context -> context.Response.WriteAsync("Hello World!")) |> ignore

View File

@ -1,5 +1,5 @@
{
"$schema": "http://json.schemastore.org/dotnetcli.host",
"$schema": "http://json.schemastore.org/dotnetcli.host",
"symbolInfo": {
"HttpPort": {
"isHidden": true

View File

@ -27,17 +27,35 @@
"exclude": [
"app.config"
]
},
{
"condition": "(ExcludeLaunchSettings)",
"exclude": [
"Properties/launchSettings.json"
]
}
]
}
],
"symbols": {
"RuntimeFrameworkVersion": {
"type": "parameter",
"replaces": "2.1.0-preview2-25624-02",
"datatype": "string",
"defaultValue": "2.1.0-preview2-25624-02"
},
"ExcludeLaunchSettings": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "false",
"description": "Whether to exclude launchSettings.json from the generated template."
},
"UseBrowserLink": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "false",
"description": "Whether or not to include BrowserLink in the project"
},
"HttpPort": {
"type": "parameter",
"datatype": "integer",
@ -78,12 +96,6 @@
},
"replaces": "44300"
},
"RuntimeFrameworkVersion": {
"type": "parameter",
"replaces": "2.1.0-preview2-25624-02",
"datatype": "string",
"defaultValue": "2.1.0-preview2-25624-02"
},
"TargetFrameworkOverride": {
"type": "parameter",
"description": "Overrides the target framework",

View File

@ -1,15 +1,11 @@
namespace Company.WebApplication1
open System
open System.Collections.Generic
open System.Linq
open System.Threading.Tasks
open Microsoft.AspNetCore.Builder
open Microsoft.AspNetCore.Hosting
open Microsoft.AspNetCore.HttpsPolicy
open Microsoft.Extensions.Configuration
open Microsoft.Extensions.DependencyInjection
type Startup private () =
new (configuration: IConfiguration) as this =
Startup() then
@ -27,7 +23,9 @@ type Startup private () =
app.UseDeveloperExceptionPage() |> ignore
else
app.UseExceptionHandler("/Home/Error") |> ignore
app.UseHsts() |> ignore
app.UseHttpsRedirection() |> ignore
app.UseStaticFiles() |> ignore
app.UseMvc(fun routes ->

View File

@ -26,6 +26,12 @@
"exclude": [
"app.config"
]
},
{
"condition": "(ExcludeLaunchSettings)",
"exclude": [
"Properties/launchSettings.json"
]
}
]
}

View File

@ -1,15 +1,11 @@
namespace Company.WebApplication1
open System
open System.Collections.Generic
open System.Linq
open System.Threading.Tasks
open Microsoft.AspNetCore.Builder
open Microsoft.AspNetCore.Hosting
open Microsoft.AspNetCore.HttpsPolicy
open Microsoft.Extensions.Configuration
open Microsoft.Extensions.DependencyInjection
type Startup private () =
new (configuration: IConfiguration) as this =
Startup() then
@ -22,6 +18,12 @@ type Startup private () =
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
member this.Configure(app: IApplicationBuilder, env: IHostingEnvironment) =
if (env.IsDevelopment()) then
app.UseDeveloperExceptionPage() |> ignore
else
app.UseHsts() |> ignore
app.UseHttpsRedirection() |> ignore
app.UseMvc() |> ignore
member val Configuration : IConfiguration = null with get, set