改变在哪里XmlSerializer的输出临时大会 [英] Changing where XmlSerializer Outputs Temporary Assemblies

查看:101
本文介绍了改变在哪里XmlSerializer的输出临时大会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图改变在哪里XmlSerializer的输出临时大会,所以我下面这种教程

I am trying to change where XmlSerializer Outputs Temporary Assemblies so I am following this sort of tutorial

<一个href=\"http://www.hanselman.com/blog/ChangingWhereXmlSerializerOutputsTemporaryAssemblies.aspx\">http://www.hanselman.com/blog/ChangingWhereXmlSerializerOutputsTemporaryAssemblies.aspx

然而,当我想补充

<system.xml.serialization> 
  <xmlSerializer tempFilesLocation="c:\\foo"/> 
</system.xml.serialization> 

我得到tempFileLocation是不是一个有效的属性。我使用.NET 4.0

I get tempFileLocation is not a valid attribute. I am using .net 4.0

改变了名字还是怎么了?

Has the name changed or something?

推荐答案

您使用的是什么版本的.NET Framework的?该无证功能只在Framework 2.0更新推出,所以它可能是你没有把所有的更新?

What version of the .NET Framework are you using? This undocumented functionality was only introduced in an update for Framework 2.0, so it might be that you have not got all the updates?

下面是对MS支持网站有关更新的链接
http://support.microsoft.com/kb/934529

Here is a link to the MS support site regarding the update http://support.microsoft.com/kb/934529

更新:我用VS2010框架4.0测试这一点。虽然IDE确实显示的跟随着警告,由于架构不包括此属性。

Update: I tested this with VS2010 Framework 4.0. While the IDE does show the followin warning due to the schema not including this attribute.

Warning 13  The 'tempFilesLocation' attribute is not allowed.

我跑,并编制了code和它工作得很好。下面是我使用的配置文件。

I ran and compiled the code and it worked fine. Here is the config file I used.

<?xml version="1.0"?>
<configuration>
  <system.diagnostics>
    <switches>
      <add name="XmlSerialization.Compilation" value="1" />
    </switches>
  </system.diagnostics>

  <system.xml.serialization>
    <xmlSerializer tempFilesLocation="c:\foo"/>
  </system.xml.serialization>
  <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
</configuration>

这篇关于改变在哪里XmlSerializer的输出临时大会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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