0

I have a .csproj that I want to publish to a clickonce server. When I publish the application from one development computer it works and the program can be started from the server without any problems.

I download the same project from svn to another computer and try to publish it. That step kinda works, i guess, since the program is published successfully without any errors.

But when I try to start the program from the server I get the error: Application requires that assembly office version 12.0.0.0 be installed in the Global Assembly Cache(GAC) first.

Update: (also posted info in comments). I am receiving this warning on both machines though I don't know how to solve. But it's probably the cause of the problem I guess:

No way to resolve conflict between "office, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" and "office, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c". Choosing "office, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" arbitrarily. 1> Consider app.config remapping of assembly "office, Culture=neutral, PublicKeyToken=71e9bce111e9429c" from Version "12.0.0.0" [C:\Windows\assembly\GAC\office\12.0.0.0__71e9bce111e9429c\office.dll] to Version "14.0.0.0" [D:\Visual Studio\Visual Studio Tools for Office\PIA\Office14\office.dll] to solve conflict and get rid of warning.

user3532232
  • 257
  • 8
  • 19
  • 3
    That's how interop works: you need to install Office on the server. And you shouldn't, see [Office automation (Interop) on Windows Server 2012](http://stackoverflow.com/questions/14425803/office-automation-interop-on-windows-server-2012): _"Microsoft does not recommend or support server-side Automation of Office"_. – CodeCaster Jan 09 '15 at 11:06
  • But when one computer publishes the application to the server and it works but it doesn't when another computer publishes it. Doesn't that mean that there is something wrong or not installed on the computer that has problem publishing, and not the server right? Considering they're publishing the same Project. – user3532232 Jan 09 '15 at 12:22
  • Publish process does not install Office suite. And you need MS office installed on every machine where you want your app to work. That is what CodeCaster talks about. – trailmax Jan 09 '15 at 12:28
  • _"Considering they're publishing the same Project"_ - I don't believe that. I think the one not giving errors after publishing has different assembly copy settings. You can verify that by comparing the published directories. If they're truly identical, there's something else you're not telling us. – CodeCaster Jan 09 '15 at 12:28
  • I can admit I'm not a pro at this problem so there might be some vital detail I havent mentioned but I don't know what it could be. What info is relevant? So by the "published directories" you mean the files ending up on the sever? I will compare these... – user3532232 Jan 09 '15 at 12:52
  • The machine fails the prerequisites check, it doesn't have the Office 2007 PIAs installed. Download [is here](http://www.microsoft.com/en-us/download/details.aspx?id=18346). – Hans Passant Jan 09 '15 at 13:07
  • @Hans as far as I understand, OP has two development machines and one server. On both machines the build and publishing to the server succeeds. The deploy from machine 1 runs fine, the deploy from machine 2 gives the error shown by OP. That's why I think machine 1 copies those PIAs to bin, while machine 2 doesn't. So you're right in that installing the PIAs on the server (which is what I assume you mean by "the machine") will solve it; I'm just curious where the difference is between the two deploys given OP says both machines deploy the exact same project. – CodeCaster Jan 09 '15 at 13:17
  • CodeCaster is spot on. So what i've discovered is that the computer that can publish a working build of the project places an office.dll.deploy in the bin folder, just as CodeCaster predicted, and the other computers publish doesn't. I haven't figured out why though since both properties files are the same. The computer that can publish is a x64 and the other isn't. Both got office2007 installed. – user3532232 Jan 16 '15 at 07:55

1 Answers1

2

So I finally solved this. First I thougt I'd describe how the project looked. Under references there was no reference to the office.dll file though this actually ended up in the published directory when computer1, which was able to publish a working copy, published the project. Also under properties->publish->ApplicationFiles the office.dll was listed as exluded.

computer2, which couldn't publish a working project, had the same installed programs as computer1. So I tried to add the reference to office.ddl, set it to copy local and include it in applicationfiles. Now there was a office.dll copied to the published directory but the same error appeared. installed and re-installed a bunch of programs, no improvement. After I've been trying alot of randomstuff I ended up copying the dll from computer1, referenced it, set it to copy local and included it. And, voila, it worked?

user3532232
  • 257
  • 8
  • 19