Skip to content
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
17 changes: 8 additions & 9 deletions DotNet.Bundle/DotNet.Bundle.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<NoPackageAnalysis>true</NoPackageAnalysis>
<BuildOutputTargetFolder>tasks</BuildOutputTargetFolder>
<Version>0.9.14</Version>
<Version>0.10.0</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup>
<Content Include="build\*.*">
<Content Include="build/*.*">
<Pack>true</Pack>
<PackagePath>build\</PackagePath>
<PackagePath>build/</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Build.Framework" Version="15.1.1012" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="15.1.1012" />
<PackageReference Update="@(PackageReference)" PrivateAssets="All" />
<PackageReference Include="Microsoft.Build.Framework" Version="17.13.9" PrivateAssets="All" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.13.9" PrivateAssets="All" />
</ItemGroup>

</Project>
7 changes: 3 additions & 4 deletions DotNet.Bundle/build/DotNet.Bundle.targets
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project TreatAsLocalProperty="TaskFolder;TaskAssembly">

<PropertyGroup>
<TaskFolder>netstandard2.0</TaskFolder>
<TaskAssembly>$(MSBuildThisFileDirectory)..\tasks\$(TaskFolder)\DotNet.Bundle.dll</TaskAssembly>
<TaskFolder>net8.0</TaskFolder>
<TaskAssembly>$(MSBuildThisFileDirectory)../tasks/$(TaskFolder)/DotNet.Bundle.dll</TaskAssembly>
</PropertyGroup>

<UsingTask TaskName="DotNet.Bundle.BundleAppTask" AssemblyFile="$(TaskAssembly)" />

<Target Name="BundleApp" DependsOnTargets="Publish">

<PropertyGroup>
Expand Down Expand Up @@ -58,7 +58,6 @@
NSRequiresAquaSystemAppearance="$(NSRequiresAquaSystemAppearance)"
CFBundleURLTypes="@(CFBundleURLTypes)"
/>

</Target>

</Project>
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,24 @@ dotnet msbuild -t:BundleApp -p:RuntimeIdentifier=osx-x64 [-p: ...]

### Properties

Define properties to override default bundle values
Define properties to override default bundle values. Check [TestBundle.csproj](TestBundle/TestBundle.csproj) for a working example.

