Migrating to csproj from xproj, Fixing connection string in Prod
This commit is contained in:
Родитель
4bf39158c2
Коммит
d223a5e05c
|
@ -0,0 +1,22 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26403.7
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WakeYourPcWebApp", "src\WakeYourPcWebApp\WakeYourPcWebApp.csproj", "{69153DAD-655F-4E43-9B29-17FC3DFDB083}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{69153DAD-655F-4E43-9B29-17FC3DFDB083}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{69153DAD-655F-4E43-9B29-17FC3DFDB083}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{69153DAD-655F-4E43-9B29-17FC3DFDB083}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{69153DAD-655F-4E43-9B29-17FC3DFDB083}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
31
WebApp.sln
31
WebApp.sln
|
@ -1,31 +0,0 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{775C5B72-BE70-4876-AD5E-66D0A63CD1A3}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{681D2F97-C287-4E52-91D5-9F27F9CDB9F0}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
global.json = global.json
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WakeYourPcWebApp", "src\WakeYourPcWebApp\WakeYourPcWebApp.xproj", "{3FD65277-3577-4ADF-BF83-05A471BE901C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3FD65277-3577-4ADF-BF83-05A471BE901C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3FD65277-3577-4ADF-BF83-05A471BE901C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3FD65277-3577-4ADF-BF83-05A471BE901C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3FD65277-3577-4ADF-BF83-05A471BE901C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{3FD65277-3577-4ADF-BF83-05A471BE901C} = {775C5B72-BE70-4876-AD5E-66D0A63CD1A3}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,6 +1 @@
|
|||
{
|
||||
"projects": [ "src", "test" ],
|
||||
"sdk": {
|
||||
"version": "1.0.0-preview2-003131"
|
||||
}
|
||||
}
|
||||
{"projects":["src","test"]}
|
|
@ -5,17 +5,22 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace WakeYourPcWebApp.Models
|
||||
{
|
||||
public class WakeupContext : DbContext
|
||||
{
|
||||
private readonly IConfigurationRoot _configuration;
|
||||
private ILogger _logger;
|
||||
|
||||
public WakeupContext(IConfigurationRoot configuration, DbContextOptions dbContextOptions)
|
||||
public WakeupContext(IConfigurationRoot configuration,
|
||||
DbContextOptions dbContextOptions,
|
||||
ILogger<WakeupContext> logger)
|
||||
: base(dbContextOptions)
|
||||
{
|
||||
_configuration = configuration;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public DbSet<User> Users { get; set; }
|
||||
|
@ -25,7 +30,8 @@ namespace WakeYourPcWebApp.Models
|
|||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
optionsBuilder.UseSqlServer(_configuration["Data:connectionStrings:DefaultConnection"]);
|
||||
var connString = _configuration["ConnectionStrings:DefaultConnection"];
|
||||
optionsBuilder.UseSqlServer(connString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,8 @@ namespace WakeYourPcWebApp
|
|||
|
||||
var builder = new ConfigurationBuilder()
|
||||
.SetBasePath(_env.ContentRootPath)
|
||||
.AddJsonFile("config.json")
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: false)
|
||||
.AddEnvironmentVariables();
|
||||
|
||||
_config = builder.Build();
|
||||
|
@ -69,12 +70,16 @@ namespace WakeYourPcWebApp
|
|||
config.CreateMap<UserViewModel, User>().ReverseMap();
|
||||
});
|
||||
|
||||
|
||||
//if (env.IsDevelopment())
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
loggerFactory.AddDebug();
|
||||
loggerFactory.AddDebug(LogLevel.Information);
|
||||
loggerFactory.AddConsole(LogLevel.Information);
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
loggerFactory.AddDebug(LogLevel.Error);
|
||||
}
|
||||
|
||||
app.UseStaticFiles();
|
||||
|
||||
|
@ -95,7 +100,6 @@ namespace WakeYourPcWebApp
|
|||
});
|
||||
|
||||
context.Database.Migrate();
|
||||
|
||||
seeder.EnsureSeedData().Wait();
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||
<AssemblyName>WakeYourPcWebApp</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<PackageId>WakeYourPcWebApp</PackageId>
|
||||
<RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>
|
||||
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
|
||||
<SignAssembly>False</SignAssembly>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Properties\PublishProfiles\FolderProfile.pubxml" />
|
||||
<None Remove="Properties\PublishProfiles\wakeyourpc - Web Deploy.pubxml" />
|
||||
<None Remove="Properties\PublishProfiles\wakeyourpc-staging - Web Deploy.pubxml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="wwwroot\**\*">
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration.Tools" Version="1.0.0-preview2-final" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.TagHelpers" Version="1.1.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="1.1.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.1">
|
||||
<PrivateAssets>All</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0-preview3-final">
|
||||
<PrivateAssets>All</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.2" />
|
||||
<PackageReference Include="AutoMapper" Version="6.0.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,25 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>3fd65277-3577-4adf-bf83-05a471be901c</ProjectGuid>
|
||||
<RootNamespace>WakeYourPcWebApp</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<DnxInvisibleContent Include="bower.json" />
|
||||
<DnxInvisibleContent Include=".bowerrc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Server=(localdb)\\MSSQLLocalDB;Database=WakeupDb;Trusted_Connection=true;MultipleActiveResultSets=true;"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"Data": {
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"Data": {
|
||||
"connectionStrings": {
|
||||
"defaultConnection": "Server=(localdb)\\MSSQLLocalDB;Database=WakeupDb;Trusted_Connection=true;MultipleActiveResultSets=true;"
|
||||
}
|
||||
|
||||
},
|
||||
"Password": "Temp Password"
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"version": "1.0.1",
|
||||
"type": "platform"
|
||||
},
|
||||
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
|
||||
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
|
||||
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
|
||||
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
|
||||
"Microsoft.Extensions.Logging.Console": "1.0.0",
|
||||
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
|
||||
"Microsoft.AspNetCore.Mvc": "1.0.1",
|
||||
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.1",
|
||||
"Microsoft.EntityFrameworkCore": "1.0.1",
|
||||
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
|
||||
"Microsoft.Extensions.Configuration.Json": "1.0.0",
|
||||
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.1",
|
||||
"Microsoft.EntityFrameworkCore.Tools": {
|
||||
"version": "1.0.0-preview3-final",
|
||||
"type": "build"
|
||||
},
|
||||
"Microsoft.EntityFrameworkCore.Tools.DotNet": {
|
||||
"version": "1.0.0-preview3-final",
|
||||
"type": "build"
|
||||
},
|
||||
"Microsoft.EntityFrameworkCore.Design": "1.0.1",
|
||||
"AutoMapper": "5.2.0",
|
||||
"Microsoft.Extensions.Logging.Debug": "1.1.1"
|
||||
},
|
||||
|
||||
"tools": {
|
||||
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
|
||||
"Microsoft.EntityFrameworkCore.Tools": {
|
||||
"version": "1.0.0-preview3-final",
|
||||
"imports": [
|
||||
"portable-net45+win8+dnxcore50",
|
||||
"portable-net45+win8"
|
||||
]
|
||||
},
|
||||
"Microsoft.EntityFrameworkCore.Tools.DotNet": {
|
||||
"version": "1.0.0-preview3-final",
|
||||
"imports": [
|
||||
"portable-net45+win8+dnxcore50",
|
||||
"portable-net45+win8"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
"imports": [
|
||||
"dotnet5.6",
|
||||
"portable-net45+win8"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
"buildOptions": {
|
||||
"emitEntryPoint": true,
|
||||
"preserveCompilationContext": true
|
||||
},
|
||||
|
||||
"runtimeOptions": {
|
||||
"configProperties": {
|
||||
"System.GC.Server": true
|
||||
}
|
||||
},
|
||||
|
||||
"publishOptions": {
|
||||
"include": [
|
||||
"wwwroot",
|
||||
"web.config"
|
||||
]
|
||||
},
|
||||
|
||||
"scripts": {
|
||||
"prepublish": [ "npm install", "bower install" ],
|
||||
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
|
||||
}
|
||||
}
|
|
@ -7,6 +7,8 @@
|
|||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
|
||||
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="true"
|
||||
stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
|
||||
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
|
|
Загрузка…
Ссылка в новой задаче