如何让IE打开带有相关应用程序的文件?

时间:2022-06-07 07:28:32

MSTest produces an XML file with a .trx extension containing test results.

MSTest生成一个扩展名为.trx的XML文件,其中包含测试结果。

If I have a .trx file on a machine without Visual Studio installed, I get prompted to "Use the Web Service..." or "Select from a list...", which is expected. If I have a .trx file on my development machine and I open it, it opens in Visual Studio, which is expected. If I click a link on a web page or in an email which gets a .trx file from my build server, it ALWAYS opens the XML in IE.

如果我在没有安装Visual Studio的计算机上有.trx文件,系统会提示“使用Web服务...”或“从列表中选择...”,这是预期的。如果我的开发机器上有.trx文件并打开它,它将在Visual Studio中打开,这是预期的。如果我单击网页上或从我的构建服务器获取.trx文件的电子邮件中的链接,它总是在IE中打开XML。

How do I configure IE (or IIS on the build server) to open the remote .trx file in Visual Studio, if it's installed, or prompt if it's not?

如何在Visual Studio中配置IE(或构建服务器上的IIS)以打开远程.trx文件(如果已安装),或者如果不安装则提示?

UPDATE: If I rename the .trx file on the server and give it various extensions (eg. .bmp, .msi, .txt, .zip), it still opens as XML in IE, so it's clearly going by the content of the file and not the declared MIME type.

更新:如果我重命名服务器上的.trx文件并给它提供各种扩展名(例如.bmp,.msi,.txt,.zip),它仍然在IE中以XML格式打开,所以显然它的内容是文件而不是声明的MIME类型。

2 个解决方案

#1


2  

It should be a matter of defining a MIME type for the file (i.e. "application/x-test") If I'm not mistaken, if the MIME type is not provided by the server, the client has to guess (and if it looks like a XML file, it gets treated like a XML file). I could be mistaken, but it is worth a try. You can access the MIME list for IIS from the MMC console snap-in for IIS by bringing up the properties of the server (not any of the configured sites)

它应该是为文件定义MIME类型的问题(即“application / x-test”)如果我没有弄错,如果服务器没有提供MIME类型,客户端必须猜测(如果它看起来像一个XML文件,它被视为XML文件)。我可能会弄错,但值得一试。您可以通过显示服务器的属性(而不是任何已配置的站点)从IIS的MMC控制台管理单元访问IIS的MIME列表

#2


1  

Have you tried changing the file association for .xml to Visual Studio instead of IE? I'm using Win7 and IE8 and I can set the associations here: Internet Options > Programs > Set Programs > Default Programs\Set Associations

您是否尝试将.xml的文件关联更改为Visual Studio而不是IE?我正在使用Win7和IE8,我可以在这里设置关联:Internet选项>程序>设置程序>默认程序\设置关联

#1


2  

It should be a matter of defining a MIME type for the file (i.e. "application/x-test") If I'm not mistaken, if the MIME type is not provided by the server, the client has to guess (and if it looks like a XML file, it gets treated like a XML file). I could be mistaken, but it is worth a try. You can access the MIME list for IIS from the MMC console snap-in for IIS by bringing up the properties of the server (not any of the configured sites)

它应该是为文件定义MIME类型的问题(即“application / x-test”)如果我没有弄错,如果服务器没有提供MIME类型,客户端必须猜测(如果它看起来像一个XML文件,它被视为XML文件)。我可能会弄错,但值得一试。您可以通过显示服务器的属性(而不是任何已配置的站点)从IIS的MMC控制台管理单元访问IIS的MIME列表

#2


1  

Have you tried changing the file association for .xml to Visual Studio instead of IE? I'm using Win7 and IE8 and I can set the associations here: Internet Options > Programs > Set Programs > Default Programs\Set Associations

您是否尝试将.xml的文件关联更改为Visual Studio而不是IE?我正在使用Win7和IE8,我可以在这里设置关联:Internet选项>程序>设置程序>默认程序\设置关联