Team City fails to compile on Convert.ToDouble from Decimal

I am getting the following TeamCity Compile error: Forms\frmQBwizard.cs(615, 84): error CS1503: Argument 2: cannot convert from 'double' to 'decimal?'

In actuality I am converting from Decimal to Double.
The line of code it refers to is: invoice.addLineItem(drow["QBcode"].ToString(), Convert.ToDouble(drow["QTY"]), Convert.ToDouble(drow["PRICE"]), drow["feeName"].ToString());
The problem parts are: Convert.ToDouble(drow["QTY"]), Convert.ToDouble(drow["PRICE"])

FYI-I get 2 errors in TC that reference each segment of this line of code.
drow is a datarow in a foreach loop. The underlying data of drow["QTY"] is decimal,3 and drow["PRICE"] is money
I have tried a direct conversion to decimal like this: Convert.ToDouble((decimal)drow["QTY"]) But still wont work.
This is legacy code which has been around for at least 3 years. TC had been successfully compiling this code using VS2013. We recently changed the TC compiler to VS2019 and now it doesn't work. Can anyone please provide some insight as to why this won't compile? Thanks

P.S. I thought I had posted this last week but cannot find a reference to it. So if this is a duplicate, I apologize. 

0
4 comments

Hi,

 

I have not seen this before, so I think your last message did not get posted at all. The error is coming from the compiler itself, which is Microsoft own's, TeamCity delegates to it to perform the tasks. If this is legacy code, then it might not work under new rules of the compiler? If it works on your IDE, consider that it might be using a different compatibility mode, or running the VS2013 compiler even if you are using VS2019.

 

You might want to consider building the legacy code on its own build configuration that is running under VS2013 instead of 2019, generating an artifact (the library it creates) and then using this artifact for your builds that require it.

 

If none of that helps, please take the following steps to troubleshoot the core of the issue, and report it as described if needed: https://www.jetbrains.com/help/teamcity/common-problems.html#CommonProblems-BuildworkslocallybutfailsormisbehavesinTeamCity

0
Avatar
Permanently deleted user

Denis, Thanks for the update. Can I have 2 build configurations running on the same Build Agent? Or do I need to install a second Build Agent. Which leads me to this question: Can I have 2 build Agents running on a single Server? Or do they have to run on separate machines?

Any detailed information you can provide me in this process would be greatly appreciated.

Thanks.

0
Avatar
Permanently deleted user

Denis,

In reviewing my installation I have found on a project's  Agent Compatibility that it has an unmet requirement of

  • MSBuildTools12.0_x86_Path exists

What does this mean and how to overcome it?

Thanks

0

Hi,

 

any agent can build any build configuration it's compatible with, just to reinforce what I mentioned before. If you want to run them in parallel, then yes, do need a second build agent, which can run on the same machine, but you need to keep in mind possible conflicts if the builds will access absolute paths.

 

Regarding the agent requirement, that means that the build agent is not detecting the msbuild tools installed in the machine. Make sure that visual studio, SDKs, the msbuild tools, etc are installed as required to run the builds.

 

To be more specific, a Visual Studio or MSBuild build configuration creates a set of agent requirements, which basically mean that the build agents need to match them for the build agent to be able to run the build. More info on that here: https://www.jetbrains.com/help/teamcity/configuring-agent-requirements.html

0

Please sign in to leave a comment.