egramtel / dotnet-bundle Goto Github PK
View Code? Open in Web Editor NEWMSBuild task and CLI tools for bundling .NET Core projects into MacOS applications (.app)
License: MIT License
MSBuild task and CLI tools for bundling .NET Core projects into MacOS applications (.app)
License: MIT License
I think this should use CFBundleName
to determine output .app name, not CFBundleDisplayName
I am using RuntimeInformation for OS specific code. This is the snippet of code:
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)){
// do windows stuff
} else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)){
// do mac stuff
}
In Avalonia 0.9.13 this works fine but in 0.10.0.preview4 it causes the application to crash on OSX, Windows is find and I do not know about the other platforms. I have found out that Dotnet.Bundle is causing the issue, not Avalonia. In Dotnet.Bulndle 0.9.12 there is no issue but in 0.9.13 it causes the crash.
The OSx Problem Report is here https://pastebin.com/L2TsVVbC
I originally reported this on Avalonia
AvaloniaUI/Avalonia/issues/4596
Hello!
Yesterday I tried to create a simple .net core 6 Console Hello World app on MacOS 12.1 (Monterey). The app itself is running fine, but when bundled into a package and running this app package, it quickly closes down after running.
I've made sure to add a Console.ReadLine() at the end.
With this really helpful library application does not handles Info.plist file creation directly, thus it make create some difficulties when we actually need to add additional properties that weren't part of bundle information.
To avoid unnecessary xml rewrites I would want to set additional msbuild properties (items group with type info?) or use additional external configuration or Info.plist template.
Hi there,
I believe I followed the instructions exactly however I am getting the error in the screenshot further below.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RuntimeIdentifiers>osx-x64</RuntimeIdentifiers>
<CFBundleName>NftJsonGen</CFBundleName> <!-- Also defines .app file name -->
<CFBundleDisplayName>NftJsonGen</CFBundleDisplayName>
<CFBundleIdentifier>com.endomint</CFBundleIdentifier>
<CFBundleVersion>1.0.0</CFBundleVersion>
<CFBundleShortVersionString>1.0.0</CFBundleShortVersionString>
<OutputType>WinExe</OutputType>
<CFBundlePackageType>APPL</CFBundlePackageType>
<CFBundleExecutable>NftJsonGen</CFBundleExecutable>
<CFBundleIconFile>Logo.icns</CFBundleIconFile> <!-- Will be copied from output directory -->
<NSPrincipalClass>NSApplication</NSPrincipalClass>
<NSHighResolutionCapable>true</NSHighResolutionCapable>
</PropertyGroup>
<ItemGroup>
<Folder Include="Models\" />
<AvaloniaResource Include="Assets\**" />
<None Remove=".gitignore" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.10" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.10" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.10" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.10" />
<PackageReference Include="Dotnet.Bundle" Version="*" />
</ItemGroup>
</Project>
I would appreciate any pointers in the right direction please.
I have also got the file list as below:
https://mike.getsharex.com/2022/01/20220129_y6MIvgrM2X.html
I followed the readme and added
<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-->
</CFBundleURLTypes>
<CFBundleURLTypes Include="dummy">
<CFBundleURLName>TestApp URL2</CFBundleURLName>
<CFBundleURLSchemes>test://</CFBundleURLSchemes>
</CFBundleURLTypes>
</ItemGroup>
to the csproj, but the only thing that is added to my plist is
<true />
I've added the nuget package to my project. Then I've added the following lines to my csproj file:
<PropertyGroup>
<CFBundleName>AppName</CFBundleName> <!-- Also defines .app file name -->
<CFBundleDisplayName>App Name</CFBundleDisplayName>
<CFBundleIdentifier>com.example</CFBundleIdentifier>
<CFBundleVersion>1.0.0</CFBundleVersion>
<CFBundlePackageType>APPL</CFBundlePackageType>
<CFBundleSignature>????</CFBundleSignature>
<CFBundleExecutable>AppName</CFBundleExecutable>
<CFBundleIconFile>icon.icns</CFBundleIconFile> <!-- Will be copied from output directory -->
<NSPrincipalClass>NSApplication</NSPrincipalClass>
</PropertyGroup>
and ran dotnet msbuild -t:BundleApp -p:RuntimeIdentifier=osx-x64
via commandline on my csproj file. But I receive this error: The target "BundleApp" does not exist in the project.
What am I doing wrong?
I have a console application made in .net and I have figured out how to use this to build it, but it doesn't seem to be working. I set my properties, set runtime targets, and run the command, and it builds to a .app just fine, but when I try to run the app it opens, crashes near instantly, then shows a 'application quit unexpectedly' popup. I have set the CFBundleExecutable correctly, when I try to run the executable directly that works as well, setting the CFPrincipalClass didn't change anything either (I'm assuming its meant to be the class where Main() is?). Same thing happens if I build it to arm64 or just x64. I am on an M1 mac, if that helps.
My source code is here
I have run the below command on my linux os:
dotnet restore -r osx-x64
dotnet msbuild -t:BundleApp -p:RuntimeIdentifier=osx-x64
then throw some error
~/.nuget/packages/dotnet.bundle/0.9.12/build/DotNet.Bundle.targets(42,5): error MSB4062: The "DotNet.Bundle.BundleAppTask" task could not be loaded from the assembly ~/.nuget/packages/dotnet.bundle/0.9.12/build/../tasks/netstandard2.0/DotNet.Bundle.dll. Could not load file or assembly '~/.nuget/packages/dotnet.bundle/0.9.12/tasks/netstandard2.0/DotNet.Bundle.dll'. The system cannot find the file specified. [~/myproject/myproject.fsproj]
~/.nuget/packages/dotnet.bundle/0.9.12/build/DotNet.Bundle.targets(42,5): error MSB4062: Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [~/myproject/myproject.fsproj]
I try to find why and I have found, because the dir ~/.nuget/packages/dotnet.bundle/0.9.12/tasks/netstandard2.0/
have the file Dotnet.Bundle.dll
not DotNet.Bundle.dll
, because file names in Linux are case sensitive but windows not so the error is only throw on linux , I have rename Dotnet.Bundle.dll
to DotNet.Bundle.dll
and run again everything is working
Does this question even make sense when publishing a .app
? I don't use MacOS so I don't really understand whether framework-dependent makes sense for it.
Not all properties are listed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.