|
By: Paul S Cilwa |
Posted: 3/27/2026 |
|
Page Views: 139 |
| Hashtags: #OneDrive #BuildFiles #VisualStudio #MSBuild #bin #obj #ProjectConfiguration |
| How to configure Visual Studio projects to keep temporary build artifacts out of your OneDrive backup, saving space and sync time. |
| Estimated reading time: 2 minute(s) (429 words) |
The Problem
When you build a .NET project in Visual Studio, the compiler generates:
bin/ folders containing compiled DLLs and executables
obj/ folders containing intermediate object files, metadata, and build artifacts
If your project source lives in OneDrive (for syncing across machines), OneDrive faithfully backs up these temporary folders. A single build might generate 50MB of binaries. Build a dozen projects, and you've just uploaded 600MB of files that will be deleted the next time you clean the build directory. OneDrive doesn't know these are disposable—it just sees files that changed.
This wastes:
- Bandwidth: Uploading and downloading the same temporary files repeatedly
- Storage: OneDrive quota consumed by files with a lifespan of minutes
- Time: Sync delays as OneDrive tries to keep up with your build system
- Sanity: Watching OneDrive stall while you're trying to iterate on code
The Solution: Redirect Build Output
Instead of building to a project folder, tell MSBuild to put all temporary output in a central location outside OneDrive. A good choice is a local C:\Temp\ directory that only exists on your machine.
Edit your .vbproj (or .csproj) file and add these lines in the first <PropertyGroup>:
<BaseOutputPath>C:\Temp\$(MSBuildProjectName)\bin\</BaseOutputPath>
<BaseIntermediateOutputPath>C:\Temp\$(MSBuildProjectName)\obj\</BaseIntermediateOutputPath>
The $(MSBuildProjectName) variable expands to your project's name, so each project gets its own subdirectory. This is crucial if you're building multiple projects—without it, they'll step on each other's output.
What This Actually Does
Now when you build:
NamtiraLib compiles to C:\Temp\NamtiraLib\bin\
Aspecta compiles to C:\Temp\Aspecta\bin\
YourApp compiles to C:\Temp\YourApp\bin\
Your OneDrive folder stays clean. Only your source code—the stuff you actually care about—gets synced.
One Catch: External Tools
Some tools (package managers, analyzers, test runners) may still create files in your project directories. If you see folders like .nuget/, .vs/, or packages/ appearing, add them to your .gitignore and tell OneDrive to skip them via its Files On-Demand settings or by moving them to a non-synced location.
The Payoff
After you make this change:
- Builds are faster (local disk, not cloud sync)
- OneDrive stops fighting your build system
- Your quota is preserved for actual code
- You can iterate without watching a spinning sync icon
It's a small change with an outsized benefit. Your OneDrive storage quota will thank you.