```
<PropertyGroup>
<CFBundleName>AppName</CFBundleName> <!-- Also defines .app file name -->
<CFBundleDisplayName>App Name</CFBundleDisplayName>
<CFBundleIdentifier>com.example</CFBundleIdentifier>
<CFBundleIdentifier>com.example.app</CFBundleIdentifier>
<CFBundleShortVersionString>1.0.0</CFBundleShortVersionString>
<CFBundleVersion>1.0.0</CFBundleVersion>
<CFBundlePackageType>APPL</CFBundlePackageType>
<CFBundleSignature>????</CFBundleSignature>
<CFBundleExecutable>AppName</CFBundleExecutable>
<CFBundleIconFile>AppName.icns</CFBundleIconFile> <!-- Will be copied from output directory -->
<NSPrincipalClass>NSApplication</NSPrincipalClass>
<NSHighResolutionCapable>true</NSHighResolutionCapable>

<!-- Optional -->
<NSRequiresAquaSystemAppearance>true</NSRequiresAquaSystemAppearance>
</PropertyGroup>

<!-- Optional URLTypes -->
<ItemGroup>
<!-- Optional URLTypes.Check TestBundle.csproj for a working example. -->
<CFBundleURLTypes Include="dummy"> <!-- The name of this file is irrelevant, it's a MSBuild requirement.-->
<CFBundleURLName>TestApp URL</CFBundleURLName>
<CFBundleURLSchemes>testappurl;testappurl://</CFBundleURLSchemes> <!-- Note the ";" separator-->
Expand Down
6 changes: 6 additions & 0 deletions TestBundle/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace TestBundle;

public class Program
{

}
56 changes: 24 additions & 32 deletions TestBundle/TestBundle.csproj
Original file line number Diff line number Diff line change
@@ -1,53 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<OutputPath>..\Build\$(Configuration)\</OutputPath>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
<RuntimeIdentifiers>osx-x64</RuntimeIdentifiers>
<RestoreSources>$(RestoreSources);..\\Dotnet.Bundle\\bin\\$(Configuration)\\</RestoreSources>
<DotnetBundleTestVersion>9.9.999952</DotnetBundleTestVersion>
<CustomCommands>
<CustomCommands>
<Command>
<type>BeforeBuild</type>
<command>dotnet pack ..\\Dotnet.Bundle\\ -p:Configuration=$(Configuration) -p:PackageVersion=$(DotnetBundleTestVersion)</command>
</Command>
<Command>
<type>BeforeBuild</type>
<command>dotnet restore</command>
</Command>
<Command>
<type>AfterBuild</type>
<command>dotnet msbuild -t:BundleApp -p:RuntimeIdentifier=osx-x64 -p:Configuration=$(Configuration)</command>
</Command>
</CustomCommands>
</CustomCommands>
<DotnetBundleTestVersion>0.10.0</DotnetBundleTestVersion>
</PropertyGroup>

<!-- Pack DotNet.Bundle for testing -->
<Target Name="BeforeBuildCommands" BeforeTargets="Build">
<Exec Command="dotnet pack ../Dotnet.Bundle/ -p:Configuration=$(Configuration) -p:PackageVersion=$(DotnetBundleTestVersion)" />
</Target>
<!-- Package using DotNet.Bundle -->
<!-- SkipAfterBuild is a hack to prevent an infinite build loop as running this calls on itself -->
<Target Name="AfterBuildCommands" AfterTargets="Build" Condition="'$(SkipAfterBuild)' != 'true'">
<Exec Command="dotnet msbuild -t:BundleApp -p:RuntimeIdentifier=osx-x64 -p:Configuration=$(Configuration) -p:SkipAfterBuild=true" />
</Target>

<ItemGroup>
<PackageReference Include="DotNet.Bundle" Version="*" />
</ItemGroup>

<!-- Defines Info.plist -->
<PropertyGroup>
<CFBundleName>TestBundle</CFBundleName>
<CFBundleDisplayName>TestBundle</CFBundleDisplayName>
<CFBundleShortVersionString>TestBundle</CFBundleShortVersionString>
<CFBundleDisplayName>Test Bundle</CFBundleDisplayName>
<CFBundleIdentifier>org.test.testbundle</CFBundleIdentifier>
<CFBundleShortVersionString>1.0.0</CFBundleShortVersionString>
<CFBundleVersion>1.0.0</CFBundleVersion>
<CFBundleIconFile>IconTest.icns</CFBundleIconFile>
<NSPrincipalClass>NSApplication</NSPrincipalClass>
<CFBundlePackageType>AAPL</CFBundlePackageType>
<CFBundleSignature>4242</CFBundleSignature>
<NSRequiresAquaSystemAppearance>false</NSRequiresAquaSystemAppearance>
<CFBundlePackageType>APPL</CFBundlePackageType>
<NSHighResolutionCapable>false</NSHighResolutionCapable>
</PropertyGroup>
<ItemGroup>
<CFBundleURLTypes Include="dummy">
<CFBundleURLName>TestApp URL</CFBundleURLName>
<CFBundleURLName>org.test.testbundle</CFBundleURLName>
<CFBundleURLSchemes>testappurl;testappurl://</CFBundleURLSchemes>
</CFBundleURLTypes>
<CFBundleURLTypes Include="dummy">
<CFBundleURLName>TestApp URL2</CFBundleURLName>
<CFBundleURLName>org.test.testbundle</CFBundleURLName>
<CFBundleURLSchemes>test://</CFBundleURLSchemes>
</CFBundleURLTypes>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Dotnet.Bundle" Version="$(DotnetBundleTestVersion)" />
</ItemGroup>
</Project>