Stop Removal of Non-Component Files in Project (.csproj)


Recommended Posts

The Editor removes non-component C# files from the build when it opens a project. How do I prevent this?


I create a project and add a Component ("Controller") from the Editor. In Visual Studio, I create a class "Utility" in file "Utility.cs". Compile references get added to my .csproj file.

		<Compile Include="data/Controller.cs"/>
		<Compile Include="data/Utility.cs"/>

If I close and reopen the Editor the <Compile Include="data/Utility.cs"/> line gets removed, and the project won't compile. I can add the line in manually and everything works again (until I close and open the Editor). I can hack around this by creating every file as a component, but that clutters the Editor and doesn't make good sense to me.

Link to post


Looks like a bug to me. Will wait for the devs feedback and get back to you as soon as I will have more details about this issue.

UPD #1: To avoid files deletion with current 2.14.x release you need to place additional source files in the source directory (sources from data will be ignored). In the future version we will see if we can make Editor to work correctly with the sources inside the data directory.


How to submit a good bug report
FTP server for test scenes and user uploads:

Link to post

Thanks silent. Thinking about it, the source directory may be the right place for some of these these anyway.

Link to post