I have a powershell script that runs msbuild just fine to build a .NET application in a stnadard powershell window. When I run the same script from bamboo, C# language features are missing. E.g. "The type or namespace name 'List<>' could not be found." What needs to be done to have the script run "normally" from bamboo?
Thanks,
Jay
Hi Jay,
As you say that you are able to execute the same script from PowerShell, it is possible that you are running the Bamboo agent as a different user in Windows (especially if you are starting the agent as a service, you might be running as LOCAL SYSTEM user and this user account has a different environment and home).
Is it possible for you to switch the user account as which the service is running to run as a local user as which you start via console? The process to switch to a local account is explained in this page.
If you have recently upgraded Bamboo to 6.10 or above, you may also want to update the agent wrapper. This is stated in the Bamboo 6.10 "Version-specific upgrade notes" section of the Bamboo upgrade guide and it is possible that this might have been missed. I will add the same below for reference:
Remote agent wrapper update
To address some knows issues, we updated the Tanuki wrapper used for Bamboo remote agent. Bamboo 6.10 is released with new version of the wrapper. If you're an upgrading user, we strongly recommend that you reinstall the wrapper to benefit from all bug fixes.
To update the wrapper on a remote agent:
- Stop the original agent.
- Backup the BAMBOO_AGENT_HOME/conf/wrapper.conf file.
- Remove the BAMBOO_AGENT_HOME/conf directory.
- Download a new Remote Agent JAR from your Bamboo Server: http://<BAMBOO_URL>/admin/agent/addRemoteAgent.action.
- Launch the remote agent.
- This will create a new wrapper.conf file. If you want to re-enact your custom configuration in that file, you can do it now.
Hope that helps. Please share the outcome with us.
Cheers,
Jey
Indeed it was the user that bamboo was running withing Services. You have to make sure Visual Studio will build the project under a user that bamboo is running as.
Thanks!
Jay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your update, Jay. I'm afraid it isn't clear to me if your Bamboo server is running as a Local User instead of Local System already and if you are seeing this when running on a remote agent or on a local agent. I wrote an article on the same explaining the need:
Also, did you do a Bamboo upgrade recently? If so, you may have to run the agent wrapper update as I pointed earlier.
That being said, as you see that the same command works via console, I'm confident that this issue will not be seen when you start Bamboo via console by running <bamboo-install>\bin\start-bamboo.bat or your agent via <bamboo-agent-home>\bin\
StartBambooAgent-NT.bat
Cheers,
Jey
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jey,
We are using a new install of Atlassian Bamboo version 7.0.4 build 70018 - 14 May 20
We have to run as a local user, not local system, in order for the build to work: i.e. to see C# basic features such as Int32 and System, etc.
I found that /t:Restore is perhaps the main missing feature and not having it is the cause of my issue in general. Here is the full list of MSBuild flags/parameters that work for me.
/t:Rebuild /t:Restore /p:Configuration=Release /p:AppxBundle=Always /p:AppxBundlePlatforms="x64" /p:Platform=x64
Jay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
P.S., Jey,
I have not tried your suggestions for starting Bamboo. I didn't set it up, our Admin did.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for clarifying. I trust the suggestion I have proposed worked for you.
Cheers,
Jey
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.