0
votes

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.

1
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: "Microsoft does not recommend or support server-side Automation of Office".CodeCaster
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
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
"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
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

1 Answers

2
votes

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?