-
Notifications
You must be signed in to change notification settings - Fork 675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I relocate bin and obj folders to same folder as sln? #4787
Comments
The location of those folders can be changed in your .csproj or by adding a Directory.Build.Props alongside your .sln file.
See https://docs.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-properties?view=vs-2019 for a more complete set of msbuild properties. Seems like this is a request for dotnet/msbuild#3497. There are some example configurations in the issue, but maybe a modified version of this one is a good starting point. |
@JoeRobich Can you give a example when I do this I get warnings. |
You can set it in your project file (you can specify relative path using <PropertyGroup>
<OutputPath>$(MSBuildThisFileDirectory)..\..\</OutputPath>
</PropertyGroup> This will set the output to directory above the project file. If you need to set it for all projects, then you'll either need to specify it in each project, or use |
@vzarytovskii |
Hm, it seems to be a known issue: Which one of the properties are you setting? And where (in project file or props file)? |
I was setting it here.. <Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\PureEngine\PureEngine.csproj"/>
</ItemGroup>
<PropertyGroup>
tried here
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
tried here
</PropertyGroup>
</Project> |
Ok, so it looks like it's a csproj file, which one of the three properties were you trying to set? Have you tried OutputPath? Did it not work either? |
BaseIntermediateOutputPath and OutputPath |
Does the warning persist if you'll leave only the second one? |
@Shadowblitz16 - Why would you want to relocate the For the bin folder, its going to be easier to have a post build event that copies the files from the default OutputPaths to where you need them. Thats not an uncommon thing to do, and was kind of the default behavior for TFS build's circa 2008-ish (which was actually a real pain because the programs' files would have to be re-staged into the correct directory structure before publishing). |
idk I know I messed with it for a day and couldn't get it to work. so yes most likely
I wanted the output to be in one place. |
@Shadowblitz16 - The obj folder is not output. Dont treat it as anything other than wholly disposable and useless as soon as the primary output is created. If you are still having a problem with pointing to a common bin folder, make sure you dont have parallel builds happening and that the project dependencies are set correctly. If all that has been tried, just use a post build script for the last project in the build sequence that copies the files to the target output location. |
Closing due to lack of activity. |
How do I relocate C# bin and obj folders to same folder as sln?
No one seems to know and there is no info on the internet on how to do it with vs code.
The text was updated successfully, but these errors were encountered: