To find which .js files are used in a C# project, you can use the following steps:

  1. Read all the C# source code files in the project directory.
  2. Search for occurrences of .js file names or references within those C# files.
  3. Keep track of the .js files that are used in the project.

Here’s a sample C# code to accomplish this task:

using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;

class Program
{
    static void Main()
    {
        // Replace "path/to/your/C#Project" with the actual path to your C# project directory.
        string projectPath = "path/to/your/C#Project";
        
        List<string> usedJsFiles = FindUsedJsFiles(projectPath);
        
        Console.WriteLine("Used .js files:");
        foreach (string jsFile in usedJsFiles)
        {
            Console.WriteLine(jsFile);
        }
    }

    static List<string> FindUsedJsFiles(string projectPath)
    {
        List<string> usedJsFiles = new List<string>();
        string[] csharpFiles = Directory.GetFiles(projectPath, "*.cs", SearchOption.AllDirectories);

        foreach (string csharpFile in csharpFiles)
        {
            string content = File.ReadAllText(csharpFile);

            // Using regex to find references to .js files within the C# code.
            MatchCollection matches = Regex.Matches(content, @"(?<=\b[\w\.]*\b)(\.js)\b");
            foreach (Match match in matches)
            {
                string jsFileName = match.Value;
                if (!usedJsFiles.Contains(jsFileName))
                {
                    usedJsFiles.Add(jsFileName);
                }
            }
        }

        return usedJsFiles;
    }
}

Please make sure to replace "path/to/your/C#Project" with the actual path to your C# project directory. This code will scan all .cs files in the project directory and its subdirectories, looking for references to .js files. It will then print the list of used .js files found in the C# project.

Keep in mind that this method may not detect all .js files, especially if they are dynamically loaded or referenced in a way that doesn’t directly include the file extension in the C# code. For more comprehensive analysis, you might consider using more sophisticated code analysis tools or build systems that can provide a complete dependency graph for your project.