C# program opens Word docx (not doc) from command line, fails in JenkinsInterop.Word Documents.Open is nullopen word doc with c#Unable to open word document from jenkinsBest way to parse command line arguments in C#?Applying a .docm template to existing .doc/.docx files in MS Word, is it possible?Locking Word fields with Visual Studio C# program using Interop.Word - out of rangeRead DOC and DOCX files in C#Filesystem Hook for .doc open C#Editing Word Doc Programmatically C#Word2013 interop not open password file having length > 15 in C#Create, insert text and save a Word doc in C#Interop GetActiveObject(“Word.Application”) not recognizing open Word doc?

Should I accept an invitation to give a talk from someone who might review my proposal?

How does ssh-copy-id get the public key when only the private key is loaded?

Why did some Apollo missions carry a grenade launcher?

What force enables us to walk? Friction or normal reaction?

How well would the Moon protect the Earth from an Asteroid?

Why does aggregate initialization not work anymore since C++20 if a constructor is explicitly defaulted or deleted?

What are the cons of stateless password generators?

Alternatives to minimizing loss in regression

How to have poached eggs in "sphere form"?

Complaints from (junior) developers against solution architects: how can we show the benefits of our work and improve relationships?

Is it okay for me to decline a project on ethical grounds?

Do the books ever say oliphaunts aren’t elephants?

What is the reason for cards stating "Until end of turn, you don't lose this mana as steps and phases end"?

Have two feature in matrix command

Did Vladimir Lenin have a cat?

Why is my fluorescent tube orange on one side, white on the other and dark in the middle?

Why is it "on the inside" and not "in the inside"?

Why did Windows 95 crash the whole system but newer Windows only crashed programs?

Classic vs Modern Experience

How to store my pliers and wire cutters on my desk?

Why force the nose of 737 Max down in the first place?

How do I make my photos have more impact?

Unknown indication below upper stave

Do 3/8 (37.5%) of Quadratics Have No x-Intercepts?



C# program opens Word docx (not doc) from command line, fails in Jenkins


Interop.Word Documents.Open is nullopen word doc with c#Unable to open word document from jenkinsBest way to parse command line arguments in C#?Applying a .docm template to existing .doc/.docx files in MS Word, is it possible?Locking Word fields with Visual Studio C# program using Interop.Word - out of rangeRead DOC and DOCX files in C#Filesystem Hook for .doc open C#Editing Word Doc Programmatically C#Word2013 interop not open password file having length > 15 in C#Create, insert text and save a Word doc in C#Interop GetActiveObject(“Word.Application”) not recognizing open Word doc?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















Running on Windows 10
I have a C# program that (among other things) opens, modifies, and writes a Word document (docx, not doc).
It works fine from the command line.
But run in Jenkins, the Documents.Open() call returns null



I have read the following on StackOverflow:
Unable to open word document from jenkins
open word doc with c#
Interop.Word Documents.Open is null



