Closed jspg closed 1 year ago
Outputs
is used for the incremental build feature, basically if the output already exists the target is not executed again (also compare the timestamp of the Input to see if was modified after the Output creation).
https://learn.microsoft.com/en-us/visualstudio/msbuild/how-to-build-incrementally?view=vs-2022
I think would be easier to just create a prebuild action in your csproj
that copy the file from your original location to the expected location in the IDL project (IDL folder). If you modify the NuGet targets
file, you will need to do the same each time you update the version or you compile in a different machine.
PS: In any case, after your edition, it looks correct for me.
The prebuild action idea is a good and simple solution, thank you for that.
Agreed that modifying the targets
file is not a sustainable approach, was more thinking if this was a use case you would want to support.
Anyway, thanks for the help!
For the moment, I would keep it as it is for simplicity. However, I will consider that use case for future refactoring.
Hi,
I have an issue with the folder structure needed for the IDL generation to work properly.
I want to keep the IDL files in a folder (or submodule) separate from the project that generates the C# code, since we will be using these IDL files for C/C++ as well. This can be achieved by simply adding that folders path in the csproj file, like below, and it will happily generate the code.
However, this breaks the cleaning of the project since the clean target is relative to where the IDL files are located, not to the project directory.
I have tested the following which seems to solve the issue. Replace
<Delete Files="%(RootDir)%(Directory)..\%(IdlFiles.FileName)TypeSupport.cs;" ContinueOnError="true" />
with<Delete Files="$(ProjectDir)%(IdlFiles.FileName)TypeSupport.cs;" ContinueOnError="true" />
and
Outputs="@(IdlFiles->'%(RootDir)%(Directory)..\%(filename)TypeSupport.cs')"
withOutputs="$(ProjectDir)@(IdlFiles->'%(filename)TypeSupport.cs')"
Outputs="@($(ProjectDir)IdlFiles->'%(filename)TypeSupport.cs')"
in multiple places.I'm unsure if the "Outputs" part has any effect/how it's used.
Any thoughts on this? Or is there another way not to be forced in to a specific folder structure?
Best regards,
EDIT: I messed up the "Outputs" part. This version at least builds, but I am not well versed in msbuild so I'm unsure if it is correct.