Reconfigured project to publish as a single file.
This commit is contained in:
parent
1d35e8a838
commit
8abd75506c
4
Jenkinsfile
vendored
4
Jenkinsfile
vendored
@ -41,7 +41,9 @@ pipeline {
|
|||||||
}
|
}
|
||||||
stage("Publish") {
|
stage("Publish") {
|
||||||
steps {
|
steps {
|
||||||
dotnetPublish configuration: 'Release', project: 'Props', selfContained: false, unstableIfWarnings: true
|
// TODO: Archive things.
|
||||||
|
dotnetPublish configuration: 'Release', noRestore: true, project: 'Props', runtime: 'win-x64', sdk: 'Default .NET SDK'
|
||||||
|
dotnetPublish configuration: 'Release', noRestore: true, project: 'Props', runtime: 'linux-x64', sdk: 'Default .NET SDK'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,16 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<!-- https://docs.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props for more information. -->
|
<!-- https://docs.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props for more information. -->
|
||||||
|
<!-- TODO: Embed wwwroot. -->
|
||||||
|
<!-- Publish arguments: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish -->
|
||||||
|
<!-- Single file docs: https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file/overview -->
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<PublishSingleFile>true</PublishSingleFile>
|
||||||
|
<PublishReadyToRun>true</PublishReadyToRun>
|
||||||
|
<SelfContained>true</SelfContained>
|
||||||
|
<PublishTrimmed>false</PublishTrimmed>
|
||||||
|
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
||||||
|
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
|
||||||
<UserSecretsId>aspnet-Props-20A2A991-EC61-4C06-91D2-953482026A7B</UserSecretsId>
|
<UserSecretsId>aspnet-Props-20A2A991-EC61-4C06-91D2-953482026A7B</UserSecretsId>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
@ -31,14 +40,61 @@
|
|||||||
<ProjectReference Include="..\Props.Shop\Framework\Props.Shop.Framework.csproj" />
|
<ProjectReference Include="..\Props.Shop\Framework\Props.Shop.Framework.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Removing ASP.Net Core Identity static content -->
|
||||||
|
<!-- See https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity?view=aspnetcore-6.0&tabs=visual-studio#prevent-publish-of-static-identity-assets -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<ResolveStaticWebAssetsInputsDependsOn>RemoveIdentityAssets</ResolveStaticWebAssetsInputsDependsOn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Target Name="RemoveIdentityAssets">
|
||||||
|
<ItemGroup>
|
||||||
|
<StaticWebAsset Remove="@(StaticWebAsset)" Condition="%(SourceId) == 'Microsoft.AspNetCore.Identity.UI'" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- For embedding content into single file. -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<!-- See https://github.com/MicrosoftDocs/visualstudio-docs/issues/2257 -->
|
||||||
|
<EnableDefaultContentItems>false</EnableDefaultContentItems>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<!-- See https://stackoverflow.com/questions/46983930/what-content-items-does-enabledefaultcontentitems-enable -->
|
||||||
|
<!-- See https://github.com/SteveSandersonMS/WebWindow/issues/41#issuecomment-590122872 -->
|
||||||
|
<!-- See https://github.com/dotnet/sdk/blob/0e0829e55c398752ddda5cc247ef3ad722a019c2/src/WebSdk/Worker/Targets/Microsoft.NET.Sdk.Worker.props -->
|
||||||
|
<!-- See https://github.com/dotnet/sdk/blob/a30e465a2e2ea4e2550f319a2dc088daaafe5649/src/RazorSdk/Sdk/Sdk.Razor.StaticAssets.ProjectSystem.props -->
|
||||||
|
<!-- We disabled default content items to change some attributes, we will also add the rest here. -->
|
||||||
|
<Content Update="wwwroot\**" ExcludeFromSingleFile="false" CopyToOutputDirectory="PreserveNewest" />
|
||||||
|
|
||||||
|
<Content Include="**\*.config" ExcludeFromSingleFile="true" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" Condition="'$(ExcludeConfigFilesFromBuildOutput)'!='true'" />
|
||||||
|
<Content Include="**\*.json" ExcludeFromSingleFile="true" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" Condition="'$(ExcludeConfigFilesFromBuildOutput)'!='true'" />
|
||||||
|
|
||||||
|
<!-- When ExcludeConfigFilesFromBuildOutput is set, do not copy .,config, .json files to the build output directory. -->
|
||||||
|
<Content Include="**\*.config" ExcludeFromSingleFile="true" CopyToPublishDirectory="PreserveNewest" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" Condition="'$(ExcludeConfigFilesFromBuildOutput)'=='true'" />
|
||||||
|
<Content Include="**\*.json" ExcludeFromSingleFile="true" CopyToPublishDirectory="PreserveNewest" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" Condition="'$(ExcludeConfigFilesFromBuildOutput)'=='true'" />
|
||||||
|
|
||||||
|
<!-- Set CopyToOutputDirectory and CopyToPublishDirectory to Never for items under AppDesignerFolder ("Properties", by default) to avoid publishing launchSettings.json -->
|
||||||
|
<Content Update="$(AppDesignerFolder)\**" CopyToOutputDirectory="Never" CopyToPublishDirectory="Never" Condition="'$(AppDesignerFolder)' != ''" />
|
||||||
|
|
||||||
|
<!-- Remove Content items from other item types -->
|
||||||
|
<None Remove="wwwroot\**;**\*.json;**\*.config" />
|
||||||
|
<Compile Remove="wwwroot\**" />
|
||||||
|
<EmbeddedResource Remove="wwwroot\**" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Modules for all the shops. -->
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="shops\**\*" CopyToOutputDirectory="PreserveNewest" ExcludeFromSingleFile="true" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Watch configurations. -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Watch Include="assets\**\*.js;assets\**\*.scss" Exclude="wwwroot\**\*;node_modules\**\*;**\*.js.map;obj\**\*;bin\**\*" />
|
<Watch Include="assets\**\*.js;assets\**\*.scss" Exclude="wwwroot\**\*;node_modules\**\*;**\*.js.map;obj\**\*;bin\**\*" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" !Exists('node_modules') ">
|
|
||||||
|
|
||||||
<!-- Ensure Node.js is installed -->
|
<!-- Ensure Node.js is installed -->
|
||||||
<Exec Command="node --version" ContinueOnError="true">
|
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" !Exists('node_modules') ">
|
||||||
|
<Exec Command="node --version" ContinueOnError="false">
|
||||||
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
|
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
|
||||||
</Exec>
|
</Exec>
|
||||||
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
|
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
|
||||||
@ -48,7 +104,15 @@
|
|||||||
|
|
||||||
<!-- Build static resources -->
|
<!-- Build static resources -->
|
||||||
<Target Name="BuildWebpack" BeforeTargets="Build">
|
<Target Name="BuildWebpack" BeforeTargets="Build">
|
||||||
<Exec Command="npm run build:dev" Condition=" '$(Configuration)' == 'Debug' " LogStandardErrorAsError="true" />
|
<Message Importance="high" Text="Building client-side assets..." />
|
||||||
<Exec Command="npm run build:prod" Condition=" '$(Configuration)' == 'Release' " LogStandardErrorAsError="true" />
|
<Exec Command="npm run build:dev" Condition=" '$(Configuration)' == 'Debug' " LogStandardErrorAsError="true">
|
||||||
|
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
|
||||||
|
</Exec>
|
||||||
|
<Exec Command="npm run build:prod" Condition=" '$(Configuration)' == 'Release' " LogStandardErrorAsError="true">
|
||||||
|
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
|
||||||
|
</Exec>
|
||||||
|
<Error Condition="'$(ErrorCode)' != '0'" Text="There was an issue attempting to build the static assets. To continue, fix client-side asset errors and try again." />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
@ -5,7 +5,7 @@ import shutil
|
|||||||
|
|
||||||
|
|
||||||
PROP_SHOP_MODULES_DIR = "./Props.Shop/"
|
PROP_SHOP_MODULES_DIR = "./Props.Shop/"
|
||||||
PROPS_SHOP_MODULES_DST = "./Props/shops/"
|
PROPS_SHOP_MODULES_DST = "./Props/shops/."
|
||||||
NET_VER = "net6.0"
|
NET_VER = "net6.0"
|
||||||
|
|
||||||
SHOP_MODULE_GLOB = "**/bin/Release/{net_ver}/publish/*.{ext}"
|
SHOP_MODULE_GLOB = "**/bin/Release/{net_ver}/publish/*.{ext}"
|
||||||
@ -15,11 +15,12 @@ EXTS = ["deps.json", "dll"]
|
|||||||
def load():
|
def load():
|
||||||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||||
os.chdir("..")
|
os.chdir("..")
|
||||||
|
os.makedirs(os.path.dirname(PROPS_SHOP_MODULES_DST), exist_ok=True)
|
||||||
for ext in EXTS:
|
for ext in EXTS:
|
||||||
results = glob(os.path.join(PROP_SHOP_MODULES_DIR,
|
results = glob(os.path.join(PROP_SHOP_MODULES_DIR,
|
||||||
SHOP_MODULE_GLOB.format(net_ver=NET_VER, ext=ext)))
|
SHOP_MODULE_GLOB.format(net_ver=NET_VER, ext=ext)))
|
||||||
for result in results:
|
for result in results:
|
||||||
shutil.copy(result, os.path.abspath(PROPS_SHOP_MODULES_DST))
|
shutil.copy(result, PROPS_SHOP_MODULES_DST)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user