Note that there are some explanatory texts on larger screens.

plurals
  1. PODeploy a C# + Linq console application?
    text
    copied!<p><strong>How do I compile and deploy a C#/.NET3.5 console application that uses linq?</strong></p> <p>I wrote a console app "ExcelDriver" in Visual Studio 2008 (New Project > Visual C# > Windows > Console Application) that uses Excel.Interop and linq-to-sql. [1]</p> <pre><code>Build menu &gt; Clean ExcelDriver Build menu &gt; Build ExcelDriver </code></pre> <p>This puts files in the folder C:\dev\VisualStudio2008\ExcelDriver\ExcelDriver\bin\Release\</p> <pre><code>Directory of C:\dev\VisualStudio2008\ExcelDriver\ExcelDriver\bin\Release 03/30/2011 02:17 PM 12,800 ExcelDriver.exe 03/25/2011 12:14 PM 411 ExcelDriver.exe.config 03/30/2011 02:17 PM 26,112 ExcelDriver.pdb 03/30/2011 01:32 PM 1,093,632 Interop.Excel.dll 03/30/2011 01:32 PM 417,792 Interop.Microsoft.Office.Core.dll 5 File(s) 1,550,747 bytes C:\dev\VisualStudio2008\ExcelDriver\ExcelDriver\bin\Release&gt;ExcelDriver.exe </code></pre> <p>Which works perfectly when I run it.</p> <p>But when I copy these 5 files to my co-worker's computer and run, it fails and complains that it can't find System.Data.Linq. This also happens if I copy the entire project folder over. </p> <p>Here's the error message on the coworker machine</p> <pre><code>C:\ExcelDriver&gt;ExcelDriver.exe Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass embly 'System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c 561934e089' or one of its dependencies. The system cannot find the file specifie d. File name: 'System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b 77a5c561934e089' at ExcelDriver.Program.Main(String[] args) WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\M icrosoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure lo gging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fus ion!EnableLog]. C:\ExcelDriver&gt; </code></pre> <p><strong>Clearly I am missing something when I compile the app. What must I do to get ALL the assemblies and whatnot into one place so I can deploy to other machines?</strong></p> <p>[1] It's been a very unhappy experience for me. Learn from my pain... If anyone ever suggests to you to write a C# app to control Excel RUN AWAY. (It's too late for me. Save yourself!)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload