Visual Studio 2022 doesn't like setting Build Action of a CSS file to None.

dg2k 916 Reputation points

Visual Studio Version: Version 17.6.0 Preview 2.0 (I haven't tested on other version and may apply)

I wanted to set the Build Action property of a CSS file to None but VS doesn't like this and shows error message Property Value is not valid and excludes the CSS file from the project. I thought any file's Build Action property can be set to None, just to stay as part of the project until it is needed. I have some HTML files for note-taking with Build Action=None and the very reason why I needed the CSS file with these HTML files.

I am assuming that this could be a bug in which case I could report it to VS developers team, but thought I should pass it past Q&A just in case I am missing something, and if there is a workaround.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
2,804 questions
{count} votes