c# - Newtonsoft.Json Assembly Conflict -
i use netonsoft.json in project. works fine until start integrating paypal sdk in project. code below.
string accesstoken = new paypal.oauthtokencredential("", "").getaccesstoken(); ---->>>> line throwing error paypal.api.payments.address add = new paypal.api.payments.address(); add.city = textboxcity.text; add.line1 = textboxaddress.text; add.phone = textboxphonenumber.text; add.postal_code = textboxzipcode.text; add.state = textboxstate.text; paypal.api.payments.creditcard cc = new paypal.api.payments.creditcard(); cc.number = textboxcreditcardnumber.text; cc.first_name = textboxfirstname.text; cc.last_name = textboxlastname.text; cc.expire_month = convert.toint16(textboxexpirymonth.text); cc.expire_year = convert.toint16(textboxexpiryyear.text); cc.cvv2 = textboxcvvnumber.text; cc.billing_address = add; cc.create(accesstoken);
and error below
system.io.fileloadexception: not load file or assembly 'newtonsoft.json, version=4.5.0.0, culture=neutral, publickeytoken=30ad4fe6b2a6aeed' or 1 of dependencies. located assembly's manifest definition not match assembly reference. (exception hresult: 0x80131040)
i search on internet , found solution change config file. change config file below
<assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentassembly> <assemblyidentity name="newtonsoft.json" publickeytoken="30ad4fe6b2a6aeed" culture="neutral"/> <bindingredirect oldversion="0.0.0.0-3.5.0.0" newversion="4.5.0.0" /> </dependentassembly> </assemblybinding>
i play around assembly properties copy local, specific version nothing helps me solve this. how can solve assembly conflict?
i had same problem , solved updating newtonsoft.json latest version using
update-package newtonsoft.json
and going web.config , adding:
<dependentassembly> <assemblyidentity name="newtonsoft.json" publickeytoken="30ad4fe6b2a6aeed"/> <bindingredirect oldversion="0.0.0.0-4.5.0.0" newversion="5.0.8"/> </dependentassembly>
Comments
Post a Comment