项目部署...如何生成的xml文件不是只读的? [英] Deployment of a project...How can the xml files generated not be read only?

查看:142
本文介绍了项目部署...如何生成的xml文件不是只读的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我部署项目时,该项目无法创建XML文件.它在Visual Studio中工作正常.它说它们只有在部署时才是只读的.

这是两个xml文件生成器之一的功能:

When I deploy a project, the project fails on creating XML files. It works fine in Visual Studio. It says they are read only when it''s deployed.

Here is what I have for one of the two xml file generators:

void write_pstest_file()
        {
            XDocument pstest_file = new XDocument(
                new XElement("testmenu",
                new XElement("showwebhelp", "true"),
                new XElement("menuitem",
                new XAttribute("key", "ca93df85-9204-4245-a587-b63439f4a3a2"),
                    new XElement("includefile", "picoTMS.pstest")
                    )
                )
            );
            pstest_file.Save("C:\\Program Files (x86)\\Pico Technology\\PicoScope6 Automotive\\test.pstest");
        }



如何将这些设置为非只读,以便在应用程序部署后就可以创建它们? Google网站无济于事. :(



How can I make these non read-only so they can be created once the app is deployed? Google sites are of no-help. :(

推荐答案

您无法将可写文件存储到Windows Vista及更高版本中程序文件"下的任何文件夹中.
您必须选择一个更合适的位置来存储可写文件.阅读:

Environment.GetFolderPath方法 [ Environment.SpecialFolder枚举 [
You cannot store writable files to any folder under Program Files in Windows Vista and above.

You have to pick a more suitable place to store your writable files. Read:

Environment.GetFolderPath Method[^]
Environment.SpecialFolder Enumeration[^]


这篇关于项目部署...如何生成的xml文件不是只读的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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