-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Adding item templates doesn't effect the project if EnableDefaultCompileItems is set to false. #1562
Comments
from @davkean I spend some time thinking about this, and this behavior is by design. First of all, to avoid this, opt out of the all the default globs by setting false property or opt just out of the default None glob by by setting false property. The template has zero control over the item type here - it's solely gets added into whatever item type the project says it should. The same behavior occurs if you explicitly drop a new file on disk, or move it from one folder to another. What's happening here is the project system to trying to avoid double-including the same file. It's seeing that adding this file would cause it to be covered by the None item and stops. It doesn't understand the complex rules in the SDK that says that adding a file to the Compile item would cause it to be removed from None item and hence avoid the double-include in this case. It does this, because of these sorts of situations: <Project>
<ItemGroup>
<None Include="*.cs" />
</ItemGroup>
</Project> If the project was to add the to the above, the file would now be included twice; once in None and once in Compile item. Based on that, I'm going to resolve this by design. |
Note that #1157 is related. The requested behavior there is incompatible with the expectation expressed in dotnet/project-system#2678 (comment) Regardless, I think the fix for this issue we should be excluding |
Why do we want to show them all the time, even the developer wants to disable the globbing behavior? How do I disable all the default globbings, if I prefer to list all files by myself to reduce performance hit from globbings?
One thing to note that the project system currently doesn't support excluding with @(...). Currently, we don't interpret any msbuild expressions, and leaves them to msbuild. @(value) was expanded based on the early evaluation, and doesn't work correctly when a new item is added.
…Sent from my phone
On Sep 12, 2017, at 2:05 PM, Nick Guerrera <notifications@github.com<mailto:notifications@github.com>> wrote:
Note that #1157<#1157> is related. The requested behavior there is incompatible with the expectation expressed in dotnet/project-system#2678 (comment)<dotnet/project-system#2678 (comment)>
We should specify the correct behavior for .cs|.vb files that are not compiled. If we want them to continue to show in solution explorer as None items, then we should close #1157<#1157> and keep only this open.
Regardless, I think the fix for this issue we should be excluding @(Compile) from default @(None). Currently, we only exclude things that match the default compile glob, and only do so when default compile globbing is on. We probably also want to exclude the other well known items. E.g. Anything in @(EmbeddedResource) already should not be globbed in to @(None) either.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#1562 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ALGWwlXQa5FOo57t0W7I2kpkgbX_qsW1ks5shvIggaJpZM4PNF-f>.
|
|
[main] Update dependencies from dotnet/arcade - Update NuGet package version - Target tests at .NET 7 so they run on the appropriate runtime. - Update Versions.props - Move dotnet-format to .net7.0 - Set eol for shell scripts - Make devcontainer user be root - Fix integration tests - Add local .dotnet folder to path during integration tests - Update path after restore - Use Net70 references in Analyzer tests
Due to lack of recent activity, this issue has been labeled as 'stale'. It will be closed if no further activity occurs within 30 more days. Any new comment will remove the label. |
This issue will now be closed since it has been labeled 'stale' without activity for 30 days. |
Moved from dotnet/project-system#2678
Using 15.3 preview 26723.0.d15rel
Expect: compile works and item is added to csproj.
Actual: added item is missing from project, but appears in the solution hierarchy 😕
Unloading and reloading the project maintains this state. The added item remains missing from the project file. I can't seem to do anything to get the file to disappear from the hierarchy.
The text was updated successfully, but these errors were encountered: