- Home /
Seemingly random console error, FileNotFoundException: Could Not Find File C:\Project\Assembly-CSharp.csproj
Hello,
This problem started occurring abruptly and seemingly randomly in a fairly simple Unity VR project. Anytime I have the editor open, I get a console error (attached). I'm using Visual Studio as my IDE. The project still builds and plays with no problems, which really just makes this more confusing. Does anyone have any ideas? Is this likely addon related? The only script heavy addon I have in this project is EasyMovieTexture, but I see a related editor script is mentioned in the error log.
Try to delete the last csproj, re-open one script on inspector, wait creation of a new csproj ?
Try to delete the last csproj, re-open one script on inspector, wait creation of a new csproj ?
Close, but the csproj doesn't reference csproj files, i would suggest deleting the solution(*.sln) where the project (csproj) files and their guid's are saved, unity will recreated when a script it opened and the csproj locations should be relative to the unity project folder.
Answer by djmartain · Feb 27, 2017 at 11:00 AM
This is a bug in EasyMovieTexture.
See the file "CSProjectFilePostProcessor.cs". You can see it looks for that file to add a unsafe tag to the project file. But if you do not use external dll's, that csproj file will not exist, hence the error. Rewrite the code to check if the file exists and the error in the console will be gone.
Awesome, this error was annoying me.
This is how I modified the file, I'm using File.Exists to check if the assembly is there - not sure if there's a more correct way.
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Xml;
public class CSProjectFilePostProcessor : AssetPostprocessor
{
// Add unsafe option to generated project file for Third Party assets that require it such as Easy $$anonymous$$ovie Texture.
static void OnGeneratedCSProjectFiles()
{
if (File.Exists("Assembly-CSharp.csproj"))
{
// All of the probably copyrighted code that was previously here
}
}
}