Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a c# application where I have to have read/write access to the root of the C drive. I realize I can compile the code and run the executable as administrator and it works. But I need to debug it and I am unsure as to how one would start the app within Visual Studio.

I have tried adding:

<requestedExecutionLevel level="asInvoker" uiAccess="true" />

to my manifest but I still get access denied error.

Here is the line of code that fails:

MemoryMappedFile mmf = MemoryMappedFile.CreateFromFile(@"c:somemapnamefile.data", System.IO.FileMode.OpenOrCreate, "somemapname", 1000);

For now I have a work around but I'd like to know for the future.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
245 views
Welcome To Ask or Share your Answers For Others

1 Answer

Just run visual studio itself as an administrator. Any program you debug from there will also be run as an administrator.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...