문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top