问题
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:
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):
- Go to Tools -> Nuget Package Manager -> Manage Nuget Packet for solutions...
- 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.
来源:https://stackoverflow.com/questions/26489143/namespace-not-found-for-stripe-net