2012-03-10 14 views
12

त्रुटि का उपयोग करते समय:फ़ाइल या विधानसभा लोड नहीं कर सका ICSharpCode.SharpZipLib ... nuGet पैकेज ExcelDataReader

Could not load file or assembly 'ICSharpCode.SharpZipLib, Version=0.85.5.452, Culture=neutral, PublicKeyToken=1b03e6acf1164f73' or one of its dependencies. The system cannot find the file specified.`

ढेर:

[FileNotFoundException: Could not load file or assembly 'ICSharpCode.SharpZipLib, Version=0.85.5.452, Culture=neutral, PublicKeyToken=1b03e6acf1164f73' or one of its dependencies. The system cannot find the file specified.]
Excel.Core.ZipWorker.Extract(Stream fileStream) +0
Excel.ExcelOpenXmlReader.Initialize(Stream fileStream) +78

[Asp.Net Mvc3 सी #]

का उपयोग करना NuGet पैकेज ExcelDataReader मैंने फ़ाइल सिस्टम पर सहेजी गई .xlsx फ़ाइल को खोलने का प्रयास किया। यहाँ कोड प्रयोग किया जाता है: http://exceldatareader.codeplex.com/

क्या देता है:

string filePath = HttpContext.Server.MapPath("~/blank3.xlsx"); 
FileStream stream = System.IO.File.Open(filePath, FileMode.Open, FileAccess.Read); 
IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream); 

यहाँ nuget पैकेज के लिए वेबसाइट है? यह बिना किसी झुकाव के काम करना चाहिए।

उत्तर

12

मैं एक ही मुद्दा में भाग; हल करने के लिए, मुझे उनके कोडप्लेक्स प्रोजेक्ट पर उपयुक्त मजबूत-नाम असेंबली मिली।

http://exceldatareader.codeplex.com से स्रोत कोड डाउनलोड किया गया है, उनके उदारीकरण निर्देशिका से विधानसभा को पकड़ा और अपने प्रोजेक्ट से यह संदर्भित किया है।

+2

क्या आप अपनी प्रक्रिया के साथ थोड़ा और स्पष्ट हो सकते हैं? –

0

ICSharpCode.SharpZipLib मजबूत नाम विधानसभा है। असेंबली संस्करण संख्या बिल्कुल मेल खाना चाहिए या अन्यथा यह लोड करने में विफल रहता है। कृपया असेंबली संस्करण की जांच करें।

+1

मुझे असेंबली कहां मिलेगी? इसे किसी भी पैकेज या मेरी web.config फ़ाइल में शामिल नहीं किया गया है। –

0

क्योंकि dll .net संस्करण 2.0 है, अपनी परियोजना में अधिक है, आप यह ऑटो उपयोग क्रम विधानसभा बाध्यकारी होगा nuget पैकेज प्रबंधक से पैकेज स्थापित करता है, तो,, web.config/app.config फ़ाइल यह पसंद चाहिए :

<runtime> 
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
    <dependentAssembly> 
    <assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral" /> 
    <bindingRedirect oldVersion="0.0.0.0-0.85.4.369" newVersion="0.85.4.369" /> 
    </dependentAssembly> 
</assemblyBinding> 

1

यदि आप हो रही है है:

Could not load file or assembly 'ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73' or one of its dependencies. The system cannot find the file specified.

तो समाधान डाउनलोड करने के लिए है latest (या अपनी त्रुटि के लिए version सही चुनें) ICSharpCode.SharpZipLib.dll SharpZipLib website से, और बस उस फ़ोल्डर में रखें जहां ExcelDataReader का Excel.dll स्थित है (इसे संदर्भित करने की कोई आवश्यकता नहीं है)।

संबंधित मुद्दे