Cannot access mapped drive from build agent

We are using version 8.1 (build 29879)
The build agent works with "agent.bat start" from the command line and not as a service.
In our build agent machine we have a mapped drive X:\ which is connected to "IP\SharedFolder"
If we use visual studio directly we can build the solution without any problems.
If we use teamcity build agent then it cannot find the files that are located in the mapped drive.
Shouldn't this work since the agent is not started as a service?
The mapped drive has been configured to "connect using different credentials", not sure if that helps.

5 comments
Comment actions Permalink

Hi,

Yes, it should work if you start agent via console.
Can you please try to run the build on the agent machine and under the same user that the agent is running. The detailed steps are described in doc.

0
Comment actions Permalink

Hi Alina,

thanks for the answer. I did that, but no joy.
The build step uses powershell to run.
I run the same script under the same user account from the powershell command line and it works.
So, I guess this is a bug?

0
Comment actions Permalink

How did you setup drive mapping, is it persistent or do you define it in build script?
Can you please add "net use" command to your build script. Are the command outputs the same for build running in TeamCity and from console?
Also please post the whole error from build log.

0
Comment actions Permalink

I defined the drive mapping using windows explorer (Windows Key + E) -> Map Network Drive with "Reconnect at logon" option and "Connect using different credentials" selected.
I am not using "net use" at all.
The error is simply MY_PROJECT_PATH\stdafx.h(27): fatal error C1083: Cannot open include file: 'FILE_IN_THIRD_PARTY_DRIVE': No such file or directory [MY_PROJECT_PATH\PROJECT_NAME.vcxproj]

After adding "net use" to the powershell script I get:

[09:14:12][Step 2/3] New connections will be remembered.
[09:14:12][Step 2/3]
[09:14:12][Step 2/3]
[09:14:12][Step 2/3] Status       Local     Remote                    Network
[09:14:12][Step 2/3]
[09:14:12][Step 2/3] -------------------------------------------------------------------------------
[09:14:12][Step 2/3] Unavailable  X:        \\IP\SharedFoldery   Microsoft Windows Network
[09:14:12][Step 2/3] Disconnected           \\IP\SharedFolder Microsoft Windows Network


The same script with the same user when called from powershell works correctly:



Status       Local     Remote                    Network

-------------------------------------------------------------------------------
OK           X:        \\ACTIFYDC-EDI\3rdParty   Microsoft Windows Network
The command completed successfully.

0
Comment actions Permalink

Can you please also add command "whoami" to check that user account is the same?
If you run TC agent via console (not as service), on the same machine and under the same session then "net use" command should return the same result in build log and in console. Please check that everything is configured correctly. Why remote names are not the same? It does not look like a bug on TC side.

0

Please sign in to leave a comment.