3

All,

I created a C# console app in VS2010 (.NET4). that hits a database and sends out emails. It works fine when I run it from VS but deploying the app to a remote server has me befuddled. All I need to do is install this app on (1) remote windows server.

Should be easy, right?

Looking at the publish settings, I don't see anything that will just build it locally without creating an installer (From a CD-Rom or DVD-ROM) and the other 2 options really don't apply either, at least by their descriptions.

So here is what I did so far:

The VS2010 publishing options that I am given are as follows:

Step #1 Picked option 3 enter image description here

Step #2 Place generated files on remote server enter image description here

Step #3 Ran the setup installer

Step #4 Get this error

enter image description here

Question

Am I approaching this correctly? If not, what do I need to do?

Thanks

Slinky
  • 5,662
  • 14
  • 76
  • 130
  • 5
    The best way yet is to just build (compile) the application and copy the artifacts (exe, configs and DLLs) output to the final destination. – tucaz Jul 23 '13 at 20:07
  • Agree .NET supports 'xcopy' deployment, just copy release build over. – Yuriy Galanter Jul 23 '13 at 20:08
  • tucaz is right in most cases although sometimes you just need to have the prerquiste libraries installed on the target system. I think with the office dll issue you can do one or the other. I would try copying as tucaz says first before installing office on the target system. – Mike Cheel Jul 23 '13 at 20:09
  • 1
    What do you reference in the project? It is stating you need office assemblies installed on the machine. Are you sending the emails using Outlook? – John Koerner Jul 23 '13 at 20:15
  • Does you `bin` have the office dll in? – dav_i Jul 23 '13 at 20:25
  • No, I am using SmtpClient. Not sure why that error is referencing "office" – Slinky Jul 23 '13 at 20:26
  • Your added screenshot doesn't help. What we need to see is the bin folder (or a list of your references). While what YuriyGalanter and @tucaz are saying is true about XCopy deployments, that only works if your deployment machine has the pre-requisites needed for your app. The error message you are getting is stating that there is a pre-requisite of Office 12 missing. – John Koerner Jul 23 '13 at 20:31

2 Answers2

3

Notice the error:

The application requires that assembly office Version 12.0.0.0 be installed in the Global Assembly Cache (GAC) first.

Refer to this answer and this MSDN question which contains the answer I have quoted below:

We solved it by going into the Applications Files dialog under the publish tab of the Project's properties and changing the office.dll assembly to Include. It had previously been set to prerequisite (auto). --Dave3182

Community
  • 1
  • 1
dav_i
  • 27,509
  • 17
  • 104
  • 136
0

It looks like your application is leveraging Microsoft Office (2003, I think) COM objects. This will require the same version of Office to be installed on your server.

If you are leveraging Office format files (.doc, .docx, .xls, .xlsx for example), you can look into 3rd party libraries that allow you to create the formatted files without Office installed. If you are just using Outlook to send the emails, you should re-implement the feature using the .NET libraries instead.

Babak Naffas
  • 12,395
  • 3
  • 34
  • 49