Added ASC.Api.Core.csproj

added build.bat
PeopleController replaced to ASC.People
This commit is contained in:
pavelbannov 2019-05-29 17:44:37 +03:00
parent f76bb1e7d6
commit c2d61517a5
18 changed files with 130 additions and 117 deletions

View File

@ -1,43 +1,55 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 16
VisualStudioVersion = 16.0.28803.202 VisualStudioVersion = 16.0.28803.202
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Web.Studio", "web\ASC.Web.Studio\ASC.Web.Studio.csproj", "{90183112-BCD6-4E16-9CA2-12231930DAB4}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Web.Studio", "web\ASC.Web.Studio\ASC.Web.Studio.csproj", "{90183112-BCD6-4E16-9CA2-12231930DAB4}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Web.Api", "web\ASC.Web.Api\ASC.Web.Api.csproj", "{4AA9F8E3-2F48-44DA-B6C5-37ED7A4739C1}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Web.Api", "web\ASC.Web.Api\ASC.Web.Api.csproj", "{4AA9F8E3-2F48-44DA-B6C5-37ED7A4739C1}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Common", "common\ASC.Common\ASC.Common.csproj", "{EB8F47B3-39DE-4B7D-8EC6-01726368B45D}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Common", "common\ASC.Common\ASC.Common.csproj", "{EB8F47B3-39DE-4B7D-8EC6-01726368B45D}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Core.Common", "common\ASC.Core.Common\ASC.Core.Common.csproj", "{A51D0454-4AFA-46DE-89D4-B03D37E1816C}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Core.Common", "common\ASC.Core.Common\ASC.Core.Common.csproj", "{A51D0454-4AFA-46DE-89D4-B03D37E1816C}"
EndProject EndProject
Global Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.People", "products\ASC.People\ASC.People.csproj", "{BE4816E7-7CD2-4D9B-ABC6-D9E5C04E3926}"
GlobalSection(SolutionConfigurationPlatforms) = preSolution EndProject
Debug|Any CPU = Debug|Any CPU Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ASC.Api.Core", "common\ASC.Api.Core\ASC.Api.Core.csproj", "{62C49C91-1A5A-4C0D-A3B3-A9AE8C9718CE}"
Release|Any CPU = Release|Any CPU EndProject
EndGlobalSection Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
{90183112-BCD6-4E16-9CA2-12231930DAB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
{90183112-BCD6-4E16-9CA2-12231930DAB4}.Debug|Any CPU.Build.0 = Debug|Any CPU Release|Any CPU = Release|Any CPU
{90183112-BCD6-4E16-9CA2-12231930DAB4}.Release|Any CPU.ActiveCfg = Release|Any CPU EndGlobalSection
{90183112-BCD6-4E16-9CA2-12231930DAB4}.Release|Any CPU.Build.0 = Release|Any CPU GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4AA9F8E3-2F48-44DA-B6C5-37ED7A4739C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {90183112-BCD6-4E16-9CA2-12231930DAB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4AA9F8E3-2F48-44DA-B6C5-37ED7A4739C1}.Debug|Any CPU.Build.0 = Debug|Any CPU {90183112-BCD6-4E16-9CA2-12231930DAB4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4AA9F8E3-2F48-44DA-B6C5-37ED7A4739C1}.Release|Any CPU.ActiveCfg = Release|Any CPU {90183112-BCD6-4E16-9CA2-12231930DAB4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4AA9F8E3-2F48-44DA-B6C5-37ED7A4739C1}.Release|Any CPU.Build.0 = Release|Any CPU {90183112-BCD6-4E16-9CA2-12231930DAB4}.Release|Any CPU.Build.0 = Release|Any CPU
{EB8F47B3-39DE-4B7D-8EC6-01726368B45D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4AA9F8E3-2F48-44DA-B6C5-37ED7A4739C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EB8F47B3-39DE-4B7D-8EC6-01726368B45D}.Debug|Any CPU.Build.0 = Debug|Any CPU {4AA9F8E3-2F48-44DA-B6C5-37ED7A4739C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB8F47B3-39DE-4B7D-8EC6-01726368B45D}.Release|Any CPU.ActiveCfg = Release|Any CPU {4AA9F8E3-2F48-44DA-B6C5-37ED7A4739C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB8F47B3-39DE-4B7D-8EC6-01726368B45D}.Release|Any CPU.Build.0 = Release|Any CPU {4AA9F8E3-2F48-44DA-B6C5-37ED7A4739C1}.Release|Any CPU.Build.0 = Release|Any CPU
{A51D0454-4AFA-46DE-89D4-B03D37E1816C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EB8F47B3-39DE-4B7D-8EC6-01726368B45D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A51D0454-4AFA-46DE-89D4-B03D37E1816C}.Debug|Any CPU.Build.0 = Debug|Any CPU {EB8F47B3-39DE-4B7D-8EC6-01726368B45D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A51D0454-4AFA-46DE-89D4-B03D37E1816C}.Release|Any CPU.ActiveCfg = Release|Any CPU {EB8F47B3-39DE-4B7D-8EC6-01726368B45D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A51D0454-4AFA-46DE-89D4-B03D37E1816C}.Release|Any CPU.Build.0 = Release|Any CPU {EB8F47B3-39DE-4B7D-8EC6-01726368B45D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection {A51D0454-4AFA-46DE-89D4-B03D37E1816C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
GlobalSection(SolutionProperties) = preSolution {A51D0454-4AFA-46DE-89D4-B03D37E1816C}.Debug|Any CPU.Build.0 = Debug|Any CPU
HideSolutionNode = FALSE {A51D0454-4AFA-46DE-89D4-B03D37E1816C}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection {A51D0454-4AFA-46DE-89D4-B03D37E1816C}.Release|Any CPU.Build.0 = Release|Any CPU
GlobalSection(ExtensibilityGlobals) = postSolution {BE4816E7-7CD2-4D9B-ABC6-D9E5C04E3926}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
SolutionGuid = {62783077-E041-40BA-A406-E7EF12CAFF2D} {BE4816E7-7CD2-4D9B-ABC6-D9E5C04E3926}.Debug|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection {BE4816E7-7CD2-4D9B-ABC6-D9E5C04E3926}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobal {BE4816E7-7CD2-4D9B-ABC6-D9E5C04E3926}.Release|Any CPU.Build.0 = Release|Any CPU
{62C49C91-1A5A-4C0D-A3B3-A9AE8C9718CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{62C49C91-1A5A-4C0D-A3B3-A9AE8C9718CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{62C49C91-1A5A-4C0D-A3B3-A9AE8C9718CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{62C49C91-1A5A-4C0D-A3B3-A9AE8C9718CE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {62783077-E041-40BA-A406-E7EF12CAFF2D}
EndGlobalSection
EndGlobal

14
build/build.bat Normal file
View File

@ -0,0 +1,14 @@
PUSHD %~dp0
echo "ASC.Web.Components"
cd ../web/ASC.Web.Components
call npm install
echo "ASC.Web.sln"
cd ../../
call dotnet build ASC.Web.sln
echo "ASC.People"
call dotnet publish products/ASC.People --self-contained -r win10-x64 -o build/deploy
echo "ASC.Web.Api"
call dotnet publish web/ASC.Web.Api --self-contained -r win10-x64 -o build/deploy

View File

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<ApplicationIcon />
<OutputType>Library</OutputType>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ASC.Common\ASC.Common.csproj" />
<ProjectReference Include="..\ASC.Core.Common\ASC.Core.Common.csproj" />
</ItemGroup>
</Project>

View File

@ -29,6 +29,7 @@ namespace ASC.Web.Api.Middleware
var currentBody = context.Response.Body; var currentBody = context.Response.Body;
using var memoryStream = new MemoryStream(); using var memoryStream = new MemoryStream();
context.Response.Body = memoryStream; context.Response.Body = memoryStream;
await next(context); await next(context);

View File

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:65458/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"ASC.Api.Core": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:65459/"
}
}
}

View File

@ -22,6 +22,11 @@
<None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" /> <None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\common\ASC.Api.Core\ASC.Api.Core.csproj" />
</ItemGroup>
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') "> <Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
<!-- Ensure Node.js is installed --> <!-- Ensure Node.js is installed -->
<Exec Command="node --version" ContinueOnError="true"> <Exec Command="node --version" ContinueOnError="true">

View File

@ -1,44 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace ASC.People.Controllers
{
[Route("api/[controller]")]
public class SampleDataController : Controller
{
private static string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
[HttpGet("[action]")]
public IEnumerable<WeatherForecast> WeatherForecasts()
{
var rng = new Random();
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
DateFormatted = DateTime.Now.AddDays(index).ToString("d"),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
});
}
public class WeatherForecast
{
public string DateFormatted { get; set; }
public int TemperatureC { get; set; }
public string Summary { get; set; }
public int TemperatureF
{
get
{
return 32 + (int)(TemperatureC / 0.5556);
}
}
}
}
}

View File

@ -1,11 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore; using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace ASC.People namespace ASC.People
{ {

View File

@ -1,9 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}

View File

@ -1,8 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*"
}

View File

@ -6,16 +6,12 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0-preview4-19216-03" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0-preview4-19216-03" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0-preview3.19153.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0-preview3.19153.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.0.0-preview3.19153.1" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.0.0-preview3.19153.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0-preview5-19264-04" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0-preview5-19264-04" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\common\ASC.Api.Core\ASC.Api.Core.csproj" />
<ProjectReference Include="..\..\common\ASC.Common\ASC.Common.csproj" /> <ProjectReference Include="..\..\common\ASC.Common\ASC.Common.csproj" />
<ProjectReference Include="..\..\common\ASC.Core.Common\ASC.Core.Common.csproj" /> <ProjectReference Include="..\..\common\ASC.Core.Common\ASC.Core.Common.csproj" />
</ItemGroup> </ItemGroup>

View File

@ -9,10 +9,14 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using System.Runtime.Loader;
using ASC.Common.Logging; using ASC.Common.Logging;
using ASC.Web.Api.Handlers; using ASC.Web.Api.Handlers;
using ASC.Web.Api.Middleware; using ASC.Web.Api.Middleware;
using System.Linq;
using System.Reflection;
using System.IO;
namespace ASC.Web.Api namespace ASC.Web.Api
{ {
@ -35,13 +39,19 @@ namespace ASC.Web.Api
services.AddAuthentication("cookie").AddScheme<AuthenticationSchemeOptions, CookieAuthHandler>("cookie", a=> { }); services.AddAuthentication("cookie").AddScheme<AuthenticationSchemeOptions, CookieAuthHandler>("cookie", a=> { });
services.AddMvc(config => var assemblies = Directory.GetFiles(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ASC*.dll").Select(Assembly.LoadFrom);
var builder = services.AddMvc(config =>
{ {
var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build(); var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build();
config.Filters.Add(new TypeFilterAttribute(typeof(FormatFilter))); config.Filters.Add(new TypeFilterAttribute(typeof(FormatFilter)));
config.Filters.Add(new AuthorizeFilter(policy)); config.Filters.Add(new AuthorizeFilter(policy));
}); });
foreach (var a in assemblies) {
builder.AddApplicationPart(a);
}
services.AddLogManager(Configuration); services.AddLogManager(Configuration);
} }