How to run a build target only when packing #12694
Unanswered
reflectronic
asked this question in
Q&A
Replies: 1 comment
-
You need to add the target to Use https://aka.ms/MSBuildLog to debug your build. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In our NuGet package, we'd like to include some content files that are downloaded from the internet. My first thought was to create an MSBuild target that downloads the file and adds it as a
Content
item. Something like:However, this raises the question: when should this target be executed? I only want this target to run when packing—running this as part of regular builds would be disruptive and slow. And, while
pack
has extensibility points for adding custom content, they are for TFM-specific content. The content I'm downloading is not TFM-specific; I want this target to run in the outer build. (There's no need to download and extract the same content for each target framework.)I can't find or think of a documented way to do this. It would be pretty easy for me to hack something together, but I don't want to cause additional maintenance burden for our team. My naive idea would be to have something like:
but I don't know enough about NuGet to know if this idea is tenable or palatable.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions