Skip to content
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

Sources under a folder named "Packages" are ignored on build #1708

Closed
ridomin opened this issue Nov 1, 2017 · 3 comments
Closed

Sources under a folder named "Packages" are ignored on build #1708

ridomin opened this issue Nov 1, 2017 · 3 comments
Assignees
Milestone

Comments

@ridomin
Copy link

ridomin commented Nov 1, 2017

.NET Command Line Tools (15.5.0-preview-007044)

All source files and folders are included in the build, however, a folder named "Packages" is excluded. I've verified this behavior in CLI and VS 15.5 Preview.

Looks like a regression from previous versions (checked in 15.4).

Repro Steps.

dotnet new classlib
mkdir Packages
echo 'bad c# file' > Packages/Class1.cs
dotnet build

Expected. Build failed because Class1.cs is not a valid C# file
Observed. Build succeed because Packages/Class1 is excluded from the build

@livarcocc
Copy link
Contributor

Your Packages folder below is upper case.
 
We remove (always have) packages (lower case) from sources since 1.0.0. We did this to maintain compatibility with project.json when we moved from it to csproj and msbuild.
 
The fact that this used to work for you and now fails is likely a path normalization fix that happened in MSBuild. Adding @andy Gerlicher here so that he can comment on path normalization fixes that might have gone into MSBuild to cause this to happen.
 
Once we get confirmation that this was a path normalization change in MSBuild, I will go ahead and close this issue.

cc @cdmihai @AndyGerlicher

@clairernovotny
Copy link
Member

clairernovotny commented Nov 1, 2017

This is bad and projects have valid folders called Packages in them with code.

https://github.com/NuGetPackageExplorer/NuGetPackageExplorer/tree/master/Core/Packages

Please do not put this on the default items list if it's inside the project folder. If it's outside the project folder, which I believe was the intent, that's ok as that was to target the packages.config folder.

I think the fix is that the glob needs to be removed. It even has a TODO saying to investigate.

<!-- TODO: Verify why this was originally added and whether we really need it -->
<DefaultItemExcludes>$(DefaultItemExcludes);packages/**</DefaultItemExcludes>

@dsplaisted
Copy link
Member

Yeah, I'm the one who wrote that TODO. The problem is now that we've shipped, that removing that glob could also break projects.

However, I've confirmed that this is a break even on case-insensitive file systems. In the 2.0 SDK, code from a Packages folder would be included. With 15.5 Preview, code from a Packages folder won't be included.

So assuming that we keep the current behavior of MSBuild in the 15.5 preview (which I believe was a bug fix), then we would need to weigh the risk of breaking projects by newly excluding code from Packages against the risk of breaking projects by newly including code from packages. I'd vote for getting rid of the glob exclusion for packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants