question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When using custom $(BaseIntermediateOutputPath) the build still picks files from obj/

See original GitHub issue

I like to customize $(BaseIntermediateOutputPath) on my build servers to a centralized location so that I am very sure to start from fresh (just delete the folder and there you go). On a development machine, Visual Studio generates files (e.g. AssemblyInfo.cs) in the default folder, (obj/, inside the project folder). When trying the build server script, it regenerates those files in the customized $(BaseIntermediateOutputPath) folder but it stills picks up the default ones that have been generated before for compilation…

My workaround is to add the following property on my projects in the build server script: DefaultItemExcludesInProjectFolder=bin/**;obj/**. My use case might be a fringe one, but I think these folders should be excluded by default, in a hardcoded way (cf. https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets#L39).

Using .NET Core 3.0 preview 7.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
dasMullicommented, Jul 31, 2019

it requires editing the *.csproj manually, which I tend to do as little as possible.

This is what Directory.Build.props is now for - making it easy to apply configuration to multiple projects at once without editing a lot.

E.g. a file like this

<Project>
  <PropertyGroup>
    <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)' == ''">$(MSBuildThisFileDirectory)obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
    <BaseOutputPath Condition="'$(BaseOutputPath)' == ''">$(MSBuildThisFileDirectory)bin\$(MSBuildProjectName)\</BaseOutputPath>
  </PropertyGroup>
</Project>

Would redirect the output of all the project files in subdirectories.

Changing the build infrastructure completely between “inner loop” and CI builds is possible, but I personally don’t think it is a good idea to do so. If the problem arises from the devs running CI scripts locally, then I believe the devs should use a similar setup during development and have an understanding of their setup (>DevOps). Your opinion on this may be different, I’d be interested to hear it.

1reaction
dsplaistedcommented, Jul 30, 2019

Can you customize BaseIntermediateOutputPath for both the build servers as well as the development machine? That’s what we do in this repo, for example, everything goes in the artifacts folder at the root of the repo.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Completely change obj folder location in c# project
Solved by creating Directory.Build.props file in the root of project with: <Project> <PropertyGroup> <MSBUildProjectExtensionsPath>..\.
Read more >
.Net Standard 2.0 library with custom output and ...
In a .Net Standard 2.0 library project, what's the correct way to specify custom paths for the output and intermediate files directly?
Read more >
MSBuild reference for .NET SDK projects
When this property is set to true , all generated XML documentation files from PackageReference items in the project are copied to the...
Read more >
Bending .NET - Common Flat Build Output
the output is still full of files from the build. ... sub-projects will pick these up. How to use these is covered in...
Read more >
out.txt
If building using 4.X MSBuild, we want to act like this project is TV 4.0, so override the custom extensibility target locations with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found