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.

PathTooLongException with _GenerateBindingRedirectsIntermediateAppConfig

See original GitHub issue

We just hit a PathTooLongException on EF because this variable was producing the following path.

C:\Projects\EntityFramework\test\Microsoft.EntityFrameworkCore.SqlServer.Design.FunctionalTests\obj\Debug\netcoreapp1.1\Microsoft.EntityFrameworkCore.SqlServer.Design.FunctionalTests.csproj.Microsoft.EntityFrameworkCore.SqlServer.Design.FunctionalTests.dll.config

That filename seems rather excessive. Does it really need both $(MSBuildProjectFile) and $(TargetFileName) in there?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
tmatcommented, Jun 29, 2017

If the .exe/.dll name wasn’t unique the assembly would collide in the shared obj directory.

Workaround:

<Target Name="WorkaroundAppConfigPathTooLong"
          BeforeTargets="GenerateBindingRedirects">
    <PropertyGroup>
      <_GenerateBindingRedirectsIntermediateAppConfig>$(IntermediateOutputPath)$(TargetFileName).config</_GenerateBindingRedirectsIntermediateAppConfig>
    </PropertyGroup>
  </Target>

produces:

image

1reaction
rainersigwaldcommented, Mar 3, 2017

It doesn’t seem like it at first glance.

I’ve been spelunking through history trying to figure out why it’s this way, and it seems to have been introduced in dev12 with GenerateBindingRedirects. I suspect it was named this way as a compromise between

  • The standard $(IntermediateOutputPath)$(MSBuildProjectFile).{filename} pattern for project-singleton caches and
  • The standard app-config naming convention of $(TargetFileName).config

This does cause duplication in the standard case, and having a very long project name that’s the same as the assembly name is not uncommon.

I think we could change this variable to $(IntermediateOutputPath)$(MSBuildProjectFile).app.config. Anyone have an idea why not?

(Obligatory “the real problem is #53 and then don’t worry about this”. Obligatory “but we live in the current world”.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

The "GenerateBindingRedirects" task failed unexpectedly.
The "GenerateBindingRedirects" task failed unexpectedly. System.IO.PathTooLongException: The specified path, file name, or both are too long.
Read more >
Enable or disable autogenerated binding redirects
Read how to enable or disable automatic binding redirection. This feature affects desktop apps and web apps targeting .NET Framework 4.5.1 ...
Read more >
Binding Redirects
The fix if you're using .NET Framework · Enable <AutoGenerateBindingRedirects> (this doesn't work for web projects - it doesn't handle web.config ).
Read more >
Codul lui da vinci film subtitrat in romana
The answer provided in this question: Web deployment task build failed could finally ... So just check if binding redirect can help.2" in...
Read more >
Diagnostics - Jon Skeet's coding blog
NET Core within a WPF application to make it easy to interact with logs ... as I'd expect, but given that this is...
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