D3DERR_INVALIDCALL error, TeamCity builder

泄露秘密 提交于 2019-12-10 15:08:14

问题


I've been trying to use TeamCity 4.5 in order to automate builds of an XNA project but I have a small problem. My projects compile correctly under Visual Studio 2008, but not when compiled with TeamCity as the builder. The configuration file uses the sln2008 setting, and compiling goes well for a while, but as soon as it goes compiling .png textures to .xnb, I get the following error:

[11:28:41]: [Project "Content.contentproj" (default targets):] Content\head.png Building content threw InvalidOperationException: D3DERR_INVALIDCALL
at Microsoft.Xna.Framework.Content.Pipeline.CommonHelperFunctions.InitD3D()
at Microsoft.Xna.Framework.Content.Pipeline.TextureImporter.InitD3D()
at Microsoft.Xna.Framework.Content.Pipeline.TextureImporter.Import(String filename, ContentImporterContext context)
at Microsoft.Xna.Framework.Content.Pipeline.ContentImporter`1.Microsoft.Xna.Framework.Content.Pipeline.IContentImporter.Import(String filename, ContentImporterContext context)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.ImportAssetDirectly(BuildItem item, String importerName)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.ImportAsset(BuildItem item)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAssetWorker(BuildItem item)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAsset(BuildItem item)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.RunTheBuild()
at Microsoft.Xna.Framework.Content.Pipeline.Tasks.BuildContent.RemoteProxy.RunTheBuild(BuildCoordinatorSettings settings, TimestampCache timestampCache, ITaskItem[] sourceAssets, String[]& outputContent, String[]& rebuiltContent, String[]& intermediates, Dictionary`2& dependencyTimestamps, KeyValuePair`2[]& warnings)
Inner exception: COMException: Exception from HRESULT: 0x8876086C

I do not have any ideas what is causing this. Like I said, it's able to compile .fbx models correctly as well as my ContentPipeline project and my SharedContent project (part of the solution).

What I would actually like is some pointers to what would be the source of the problem (and if possible, a solution to the problem). As far as I understand, there seems to be a problem with the D3D library. I will also remind you that this whole solution compiles under Visual Studio 2008, thus there is a small problem with TeamCity, either I haven't provided something, or something is actually incorrectly set.


回答1:


Almost certainly, Team City is running it's build process as Local System in a non-interactive mode, and not as a user that actually has the access and ability to grab the graphics device. I know I've had problems even attempting to batch process textures through a Remote Desktop interface because DirectX can't grab the graphics device.

The solution may be to see if Team City offers you the ability to request that it's builder run as a logged on user, not as Local System, or as a service, though I can't tell you that that's actually even possible in Team City.




回答2:


I don't have a solution but I've been thinking about it.

The error is D3DERR_INVALIDCALL so I'm thinking the device isn't available at that time for some reason.

1) Do the machines running the build have DirectX installed/a graphics card? I'm assuming yes since XNA requires a card with shaders but TeamCity is a build distribution so maybe it's running on a machine without it?

2) Maybe TeamCity is causing too too many Direct3D devices to be created on the same machine/process (complete guess)?

Do the model files that compile correctly use textures or are they just geometry data? I have a feeling the content builder doesn't need access to DirectX to build models but does for texture data. Can you build anything else that requires access Direct3D? Can you build a project using TeamCity that just has one texture in it's content folder?

I'm not sure if this would work but can you get more information by running DirectX in Debug Mode and looking at the output?

Hope this helps somewhat.




回答3:


XNA and DirectX 9 require a current logged in user in order to compile the Content folder.

The solution is simple, set up a build agent machine (real physical machine) with the pre-reqs for XNA (VS2008, XNA Game Studio 3.0, etc) and make it log in on startup, then create a script to run the team server agent when logged in (by placing a shortcut to the agent run script in the start up folder in the start menu).

This way the agent will run as the local user and can build as normal.

I have done this and can confirm that it works.




回答4:


Sorry to drag up an old thread but I've just run into the exact same problem trying to get TC to build my XNA project on Windows Server and wanted to help others coming across the same problem.

I've just found this article and blog which looks like a very promising solution: http://forums.create.msdn.com/forums/p/86699/532976.aspx

&

http://blogs.msdn.com/b/astebner/archive/2011/07/07/10184338.aspx

Aaron basically states that the new beta of Win Phone SDK 7.1 Beta 2 contains XNA Game Studio 4.0 Refresh Beta 2 which now allows you to build content via the content pipeline in the following types of configurations:

If your screen is locked during a build If you are running a build on a headless computer If you are running a build from a non-interactive user account

But it looks like it'll only run on Vista or above - hopefully that should include servers too. Update: Nope sadly it wont install on my Windows Server :(



来源:https://stackoverflow.com/questions/1024832/d3derr-invalidcall-error-teamcity-builder

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!