English 中文(简体)
编制C#的NANT海关档案
原标题:Create a custom NANT file with C#
  • 时间:2012-05-17 14:44:05
  •  标签:
  • c#
  • build
  • nant

我想创建新老会档案。 为此,我利用C#,利用用户的投入,创建“.build”文档,希望形成一种习俗。 我已经拥有一个建筑档案,但每当我提出新项目时,我必须建立一个新的建筑档案,因此,我只想把一些信息输入一个C#表格,然后档案会自动生成。

我用XmlTextWriter鞭打我的建筑档案负责人,但当我照此办理时,我会遇到问题:

<property name= "name" value = "test"/> . 

With XmlTextWriter line are like this :

<description>This is a test.</description> .

因此,我不禁要问,我怎么能写我的《国家宪章》文字。

It doesn t have to be with XmlTextWrite ...

  • EDIT -

我找到了一种方式:

textWriter.WriteRaw("<property name = "project.name" value="" + projectName + "" />");

结果:

<property name = "project.name" value="test" />

我必须进入“草原”,但比任何东西都好。 我仍然愿意以更好的方式这样做!

感谢!

最佳回答

我强烈建议不要通过非《反洗钱法》具体文本作者手写自己的XML。 除其他外,这将造成痛苦。

I might be missing something, but you should be able to use XmlTextWriter for this. This is untested but you should get the general idea:

XmlTextWriter writer = new XmlTextWriter(...);

writer.StartDocument();

writer.WriteStartElement("property");
writer.WriteAttributeString("name", "project.name");
writer.WriteAttributeString("value", projectName);
writer.WriteEndElement();

writer.EndDocument();
writer.Close();
问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签