admin管理员组文章数量:1306270
I have a build server that has VS2022 Community installed.
If I RDP in to the server, I can build my solution no problem.
When the same MSBuild command is triggered by the Bitbucket agent running on the build server MSBuild fails stating that various packages in the solution could not be found e.g.
C:\Program Files\dotnet\sdk\9.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1064: Package EntityFramework, version 6.1.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions. [C:\bitbucketagent\temp\xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\xxxxxxxxxxxxx\build\xxxxxxxxxx.csproj::TargetFramework=net472]
0 Warning(s)
4 Error(s)
If I RDP in to the build server, go exactly the same folder then this will work perfectly.
There must be some aspect about being logged in that makes it work.
Looking at MSBuild output with the v:/diag
flag set I can see the following:
WORKING - MSBuild run on command line during RDP Session
SourceRoot
C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\
C:\Users\Administrator\.nuget\packages\
NOT WORKING - Build Runner Output
SourceRoot
C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\
C:\Windows\system32\config\systemprofile\.nuget\packages\
This tells me the build runner agent does not run as the local Administrator on the build server (which is probably a good thing).
Also the C:\Windows\system32\config\systemprofile\.nuget\packages\
does not exist where as the one for the Administrator
user does.
Further in the log:
WORKING
Output Item(s):
_ReferenceDocumentationFiles=
C:\Users\Administrator\.nuget\packages\systemponentmodel.annotations\4.7.0\ref\net461\System.ComponentModel.Annotations.xml
NuGetPackageId=System.ComponentModel.Annotations
NuGetPackageVersion=4.7.0 (TaskId:54)
This entry does not exist on the non-working diagnostic output.
This coupled with the non-existing .nuget
folder for the user the Bitbucket runner users could mean that MSBuild is unable to write to that folder.
Question: Is the behaviour when MSBuild cannot write a .nuget packaged as described above?
I have a build server that has VS2022 Community installed.
If I RDP in to the server, I can build my solution no problem.
When the same MSBuild command is triggered by the Bitbucket agent running on the build server MSBuild fails stating that various packages in the solution could not be found e.g.
C:\Program Files\dotnet\sdk\9.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1064: Package EntityFramework, version 6.1.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions. [C:\bitbucketagent\temp\xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\xxxxxxxxxxxxx\build\xxxxxxxxxx.csproj::TargetFramework=net472]
0 Warning(s)
4 Error(s)
If I RDP in to the build server, go exactly the same folder then this will work perfectly.
There must be some aspect about being logged in that makes it work.
Looking at MSBuild output with the v:/diag
flag set I can see the following:
WORKING - MSBuild run on command line during RDP Session
SourceRoot
C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\
C:\Users\Administrator\.nuget\packages\
NOT WORKING - Build Runner Output
SourceRoot
C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\
C:\Windows\system32\config\systemprofile\.nuget\packages\
This tells me the build runner agent does not run as the local Administrator on the build server (which is probably a good thing).
Also the C:\Windows\system32\config\systemprofile\.nuget\packages\
does not exist where as the one for the Administrator
user does.
Further in the log:
WORKING
Output Item(s):
_ReferenceDocumentationFiles=
C:\Users\Administrator\.nuget\packages\systemponentmodel.annotations\4.7.0\ref\net461\System.ComponentModel.Annotations.xml
NuGetPackageId=System.ComponentModel.Annotations
NuGetPackageVersion=4.7.0 (TaskId:54)
This entry does not exist on the non-working diagnostic output.
This coupled with the non-existing .nuget
folder for the user the Bitbucket runner users could mean that MSBuild is unable to write to that folder.
Question: Is the behaviour when MSBuild cannot write a .nuget packaged as described above?
Share Improve this question edited Feb 3 at 20:52 Remotec asked Feb 3 at 13:15 RemotecRemotec 10.8k28 gold badges117 silver badges159 bronze badges1 Answer
Reset to default 0The problem was that the Bitbucket agent was running under a LocalSystem
account.
This was changed to be an actual user account and the problem went away.
I guess that something about system accounts mean they don't work properly in conjunction with msbuild.
版权声明:本文标题:bitbucket pipelines - MSBuild restore packages locally but not when running on my build server - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741818993a2399249.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论