refactor: 增加 build 脚本复制文件到输出目录

This commit is contained in:
Argo Zhang 2019-09-29 15:14:29 +08:00
parent c89d589f31
commit c00c04c561
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
4 changed files with 16 additions and 5 deletions

View File

@ -0,0 +1,15 @@
<Project>
<PropertyGroup>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<Target Condition=" '$(TargetFramework)' == 'netcoreapp3.0' " Name="PostBuild" AfterTargets="PostBuildEvent">
<Message Text="Copy db file -> $(TargetDir)" Importance="high" />
<Copy Condition="'$(OS)' == 'Windows_NT'" DestinationFolder="$(TargetDir)" SourceFiles="$(MSBuildThisFileDirectory)..\src\admin\keys\Longbow.lic" SkipUnchangedFiles="true" />
<Copy Condition="'$(OS)' == 'UNIX'" DestinationFolder="$(TargetDir)" SourceFiles="$(MSBuildThisFileDirectory)../src/admin/keys/Longbow.lic" SkipUnchangedFiles="true" />
<Copy Condition="'$(OS)' == 'Windows_NT'" DestinationFolder="$(TargetDir)" SourceFiles="$(MSBuildThisFileDirectory)..\src\admin\Bootstrap.Admin\BootstrapAdmin.db" SkipUnchangedFiles="true" />
<Copy Condition="'$(OS)' == 'UNIX'" DestinationFolder="$(TargetDir)" SourceFiles="$(MSBuildThisFileDirectory)../src/admin/Bootstrap.Admin/BootstrapAdmin.db" SkipUnchangedFiles="true" />
</Target>
</Project>

Binary file not shown.

View File

@ -37,10 +37,6 @@ namespace UnitTest
{
if (providerName == DatabaseProviderType.SQLite)
{
var dbPath = RetrievePath($"UnitTest{Path.DirectorySeparatorChar}DB{Path.DirectorySeparatorChar}UnitTest.db");
var dbFile = Path.Combine(AppContext.BaseDirectory, "UnitTest.db");
File.Copy(dbPath, dbFile, true);
builder.ConfigureAppConfiguration(app => app.AddInMemoryCollection(new KeyValuePair<string, string>[] {
new KeyValuePair<string, string>("DB:0:Enabled", "false"),
new KeyValuePair<string, string>("DB:1:Enabled", "true")

View File

@ -24,7 +24,7 @@
"Enabled": false,
"ProviderName": "Sqlite",
"ConnectionStrings": {
"ba": "Data Source=UnitTest.db;"
"ba": "Data Source=BootstrapAdmin.db;"
}
},
{