我在 .NET Core 3.1.200 中有一个带有此 PublishProfile 的应用程序,用于定位 osx-x64:
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PublishDir>bin\Release\netcoreapp3.1\publish\</PublishDir>
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>True</PublishSingleFile>
<PublishReadyToRun>False</PublishReadyToRun>
<PublishTrimmed>False</PublishTrimmed>
</PropertyGroup>
</Project>
我已经运行dotnet publish myapp.cproj /p:PublishProfile=profile.xml
,最后 /publish 文件夹包含一个文件“myapp”(这是正确的,因为 PublishSingleFile=True)。
但它没有扩展名。如何在 MacOS 上运行它?
编辑:我发现我可以简单地从终端运行它./myapp
。但是如何通过双击Finder来运行它呢?目前,它显示: