我有一个问题,即我必须走一只Xml文档的道路,这在我的解决办法中。 能够让任何机构了解这一档案。
曾经尝试过什么
string path = Directory.GetCurrentDirectory() + "/test.xml";
但是,这并没有给我正确的档案道路。 谁能向我提供细节,以找到一条道路?
我有一个问题,即我必须走一只Xml文档的道路,这在我的解决办法中。 能够让任何机构了解这一档案。
曾经尝试过什么
string path = Directory.GetCurrentDirectory() + "/test.xml";
但是,这并没有给我正确的档案道路。 谁能向我提供细节,以找到一条道路?
Try this..
String path = Application.StartupPath + “ estxml”;
如果您的xml在BIN的夹中,你可以使用该代码获得你的xml。
你们需要把档案放在一个项目的根子里。 此外,还试图纠正闪点:+“/test.xml”
。
如果是解决办法的夹,那么它就在申请的目前目录中获胜(根据建筑配置获得适当的双倍夹),除非你确保它是一种内容类型,并且被复制到建筑夹中。
If your parameter accept a URI you can use something like this
new Uri("/<proejct or assembly name>;component/<folder path>/<filename>")
例如,我的假.。 酒吧拥有一个有多个名称的资源,我有档案说,可以使用。
new Uri("/foo.bar;component/resources/dummy.xml")
I would be sort of leery of this requirement if I were you. Conceptually, your solution directory and solution in general is the "building materials" and your compiled, deployable code your finished "building" that you d give to a customer. What you re asking for here is like the builder of a house saying "What s the best way to cement my hammer into the floor of the basement?" Someone could probably give you a good answer, but is correctly applying the solution a good idea?
更具体地说,为什么您的操作时间、可执行守则取决于您的预定/建造时间解决结构? 我建议,你实际上可能想要做的是build活动:XML从您的解决方案中复制件,到你的目标可执行目录。 如果你这样做,那么你就可以在守则中使用你的“常备目录”方法,而不担心解决办法的结构如何。 这些建筑活动使用指挥线的星号,并为你的解决方案目录提供宏观数据,因此,你有像“SolutionDir”测试的Xml美元(BuildDir)”这样的东西。
(如果你已经意识到这一点,并且你有某种特别具体要求,要求制定符合自己解决结构的法典,则道歉。)
它取决于档案的位置。 方法Directory.GetCurrentDirectory (
(bindebug
)
What is the use of default keyword in C#? Is it introduced in C# 3.0 ?
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. ...
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 ...
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 ...
I have two EF entities. One has a property called HouseNumber. The other has two properties, one called StartHouseNumber and one called EndHouseNumber. I want to create a many to many association ...
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, ...
Since I cannot order my dictionary, what is the best way of going about taking key value pairs and also maintaing an index?
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. ...