I've got a C# project and I need the output path to be a specific directory, say C:\Program Files\foo. Everytime I close the properties information or开发者_开发问答 build it gets set back to ......\Program File\Foo and i'm not able to debug properly because of it.
It worked fine for weeks and now all of a sudden it won't let me set the output directory. Anyone ever encounter this before?
Thanks,
It's not usually a good practise to use absolute paths, as this locks down your project to a specific location (makes it non-relocatable on your and other people's hard drives), which can become a real problem in the future even for a single developer (e.g. when your hard drive gets full and you have to move the project to D:)
I'd suggest leaving the output path at its default setting (bin\Debug etc) and using a post-build event to copy the resulting .exe to the final deployment location - this is more flexible and will allow debugging of the local copy. If you absolutely have to debug the exe in-situ within Program Files, then you can easily change the Project Properties (Debug section) to run the specific instance of the .exe in Program Files, rather than the Output .exe, so apart from the tiny extra cost of an extra copy in the build, it should allow you to do everything you need to do without fighting VS to get it using an unusual path.
How do you set output path
? Via project settings
tab and browse
button? I believe you can try set it directly in .csproj
file, I doubt VS will modify it in this case.
精彩评论