无法将构建操作设置为GoogleServiceJson [英] Can't set Build Action to GoogleServiceJson
问题描述
我正在使用Xamarin-Android制作应用程序,因此我需要将Build Action设置为我的google-services.json文件,但是没有诸如GoogleServicesJson这样的Property,并且当我尝试只编写它时,它告诉我一个例外:
I'm working with Xamarin-Android to make an application, so I need to set Build Action to my google-services.json file but there is no such Property as GoogleServicesJson, and when I try just to write it, it shows me an exception:
类型为'System.Runtime.InteropServices.ExternalException'的异常被扔了.
Exception of type 'System.Runtime.InteropServices.ExternalException' was thrown.
我试图保存然后重新启动Visual Studio,但是并不能解决问题.
I tried to save and then restart Visual Studio, but it didn't solve the problem.
如果您知道如何解决此问题,请帮助我!:)
这就是我要点击的文件
If you know how to solve this problem, please help me! :)
That's the file I'm clicking on
推荐答案
GoogleServicesJson
构建类型来自 Xamarin.GooglePlayServices.Basement.targets
.
如果您的项目未通过其依赖项之一安装 Xamarin.GooglePlayServices.Basement
,通常是 Xamarin.GooglePlayServices.Gcm
或 Xamarin.Firebase.Messaging
如果我们正在谈论消息传递,那么您将没有可用的构建操作.
If your project does not have Xamarin.GooglePlayServices.Basement
installed via one of its dependents, usually Xamarin.GooglePlayServices.Gcm
or Xamarin.Firebase.Messaging
if we are talking about messaging, then you will not have that build action available.
在添加了安装Basement的软件包或自己手动添加之后,您的 .csproj
将包含 Xamarin.GooglePlayServices.Basement.targets
和的导入GoogleServicesJson
将作为构建类型提供:
After adding a package that installs Basement, or manually adding it yourself, your .csproj
will contain an import for Xamarin.GooglePlayServices.Basement.targets
and GoogleServicesJson
will be available as a build type:
.csproj
导入示例:
<Import Project="..\packages\Xamarin.GooglePlayServices.Basement.42.1001.0\build\MonoAndroid70\Xamarin.GooglePlayServices.Basement.targets" Condition="Exists('..\packages\Xamarin.GooglePlayServices.Basement.42.1001.0\build\MonoAndroid70\Xamarin.GooglePlayServices.Basement.targets')" />
这篇关于无法将构建操作设置为GoogleServiceJson的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!