.NET 用戶端程式庫
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
.NET 用戶端程式庫託管於 GitHub,並以 NuGet 套件形式發布。這個程式庫提供多項功能,可協助您使用 API,包括更輕鬆地管理憑證,以及建立 Google Ads API 服務用戶端。
程式庫支援下列 .NET Framework:
- .NET Framework 4.7.2 以上版本 (
net472
)
- .NET Standard 2.1 (
netstandard2.1
)
- .NET 6.0 (
net6.0
)
- .NET 8.0 (
net8.0
)
.NET Standard 2.1 與其他多個 .NET 版本和實作項目相容,因此程式庫可能在許多其他平台上都能正常運作。不過,我們尚未正式測試相容性,因此不正式支援這些平台。如要進一步瞭解 .NET 標準相容性,請參閱 https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-1
。
Google Ads API .NET 程式庫預設使用 Grpc.Net.Client
,在不支援的平台上則會改用 Grpc.Core
。如要強制使用 Grpc.Core
,請將 UseGrpcCore
設為 true
。請參閱「使用舊版 Grpc 程式庫」。
如要開始使用這個程式庫,請先查看必要條件,並參閱入門指南。
如要瞭解 OAuth2 更新權杖,請參閱 OAuth 電腦和網頁應用程式流程。如要使用 OAuth2 服務帳戶發出 API 呼叫,請參閱 OAuth 服務帳戶流程。
如要瞭解程式庫的功能和實用工具,請參閱下列指南:
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-26 (世界標準時間)。
[null,null,["上次更新時間:2025-08-26 (世界標準時間)。"],[[["\u003cp\u003eThe Google Ads API client library for .NET will no longer support .NET 5.0 starting with version 19.0.0, and users should upgrade to a supported version before the end of 2024.\u003c/p\u003e\n"],["\u003cp\u003eThe library supports .NET Framework 4.7.2+, .NET Standard 2.1, .NET 6.0, and .NET 8.0.\u003c/p\u003e\n"],["\u003cp\u003eIt is available as a NuGet package and hosted on GitHub, providing features for easier credential management and service client creation.\u003c/p\u003e\n"],["\u003cp\u003eWhile .NET Standard 2.1 offers compatibility with various .NET versions and implementations, only the explicitly listed frameworks are officially supported.\u003c/p\u003e\n"],["\u003cp\u003eUsers can find comprehensive documentation and guides, covering setup, OAuth flows, logging, and advanced features on the official Google Ads API website.\u003c/p\u003e\n"]]],[],null,["# The .NET Client Library\n\nThe .NET client library is [hosted on GitHub](https://github.com/googleads/google-ads-dotnet) and is distributed\nas a [NuGet package](//www.nuget.org/packages/Google.Ads.GoogleAds/). It\noffers several features to help you use the API, including easier management\nof credentials and creation of Google Ads API service clients.\n\nThe library supports the following .NET Frameworks:\n\n- .NET Framework 4.7.2+ (`net472`)\n- .NET Standard 2.1 (`netstandard2.1`)\n- .NET 6.0 (`net6.0`)\n- .NET 8.0 (`net8.0`)\n\n.NET Standard 2.1 is compatible with several other .NET versions and\nimplementations, so the library might work fine on many other platforms.\nHowever, we haven't officially tested the compatibility and thus don't\nofficially support these platforms.\nSee https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-1\nto learn more about .NET standard compatibility.\n\nThe Google Ads API .NET library uses `Grpc.Net.Client` as the default, with a\nfallback to `Grpc.Core` on unsupported platforms. You can force the use of\n`Grpc.Core` by setting `UseGrpcCore` to `true`. See\n[Use the legacy Grpc library](/google-ads/api/docs/client-libs/dotnet/getting-started).\n\nTo start using this library, check the\n[prerequisites](/google-ads/api/docs/get-started/introduction) and consult the\n[getting started guide](/google-ads/api/docs/client-libs/dotnet/getting-started).\n\nFor information on OAuth2 refresh tokens, check out [OAuth desktop and web\napplication flows](/google-ads/api/docs/client-libs/dotnet/oauth-web). And to make API calls\nusing OAuth2 service accounts, see [OAuth service account\nflow](/google-ads/api/docs/client-libs/dotnet/oauth-service).\n\nConsult the following guides for the library's features and utilities:\n\n- [Logging](/google-ads/api/docs/client-libs/dotnet/logging)\n- [FieldMasks](/google-ads/api/docs/client-libs/dotnet/field-masks)\n- [ResourceNames](/google-ads/api/docs/client-libs/dotnet/resource-names)\n- [Custom gRPC interceptors](/google-ads/api/docs/client-libs/dotnet/custom-interceptors)\n- [Protocol buffer types](/google-ads/api/docs/client-libs/dotnet/working-with-protobuf)"]]