Difference between MSBuild environments, Jenkins - not Jenkins

457 views
Skip to first unread message

Glenn Jones

unread,
Jun 28, 2019, 11:16:54 AM6/28/19
to Jenkins Developers
I am trying to run a build of a C# solution in a Jenkins pipeline and am having some trouble. The step that fails is a PowerShell script that runs my C# program that runs the actual build. When I run the build outside of Jenkins, or on the Jenkins server it builds just fine. Same with running the MSBuild anywhere on this server, either just an MSBuild, using the PowerShell script or running just my build program. The problem comes when I try to run it in Jenkins.

I get the following errors when it is run inside Jenkins:

       ResolveAssemblyReference: : Warning C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605, 5)Could not resolve this reference. Could         not locate the assembly "Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL".             Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
ResolveAssemblyReference: : Warning C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605, 5)Could not resolve this reference.                  Could not locate the assembly "System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check                  to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
ResolveAssemblyReference: : Warning C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605, 5)Could not resolve this reference.                  Could not locate the assembly "System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL".                  Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
       Csc: : ERROR Attributes\ExtendedMaxLengthAttribute.cs(8,22): The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are                               you missing an assembly reference?)
       Csc: : ERROR Attributes\ExtendedMaxLengthAttribute.cs(11,68): The type or namespace name 'IClientValidatable' could not be found (are you missing a                             using directive or an assembly reference?)
       Csc: : ERROR Models\ReportModel.cs(7,21): The type or namespace name 'Reporting' does not exist in the namespace 'Microsoft' (are you missing an                               assembly reference?)
       Csc: : ERROR Attributes\ExtendedMaxLengthAttribute.cs(55,80): The type or namespace name 'ModelMetadata' could not be found (are you missing a                               using directive or an assembly reference?)
       Csc: : ERROR Attributes\ExtendedMaxLengthAttribute.cs(55,104): The type or namespace name 'ControllerContext' could not be found (are you missing a                           using directive or an assembly reference?)
       Csc: : ERROR Attributes\ExtendedMaxLengthAttribute.cs(55,28): The type or namespace name 'ModelClientValidationRule' could not be found (are you                               missing a using directive or an assembly reference?)
       Csc: : ERROR Models\ReportModel.cs(13,21): The type or namespace name 'ReportParameter' could not be found (are you missing a using directive or an                         assembly reference?)
       Csc: : ERROR Models\ReportModel.cs(71,22): The type or namespace name 'ReportParameter' could not be found (are you missing a using directive or an                         assembly reference?)
       Csc: : ERROR Models\EnrollmentBase.cs(137,23): The type 'System.Web.Mvc.IClientValidatable' is defined in an assembly that is not referenced. You must                         add a reference to assembly 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Does anyone have any idea why the build would run correctly outside of Jenkins, but fail when run inside Jenkins?

Thanks,

Glenn

Mark Waite

unread,
Jun 28, 2019, 11:21:51 AM6/28/19
to jenkinsci-dev
This is a question best asked to the Jenkins Users mailing list, rather than the Jenkins Developers mailing list.  The Jenkins Developers mailing list is used to discuss development and maintenance of software that extends Jenkins, not software that uses Jenkins.

In this case, the usual issue is that the environment is different between the working case and the non-working case.  The Windows `set` command will list environment variables.  Run it in the working and non-working cases and compare the results.

Mark Waite

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/8fb9a7fd-8b8b-418e-8c9c-8e1b2f52d40b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Thanks!
Mark Waite

Glenn Jones

unread,
Jul 1, 2019, 1:45:43 PM7/1/19
to Jenkins Developers
I was able to get this working with your help. What I did was stopped using PowerShell and instead ran the C# program in the DOS command line using the Jenkins "bat" command. Basically, I added to the code I was doing in PowerShell to the C# program and then just called the program in the pipeline using:

     bat "D:\Build\CICDMSBuild.exe <then the parameters to the program>"

It works great and I already tried on a few solutions.

Thanks all.
Reply all
Reply to author
Forward
0 new messages