我正在使用Xamarin-Android制作应用程序,因此我需要将Build Action设置为我的google-services.json文件,但没有诸如GoogleServicesJson这样的Property,并且当我尝试编写它时,它向我显示了异常(exception):
我试图保存然后重新启动Visual Studio,但是并不能解决问题。
如果您知道如何解决此问题,请帮助我! :)
That's the file I'm clicking on
最佳答案
GoogleServicesJson
构建类型来自Xamarin.GooglePlayServices.Basement.targets
。
如果您的项目没有通过其依赖项之一安装Xamarin.GooglePlayServices.Basement
,如果我们正在谈论消息传递,则通常是Xamarin.GooglePlayServices.Gcm
或Xamarin.Firebase.Messaging
,那么您将没有可用的构建操作。
在添加了安装Basement的软件包或自己手动添加之后,您的.csproj
将包含Xamarin.GooglePlayServices.Basement.targets
的导入,并且GoogleServicesJson
将作为构建类型提供:.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')" />