Namespace not found for Stripe.net

2019-08-11 11:38发布

I'm trying to install a newer version of Stripe.net:
https://github.com/jaymedavis/stripe.net

  • Via Nuget, I build the Stripe.dll file
  • I create a new website project
  • I add a reference to Stripe.dll
  • I add a reference to RestSharp.dll

using System;
using Stripe;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        StripeConfiguration.SetApiKey("[your api key here]");   
    }
}

But it throws the error:

Error 1 The name 'StripeConfiguration' does not exist in the current context

I try other examples, but all throw similar errors.

1条回答
神经病院院长
2楼-- · 2019-08-11 12:09

There could be many reasons, for example, invalid build from download, or some mistake in building yourself. That is why I mostly use Nuget Package Manager.

Use the following steps:

In Visual Studio (2012):

  1. Go to Tools -> Nuget Package Manager -> Manage Nuget Packet for solutions...
  2. Searched for "Stripe.Net", Install it.

It will add all the required references.

This way you will minimize the errors which may occur during manually building the dll.

查看更多
登录 后发表回答