I have added C:WindowsSystem32configsystemfileDesktop and C:WindowsSysWOW64configsystemfileDesktop
Result: program hangs on Documents.Open (System32 didn't change anything; SysWOW64 resulted in the hang)



using Word = Microsoft.Office.Interop.Word;

// … lots of stuff

var wordApplication = new Word.Application();

wordApplication.Visible = false;
Word.Application wordApp = null;
if (wordApplication != null)
wordApp = wordApplication as Word.Application;
Word.Document wordDoc = null;
if (wordApp != null)
if(!IsFileinUse(reportPath))

// this line is the problem.
// It works from the command line
// In Jenkins, it either returns null or hangs
wordDoc = wordApp.Documents.Open(reportPath.FullName);




I expect it to behave in Jenkins as it does from Command Prompt: open the file successfully and allow the operations -- not hang or return null.










share|improve this question





















  • 1





    Why are you using office interop and not OpenXML? Office interop is not supported for servier side applications like jenkins.

    – Scott Chamberlain
    Mar 27 at 0:49











  • You cannot run interactive applications as BACKGROUND process. Maybe if you suprime the open step, your program could be work

    – JRichardsz
    Mar 27 at 1:26

















0















Running on Windows 10
I have a C# program that (among other things) opens, modifies, and writes a Word document (docx, not doc).
It works fine from the command line.
But run in Jenkins, the Documents.Open() call returns null



I have read the following on StackOverflow:
Unable to open word document from jenkins
open word doc with c#
Interop.Word Documents.Open is null



I have added C:WindowsSystem32configsystemfileDesktop and C:WindowsSysWOW64configsystemfileDesktop
Result: program hangs on Documents.Open (System32 didn't change anything; SysWOW64 resulted in the hang)



using Word = Microsoft.Office.Interop.Word;

// … lots of stuff

var wordApplication = new Word.Application();

wordApplication.Visible = false;
Word.Application wordApp = null;
if (wordApplication != null)
wordApp = wordApplication as Word.Application;
Word.Document wordDoc = null;
if (wordApp != null)
if(!IsFileinUse(reportPath))

// this line is the problem.
// It works from the command line
// In Jenkins, it either returns null or hangs
wordDoc = wordApp.Documents.Open(reportPath.FullName);




I expect it to behave in Jenkins as it does from Command Prompt: open the file successfully and allow the operations -- not hang or return null.










share|improve this question





















  • 1





    Why are you using office interop and not OpenXML? Office interop is not supported for servier side applications like jenkins.

    – Scott Chamberlain
    Mar 27 at 0:49











  • You cannot run interactive applications as BACKGROUND process. Maybe if you suprime the open step, your program could be work

    – JRichardsz
    Mar 27 at 1:26













0












0








0








Running on Windows 10
I have a C# program that (among other things) opens, modifies, and writes a Word document (docx, not doc).
It works fine from the command line.
But run in Jenkins, the Documents.Open() call returns null



I have read the following on StackOverflow:
Unable to open word document from jenkins
open word doc with c#
Interop.Word Documents.Open is null



I have added C:WindowsSystem32configsystemfileDesktop and C:WindowsSysWOW64configsystemfileDesktop
Result: program hangs on Documents.Open (System32 didn't change anything; SysWOW64 resulted in the hang)



using Word = Microsoft.Office.Interop.Word;

// … lots of stuff

var wordApplication = new Word.Application();

wordApplication.Visible = false;
Word.Application wordApp = null;
if (wordApplication != null)
wordApp = wordApplication as Word.Application;
Word.Document wordDoc = null;
if (wordApp != null)
if(!IsFileinUse(reportPath))

// this line is the problem.
// It works from the command line
// In Jenkins, it either returns null or hangs
wordDoc = wordApp.Documents.Open(reportPath.FullName);




I expect it to behave in Jenkins as it does from Command Prompt: open the file successfully and allow the operations -- not hang or return null.










share|improve this question
















Running on Windows 10
I have a C# program that (among other things) opens, modifies, and writes a Word document (docx, not doc).
It works fine from the command line.
But run in Jenkins, the Documents.Open() call returns null



I have read the following on StackOverflow:
Unable to open word document from jenkins
open word doc with c#
Interop.Word Documents.Open is null



I have added C:WindowsSystem32configsystemfileDesktop and C:WindowsSysWOW64configsystemfileDesktop
Result: program hangs on Documents.Open (System32 didn't change anything; SysWOW64 resulted in the hang)



using Word = Microsoft.Office.Interop.Word;

// … lots of stuff

var wordApplication = new Word.Application();

wordApplication.Visible = false;
Word.Application wordApp = null;
if (wordApplication != null)
wordApp = wordApplication as Word.Application;
Word.Document wordDoc = null;
if (wordApp != null)
if(!IsFileinUse(reportPath))

// this line is the problem.
// It works from the command line
// In Jenkins, it either returns null or hangs
wordDoc = wordApp.Documents.Open(reportPath.FullName);




I expect it to behave in Jenkins as it does from Command Prompt: open the file successfully and allow the operations -- not hang or return null.







c# jenkins ms-word office-interop






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 27 at 0:36







TheBick

















asked Mar 26 at 20:27









TheBickTheBick

596 bronze badges




596 bronze badges










  • 1





    Why are you using office interop and not OpenXML? Office interop is not supported for servier side applications like jenkins.

    – Scott Chamberlain
    Mar 27 at 0:49











  • You cannot run interactive applications as BACKGROUND process. Maybe if you suprime the open step, your program could be work

    – JRichardsz
    Mar 27 at 1:26












  • 1





    Why are you using office interop and not OpenXML? Office interop is not supported for servier side applications like jenkins.

    – Scott Chamberlain
    Mar 27 at 0:49











  • You cannot run interactive applications as BACKGROUND process. Maybe if you suprime the open step, your program could be work

    – JRichardsz
    Mar 27 at 1:26







1




1





Why are you using office interop and not OpenXML? Office interop is not supported for servier side applications like jenkins.

– Scott Chamberlain
Mar 27 at 0:49





Why are you using office interop and not OpenXML? Office interop is not supported for servier side applications like jenkins.

– Scott Chamberlain
Mar 27 at 0:49













You cannot run interactive applications as BACKGROUND process. Maybe if you suprime the open step, your program could be work

– JRichardsz
Mar 27 at 1:26





You cannot run interactive applications as BACKGROUND process. Maybe if you suprime the open step, your program could be work

– JRichardsz
Mar 27 at 1:26












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55365703%2fc-sharp-program-opens-word-docx-not-doc-from-command-line-fails-in-jenkins%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55365703%2fc-sharp-program-opens-word-docx-not-doc-from-command-line-fails-in-jenkins%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript