-
Notifications
You must be signed in to change notification settings - Fork 392
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
VS automatically adds <ItemGroup> with Remove="xxx" for new files #8636
Comments
Related: dotnet/aspnetcore#27718 |
I found a possible workaround for me. Since I don't need the item in design-time, making the wildcard include conditional seems to fix the issue: <ItemGroup Condition="'$(DesignTimeBuild)' != 'true'">
<RazorTranspilerInputRazor Include="**\*.cshtml" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup> Still, this is very annoying, and I'm not sure how I'd fix the issue if I needed the MSBuild items even in design-time... |
Hi @tompazourek, can you open a feedback ticket at https://developercommunity.visualstudio.com/home or through Visual Studio with "Help | Send Feedback | Report a Problem..." and put the link here so we can ensure it's routed correctly? We believe this is a CPS issue. |
…tead of .targets, in order to allow customization in Rhetos app's .csproj file." This reverts commit c91a531. This feature was causing the following issue: When adding a new file to the project, Visual Studio automatically marked the file as removed from RhetosBuild ItemGroup in csproj file. See dotnet/aspnetcore#27718, dotnet/project-system#8636
…tead of .targets, in order to allow customization in Rhetos app's .csproj file." This reverts commit 9988d9f. This feature was causing the following issue: When adding a new file to the project, Visual Studio automatically marked the file as removed from RhetosBuild ItemGroup in csproj file. See dotnet/aspnetcore#27718, dotnet/project-system#8636
Visual Studio Version
17.3.6
Summary
I have a custom package that automatically adds all CSHTML files inside a project into a custom MSBuild item called
<RazorTranspilerInputRazor>
used by some tooling we have. The MSBuild code looks inside the package looks as follows:When I then add a new CSHTML file in Visual Studio in Solution explorer (I usually copy-paste an existing one), Visual Studio adds some custom code to explicitly remove the new file from the wildcard... Let's assume I create a copy of file
XXX.cshtml
This is what gets automatically appended to the csproj by Visual Studio:How do I stop this behavior? I want the original wildcard to work and include all CSHTML files, including the new files. Yet, Visual Studio tries very hard to break this and exclude any new files from the wildcard. Every time I copy-paste a file, VS removes it, and I have to revert that removal. It's very annoying.
Is there some way to work around this?
I found some other people having similar issues, e.g.: https://stackoverflow.com/questions/69240061/how-to-stop-visual-studio-from-automatically-adding-remove-in-an-item-group-in-m But no answer yet.
The text was updated successfully, but these errors were encountered: