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.

Exclude is overzealous when exclude pattern is an absolute path prefix of include directory

See original GitHub issue

When building an SDK project, the source files are not being collected correctly, causing a “CS5001: Program does not contain a static ‘Main’ method suitable for an entry point” error. If I change the OutputPath to anything other than a substring of the source path, all source files are picked up just fine and build succeeds. Issue only happens after the 2nd build (presumably because the output folder is not empty).

Still repro’ed on latest stable 2.2, but could not repro on 3.0.100-preview-009812, so possibly an issue that only affects < 3.0.

Repro steps:

mkdir C:\Temp2 && cd C:\Temp2
@echo {"sdk":{"version":"2.2.100"}}> global.json
mkdir TestFullPath && cd TestFullPath && dotnet new console && cd ..
dotnet build C:\Temp2\TestFullPath\TestFullPath.csproj -o C:\Temp2\Test
dotnet build C:\Temp2\TestFullPath\TestFullPath.csproj -o C:\Temp2\Test

Output:

C:\Temp2
λ cd ..

C:\
λ rm -rf C:\Temp2

C:\
λ mkdir C:\Temp2 && cd C:\Temp2

C:\Temp2
λ @echo {"sdk":{"version":"2.2.100"}}> global.json

C:\Temp2
λ mkdir TestFullPath && cd TestFullPath && dotnet new console && cd ..
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on C:\Temp2\TestFullPath\TestFullPath.csproj...
  Restoring packages for C:\Temp2\TestFullPath\TestFullPath.csproj...
  Generating MSBuild file C:\Temp2\TestFullPath\obj\TestFullPath.csproj.nuget.g.props.
  Generating MSBuild file C:\Temp2\TestFullPath\obj\TestFullPath.csproj.nuget.g.targets.
  Restore completed in 193.24 ms for C:\Temp2\TestFullPath\TestFullPath.csproj.

Restore succeeded.


C:\Temp2
λ dotnet build C:\Temp2\TestFullPath\TestFullPath.csproj -o C:\Temp2\Test
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 35.26 ms for C:\Temp2\TestFullPath\TestFullPath.csproj.
  TestFullPath -> C:\Temp2\Test\TestFullPath.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:01.06

C:\Temp2
λ dotnet build C:\Temp2\TestFullPath\TestFullPath.csproj -o C:\Temp2\Test
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 37.45 ms for C:\Temp2\TestFullPath\TestFullPath.csproj.
CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [C:\Temp2\TestFullPath\TestFullPath.csproj]

Build FAILED.

CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [C:\Temp2\TestFullPath\TestFullPath.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.94

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
livarcocccommented, Jan 11, 2019

Man, github is a small world, I actually went to school with @rla4, whether she remembers or not.

I am not sure exactly which change happened in 3.0 to fix this issue there. @peterhuene can you take a look? Depending on the change, we can try to do bar check and bring it the fix to 2.2 in a servicing release.

0reactions
rainersigwaldcommented, Feb 14, 2019

Great find! Moved to Microsoft/msbuild#4175, with an even smaller repro. I understand the fix, too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

rsync/rsnapshot and exlude/include directory, absolute path
I am using rsnapshot and I want to exclude a directory by absolute path. I added to rsnapshot.conf exclude /home/user/data rsnapshot will use ......
Read more >
How to EXCLUDE a directory from a pathPatttern
I need to EXCLUDE a directory from a general pattern. I have an InstantApp intent-filter with a pathPattern="/.*" That allows two ways of ......
Read more >
excluding relative paths in duplicity
If I pass the option --exclude foo, for example, will this cause each file or directory named foo in the entire heirarchy under ......
Read more >
Miscellaneous Help — Borg - Deduplicating Archiver 1.2.4 ...
A root path starts with the prefix R , followed by a path (a plain path, not a file pattern). An include rule...
Read more >
Diff - d8c66bc71e9a0303f1d300b9fa59c60dbfe10056^! - openbmc ...
PNG file. d9b4c80 README: Updated to remove the ADT manual and add the SDK ... exclude each other f3a92ff kernel.bbclass: consider .csp firmware...
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