【问题标题】:Visual Studio Mac showing Hammer icon no run button - Xamarin.FormsVisual Studio Mac 显示 Hammer 图标没有运行按钮 - Xamarin.Forms
【发布时间】:2022-08-14 02:24:08
【问题描述】:

我有VS Mac 2022xamarin.forms 项目,android 项目设置为启动。

当我想运行app 时,没有Run 按钮,只有锤子图标出现在左上角的VS 中。我不确定这里出了什么问题。

这是安卓项目androidconfiguration file

<?xml version=\"1.0\" encoding=\"utf-8\"?>
<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">
  <PropertyGroup>
    <Configuration Condition=\" \'$(Configuration)\' == \'\' \">Debug</Configuration>
    <Platform Condition=\" \'$(Platform)\' == \'\' \">AnyCPU</Platform>
    <OutputType>Library</OutputType>
    <RootNamespace>s_Order.Droid</RootNamespace>
    <AndroidApplication>True</AndroidApplication>
    <TargetFrameworkVersion>v11.0</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=\" \'$(Configuration)|$(Platform)\' == \'Debug|AnyCPU\' \">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>portable</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\\Debug</OutputPath>
    <DefineConstants>DEBUG;</DefineConstants>
    <AndroidLinkMode>None</AndroidLinkMode>
  </PropertyGroup>
  <PropertyGroup Condition=\" \'$(Configuration)|$(Platform)\' == \'Release|AnyCPU\' \">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\\Release</OutputPath>
    <AndroidManagedSymbols>true</AndroidManagedSymbols>
    <AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
  </PropertyGroup>
  <PropertyGroup Condition=\" \'$(Configuration)|$(Platform)\' == \'Debug|AnyCPU\' \">
    <DebugSymbols>true</DebugSymbols>
    <OutputPath>bin\\Debug</OutputPath>
    <DefineConstants>DEBUG;</DefineConstants>
    <DebugType>portable</DebugType>
    <PlatformTarget>x86</PlatformTarget>
    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
    <IntermediateOutputPath></IntermediateOutputPath>
    <ConsolePause>true</ConsolePause>
    <ExternalConsole>false</ExternalConsole>
    <Commandlineparameters></Commandlineparameters>
    <RunWithWarnings>true</RunWithWarnings>
    <AndroidManagedSymbols>false</AndroidManagedSymbols>
    <MandroidExtraArgs></MandroidExtraArgs>
    <AndroidCreatePackagePerAbi>false</AndroidCreatePackagePerAbi>
    <BundleAssemblies></BundleAssemblies>
    <AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
    <EnableLLVM>false</EnableLLVM>
  </PropertyGroup>
  <PropertyGroup Condition=\" \'$(Configuration)|$(Platform)\' == \'Release|AnyCPU\' \">
    <DebugSymbols>true</DebugSymbols>
    <OutputPath>bin\\Release</OutputPath>
    <Optimize>true</Optimize>
    <DebugType>pdbonly</DebugType>
    <PlatformTarget>x86</PlatformTarget>
    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
    <ExternalConsole>false</ExternalConsole>
    <AotAssemblies></AotAssemblies>
    <AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
    <EnableLLVM>false</EnableLLVM>
    <EmbedAssembliesIntoApk></EmbedAssembliesIntoApk>
  </PropertyGroup>
</Project>

请检查下面的截图

以下是android 的编译器选项

我怎样才能解决这个问题 ?

标签: xamarin xamarin.forms visual-studio-2022 visual-studio-mac


【解决方案1】:

将项目类型 guid 和 android 清单添加到第一个属性组似乎可以解决问题。完成此操作后,Visual Studio for Mac 中的主工具栏会显示运行箭头图标而不是锤子图标:

<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>

丢失的 AndroidManifest 似乎是罪魁祸首。虽然我也必须添加项目类型 guid - 否则它似乎阻止 Visual Studio for Mac 允许将 Android 项目设置为启动项目。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-26
    • 1970-01-01
    • 2018-11-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多