Deploy a C # + Linq console application?

How to compile and deploy a C # / console application. NET3.5 that uses linq?

I wrote the ExcelDriver console application in Visual Studio 2008 (New Project> Visual C #> Windows> Console Application) that uses Excel.Interop and linq-to-sql. [1]

Build menu > Clean ExcelDriver Build menu > Build ExcelDriver 

This puts the files in the folder C: \ dev \ VisualStudio2008 \ ExcelDriver \ ExcelDriver \ bin \ Release \

 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>ExcelDriver.exe 

Which works fine when I run it.

But when I copy these 5 files to my colleague's computer and run it, it fails and complains that it cannot find System.Data.Linq. This also happens if I copy the entire project folder.

Here is the error message on the computer

 C:\ExcelDriver>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> 

Obviously, I'm missing something when compiling the application. What should I do to get ALL the assemblies and something else in one place so that I can deploy them to other machines?

[1] It was a very unhappy experience for me. Learn from my pain ... If someone offers you to write a C # application for managing Excel RUN AWAY. (It's too late for me. Save yourself!)

+4
source share
4 answers

Update .NET 3.5 on your team computer and you must be installed.

0
source

Verify that the correct version of .Net is installed on the target computer. You can use smallestdotnet.com to check

This will require a version of .NET 3.5 designed for

0
source

I had this problem before - it seems that there is no link to System.Core

open the .csproj file and add a line similar to the following:

then restart your visual studio instance - this should work

Floor

0
source

Source: https://habr.com/ru/post/1345946/


All Articles