0

I have created a webform that runs an executable. The executable accesses smartsheets, downloads that information to excel, and then adds info from excel into an SQL database. It then removes that smartsheet and replaces it with a blank template for the following week.

The executable works on its own.But when I run the executable from the web form it works in that it displays the windows form, shows the graphs it is mean't to, and accesses the sql database. But when I try to access smartsheets I get the following error.

See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text ************** System.IO.FileNotFoundException: Could not load file or assembly 'smartsheet-csharp-sdk, Version=1.0.6.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. File name: 'smartsheet-csharp-sdk, Version=1.0.6.0, Culture=neutral, PublicKeyToken=null' at SmartSheetAPI.Smartsheet..ctor() at SmartSheetAPI.loadPerformanceChart.commitToDataBase() in p:\Visual Studio 2013\Projects\SmartSheet\SmartSheetAPI\Graphs.cs:line 322 at SmartSheetAPI.loadPerformanceChart.commitToDatabase_Click(Object sender, EventArgs e) in p:\Visual Studio 2013\Projects\SmartSheet\SmartSheetAPI\Graphs.cs:line 306 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

I have added the smartsheet sdk reference to the web form (although I didn't think this would be necessary as it is in the windows form, and as I say the windows form on it's own can run without a problem). But it is there.

enter image description here

Does anyone know what the problem is?

Kim Brandl
  • 13,125
  • 2
  • 16
  • 21
Danrex
  • 1,657
  • 4
  • 31
  • 44
  • does it end up in your bin? – Daniel A. White Jan 07 '15 at 20:06
  • I'm not sure what you mean? – Danrex Jan 07 '15 at 20:21
  • 1
    Did you install the Smartsheet SDK using [nuget](https://www.nuget.org/packages/smartsheet-csharp-sdk/1.0.6)? Also what is the code doing on line 322 and 306 of p:\Visual Studio 2013\Projects\SmartSheet\SmartSheetAPI\Graphs.cs? – Brett Jan 07 '15 at 20:43
  • Hi Brett, line 306 runs a method from a button called commitToDataBase(). This is the method that accesses smartsheets and downloads the content. Line 326 is when it creates the object from a class SmartSheet that I created (i.e. Smartsheet smartsheet = new Smartsheet(); – Danrex Jan 07 '15 at 21:10
  • Brett, I can send you the code as I you have been helpful before and am fairly certain you work with SS? – Danrex Jan 07 '15 at 21:10
  • But as i said it is working in the Windows Form program, but it is not working as an executable that is called to from the Web Page. – Danrex Jan 07 '15 at 21:11

1 Answers1

0

I have solved the problem. The issue was that the SmartSheet SDK was sitting in the packages folder for the visual studio project. But .NET seems to have problems finding that folder during runtime - when running an executable. By copying the .dll for the SmartSheet SDK and other needed .dll's into the same folder as the executable the program ran successfully. Unless anyone can see any issues with doing it this way I am happy.

Danrex
  • 1,657
  • 4
  • 31
  • 44