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

Categories

0 votes
493 views
in Technique[技术] by (71.8m points)

c# - How can I redirect the "bin" and "obj" directories to a different location?

Is there a way to tell Visual Studio to use a different location for the bin and obj directories?

For example, if my project is in C:mymyprojects.csproj, how can I have the obj and bin directories in, say, D:otherdirectoryin and D:otherdirectoryobj. The Visual Studio project option offer only to redirect the bin directory, not the obj directory.

Also, bonus question: Can I use environment variables, not full or relative paths?

Is this possible?

See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

Refer to this article and use the nodes BaseOutputPath (for the bin folder) and BaseIntermediateOutputPath (for the obj folder) in the .proj file.

Given below is a way to modify your debug and release folders relative to bin -

In Solution Explorer, select the C# project you want to configure build parameters on.

Next, from the Visual Studio menu bar, select ProjectProperties. The Property Pages dialog will appear for your project.

Choose the Configuration (Release/Debug) you want to change and expand the Configuration Properties node in the left hand pane. Select the Studio is placed in the "Output path" attribute of the Outputs property sheet.

Be aware that the output path is specified separately for each kind of build configuration, and that setting it on one configuration doesn't set it on all the remaining ones.

Original source - http://www.eggheadcafe.com/software/aspnet/32040244/how-to-change-the-obj-folder.aspx


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...