2

我有测试,用 C# 编写,在自动 TFS 构建中运行。其中一项测试需要管理员权限(访问证书),因此每次在自动构建/测试中都会失败。如果我以管理员身份运行 Visual Studio,则测试通过。我尝试在构建服务器(运行 Windows 7 和 TFS 2012)上禁用 UAC,但它仍然不会自动提升。有没有办法指定测试需要以管理员身份运行(类似于 app.manifest)?

4

1 回答 1

0

The TFS build service runs under a service account and builds and tests are run under the context of this account. In order to run unit tests as admin then this account would need to be a member of the administrator group on the machine.

Now doing this is potentially risky as the build service will blindly follow any instructions given to it by msbuild.

You could possibly move the certificate in to a user certificate store rather that the computer store but in not sure what impact this would have on the code you are trying to test.

于 2013-04-26T16:09:18.917 回答