C
C#6mo ago
Memw

Running custom build targets within library user

I have all my code to implement views within a big HTTP library I'm making, that parses files with html and c# together with custom expressions and all. I was thinking that the best way would be leaving the user of the library (the library can be installed trough nuget) to declare a property like Views or something like that with a path, and then my library would copy these files from the user specified path to the user project bin so the library has access to those, any other suggestions on how to open view files for the library to access. For now I was thinking on the first part, it would be possible to make a custom property available to the users csproj and running a target like
<Target Name="CopyMemwLibViews" BeforeTargets="Build">
<Copy Condition="Exists('$(Views)')" SourceFiles="$(Views)" DestinationFolder="$(OutputPath)\Views" />
</Target>
<Target Name="CopyMemwLibViews" BeforeTargets="Build">
<Copy Condition="Exists('$(Views)')" SourceFiles="$(Views)" DestinationFolder="$(OutputPath)\Views" />
</Target>
if the user has that property declared in their csproj?
7 Replies
Angius
Angius6mo ago
I'd make providing the path a part of your library settings, and leave it to the user to ensure the files get copied to bin
Memw
MemwOP6mo ago
Ok thanks, I'l figure a way for the library settings
Angius
Angius6mo ago
Just pass it in the ctor somewhere would be the most common way
Memw
MemwOP6mo ago
yeah, I have some configuration in the HttpServer part, I might merge it with that
Angius
Angius6mo ago
Worst case scenario, use some public static property with some default value
Memw
MemwOP6mo ago
aw hell nah thanks for your help
Angius
Angius6mo ago
:Ok:
Want results from more Discord servers?
Add your server