Exception compiling code ONLY when running through Jenkins

18 views
Skip to first unread message

patnlo

unread,
Oct 27, 2022, 11:52:50 PM10/27/22
to Jenkins Users
I have what should be a simple project, using msbuild for VS2019 to build a particular configuration of my solution. When I run in Visual Studio it works. When I run via msbuild from the command line it works. When I try to build the project using MSbuild in Jenkins it fails. When I try to run msbuild via a command prompt through Jenkins it fails. It gives me the " error : Exception has been thrown by the target of an invocation." every time. 

The developers don't have any idea how to fix it because it never fails from Visual Studio, only when the job is sent from Jenkins. FYI, I can rebuild this entire solution for my windows release through Jenkins with no issues. It only fails when trying to compile our VisualGDB platform for my linux configurations. And again, only fails when the compile is started by Jenkins.

I'm stumped.

Arnaud bourree

unread,
Oct 28, 2022, 12:55:04 AM10/28/22
to jenkins...@googlegroups.com
Does your build requires display?
Did you try on your linux without display set?

Regardes, 

Arnaud 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/7b686d72-5349-4c44-95fd-775c4080b00fn%40googlegroups.com.

Fabian Cenedese

unread,
Oct 28, 2022, 2:20:48 AM10/28/22
to jenkins...@googlegroups.com
At 19:10 27.10.2022, you wrote:

>I have what should be a simple project, using msbuild for VS2019 to build a particular configuration of my solution. When I run in Visual Studio it works. When I run via msbuild from the command line it works. When I try to build the project using MSbuild in Jenkins it fails. When I try to run msbuild via a command prompt through Jenkins it fails. It gives me the " error : Exception has been thrown by the target of an invocation." every time.
>
>The developers don't have any idea how to fix it because it never fails from Visual Studio, only when the job is sent from Jenkins. FYI, I can rebuild this entire solution for my windows release through Jenkins with no issues. It only fails when trying to compile our VisualGDB platform for my linux configurations. And again, only fails when the compile is started by Jenkins.

Jenkins probably runs as a different user than when you log in
into your build agent yourself. Try to imitate what Jenkins is doing
e.g. ssh as jenkins into the build agent and start the build.
The environment variables might be different, rights, PATH etc

bye Fabi

Reply all
Reply to author
Forward
0 new messages