最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

.net - Is there an easy way to include non-assembly files (.targets, .txt, .js, etc) in Nuget packages, and copy them to a speci

matteradmin7PV0评论

I have a file of MSBuild targets, an associated .props template, and a DLL with some custom tasks, which I use to package up .NET Framework projects into modules for installation into a third-party framework, which all live in one /build directory and get included through two lines in the project file. It all works, and it's slick, but it's a pain in the @ss to keep it up to date across old projects.

What I'd like: A Nuget package that on install will copy all the files into a /build directory (including the dll, to keep it separate from the products in the /bin directory), and add the necessary lines to the project file to import the .target file.

I've Googled this extensively and can only come up with partial answers. I've been able to get the .targets and .props files included in the project, although only as links, not as copies -- for the .targets this is fine but the .props needs to be modified for each project. I've had no success inserting the necessary lines into the project file, nor in getting a {projectName}.nuget.g.targets file to actually reference them.

I cannot find an example on Nuget of a package that installs files other than assemblies -- like documentation, or associated JS files. I have some experience building straightforward Nuget packages, but this is a bit of a leap for me.

Is this possible with Nuget? Is it possible without jumping through a lot of hoops?

If it won't work I'd rather just quit while I'm ahead! Since it's just for me, I have other options, I just like the idea of using Nuget since it's a familiar one.

Thanks!

Post a comment

comment list (0)

  1. No comments so far