xna 发布的项目没有内容管道? [英] xna published project without content pipeline?

查看:40
本文介绍了xna 发布的项目没有内容管道?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 XNA 中进行一个用于学习目的的个人项目.我在网上读到使用内容管道要求人们安装 xna 运行时.所以我决定使用 Texture2D.FromStream 加载文件.

I'm working on a personal project for learning purposes in XNA. I've read online that using the content pipeline requires people to have the xna runtime installed. So i've decided to load files using Texture2D.FromStream.

当我从 Visual C# 运行项目时一切正常,但是当我发布项目并运行它时,它立即崩溃了.我不确定是否有办法查看有关崩溃的更多信息,但我认为没有.我认为这归结为不使用内容管道.

Everything is fine when I'm running the project from visual c#, but when I publish the project and run it, it crashed immediatly. I'm not sure if there is a way to see more info on the crash, but I assume not. I'm thinking it's down to not using the content pipeline.

当我查看已发布项目的应用程序文件时,我只能看到 .xnb 文件.并且没有我正在使用的原始 .png 和 .xml 文件.

When I look inside the application files for the published project I only see .xnb files. and no raw .png and .xml files that I'm using.

我尝试手动将文件放在那里,但这并没有奏效.文件都在Projectname\bin\x86\Debug\Content"文件夹中.

I tried to place the files in there manually but that didn't work aswell. The files are all in the "Projectname\bin\x86\Debug\Content" folder.

有人知道吗?

编辑

我刚刚重写了我的内容管理器,因此它使用了内容管道,并且发布的项目现在可以在我的电脑上正常运行.所以我必须想办法让它在没有内容管道的情况下工作

I have just rewritten my contentmanager so it uses the content pipeline, and the published project now works fine on my pc. So I have to figure out a way to get it to work without the content pipeline

推荐答案

如果你使用 Texture2D.FromStream,你必须关心两个事实:

if you work with Texture2D.FromStream, you have to care about two facts:

  1. 您必须更改某些资源的属性:

  1. You have to change some resource's properties:

  • 编译动作:无
  • 复制到结果文件夹:始终

  • Compile action: None
  • Copy to result folder: Always

这样 xnb 就不会被构建,而是你会得到你的资源

This way the xnb won't be builded and you will get your resources instead

您必须设置合适的路径,现在您的路径中没有bin\Debug".

You have to set the appropiate path, now you have not "bin\Debug" in your path.

这篇关于xna 发布的项目没有内容管道?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