Namespace and FileNames
Output.SetFilePath(@"C:\DevSharp\GitDemo\ScriptyGenerator\DemoNameSpace\" + className + ".cs");
I do see the dir "DemoNameSpace" getting made and the file getting created but the file is not getting added to the project
Jay
The file will only get added to the project when using the custom tool installed via the Visual Studio gallery. If you're using the MSBuild task installed via NuGet the result files will get output and included in the build, but MSBuild tasks can't easily manipulate the project itself so the output files won't get added to the project in that case.
I am using the tool from Galary. Here is my code
`using System; using System.Xml; using Microsoft.CodeAnalysis;
GenerateCode("AbcDemo"); public void GenerateCode(string className) { Output.BuildAction = BuildAction.GenerateOnly;
Output.SetFilePath(@"C:\DevSharp\ScriptyGenerator\DemoNameSpace\" + className + ".cs");
Output.WriteLine(@"// : " + Output.FilePath);
Output.WriteLine(@"namespace ScriptyGenerator.DemoNameSpace");
Output.WriteLine("{");
Output.Indent(1);
Output.WriteLine(@"public class " + className);
Output.WriteLine("{");
Output.Indent(1);
Output.WriteLine("}");
Output.Indent(0);
Output.WriteLine("}");
}`
But if you look at what got created. You will see the actual file going into the correct location but a dummy file name getting attached at the root level

Okay, I see what's going on now.
This is a current limitation of the way Scripty makes changes to the project file. It'll always attempt to associate the script output with the script. Even if the script is created somewhere else, the custom tool will attach it to the script file. This is a bit of a holdover from the way T4 used to work.
There is some work in PRs to make the way output gets added to the project a bit more flexible. I'm not sure how far along that'll get though. To be honest, I'm also contemplating just never manipulating the project and saying that any output files need to be added manually. There are just so many use cases involved (multiple output, other projects, different paths, etc.) That would also align better with the MSBuild tool (which can't manipulate the project). Still thinking that over though.
Having to manually add generated files to the project through the IDE would be a pain, especially for my main use case of having a single script generate all my NotifyPropertyChanged wrappers, since it generates a new file for every class.
If there was a flag you set on the Output object to control whether or not it was added that would probably be sufficient tho.