Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update the framework to .net6.0 #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 52 additions & 50 deletions content/AspNetCore.VueJs/AspNetCore.VueJs.csproj
Original file line number Diff line number Diff line change
@@ -1,66 +1,68 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<TypeScriptToolsVersion>2.8</TypeScriptToolsVersion>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<TypeScriptToolsVersion>2.8</TypeScriptToolsVersion>
</PropertyGroup>

<ItemGroup>
<Compile Remove="VueApp\app\**" />
<Content Remove="VueApp\app\**" />
<EmbeddedResource Remove="VueApp\app\**" />
<None Remove="VueApp\app\**" />
</ItemGroup>
<ItemGroup>
<Compile Remove="VueApp\app\**" />
<Content Remove="VueApp\app\**" />
<EmbeddedResource Remove="VueApp\app\**" />
<None Remove="VueApp\app\**" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.3" />
</ItemGroup>

<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.4" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.4" />
</ItemGroup>

<Target Name="Development" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug'">

<Exec Command="node --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js isnt installed or is not on your path VAR." />
<Target Name="Development" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug'">

<Message Condition="!Exists('node_modules')" Text="Installing packages" />
<Exec Condition="!Exists('node_modules')" Command="npm install --production false" />
<Exec Command="node --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js isnt installed or is not on your path VAR." />

<Exec Command="npm run build:dev" />
</Target>
<Message Condition="!Exists('node_modules')" Text="Installing packages" />
<Exec Condition="!Exists('node_modules')" Command="npm install --production false" />

<Target Name="Production" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Release'">
<Exec Command="npm run build:dev" />
</Target>

<Exec Command="node --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js isnt installed or is not on your path VAR." />
<Target Name="Production" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Release'">

<Message Condition="!Exists('node_modules')" Text="Installing packages" />
<Exec Condition="!Exists('node_modules')" Command="npm install --production false" />
<Exec Command="node --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js isnt installed or is not on your path VAR." />

<Exec Command="npm run build:prod" />
</Target>
<Message Condition="!Exists('node_modules')" Text="Installing packages" />
<Exec Condition="!Exists('node_modules')" Command="npm install --production false" />

<ItemGroup>
<Folder Include="VueApp\common\components\" />
<Folder Include="VueApp\common\config\" />
<Folder Include="VueApp\common\design\" />
<Folder Include="VueApp\common\services\" />
<Folder Include="VueApp\common\types\" />
<Folder Include="VueApp\common\utils\" />
<Folder Include="VueApp\__tests__\" />
</ItemGroup>
<Exec Command="npm run build:prod" />
</Target>

<ItemGroup>
<Content Update="Views\IDontLikeTypeScript\Index.cshtml">
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
</ItemGroup>
<ItemGroup>
<Folder Include="VueApp\common\components\" />
<Folder Include="VueApp\common\config\" />
<Folder Include="VueApp\common\design\" />
<Folder Include="VueApp\common\services\" />
<Folder Include="VueApp\common\types\" />
<Folder Include="VueApp\common\utils\" />
<Folder Include="VueApp\__tests__\" />
</ItemGroup>

<ItemGroup>
<Content Update="Views\IDontLikeTypeScript\Index.cshtml">
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
</ItemGroup>

</Project>
2 changes: 0 additions & 2 deletions content/AspNetCore.VueJs/Controllers/IceAndFireController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
using AspNetCore.VueJs.Models;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using System.Net.Http;
using System.Threading.Tasks;

namespace AspNetCore.VueJs.Controllers
{
Expand Down
2 changes: 0 additions & 2 deletions content/AspNetCore.VueJs/Models/ErrorViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;

namespace AspNetCore.VueJs.Models
{
public class ErrorViewModel
Expand Down
47 changes: 31 additions & 16 deletions content/AspNetCore.VueJs/Program.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
var builder = WebApplication.CreateBuilder(args);

namespace AspNetCore.VueJs
// Add services to the container.
builder.Services.AddHttpClient();
builder.Services.Configure<RouteOptions>(options => options.LowercaseUrls = true);
builder.Services.AddControllersWithViews();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}

app.UseStaticFiles();

app.UseRouting();

app.UseEndpoints(endpoints =>
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}

public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
}
endpoints.MapControllerRoute(
name: "spa-route",
pattern: "{controller}/{*anything=Index}",
defaults: new { action = "Index" });

endpoints.MapControllerRoute(
name: "app-fallback",
pattern: "{*anything}/",
defaults: new { controller = "Template", action = "Index" });
});

app.Run();
14 changes: 7 additions & 7 deletions content/AspNetCore.VueJs/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"AspNetCore.VueJs": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:44203/"
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
52 changes: 0 additions & 52 deletions content/AspNetCore.VueJs/Startup.cs

This file was deleted.