nuget install real text file
Sorry if this has been asked before (would be nice if the search results here respected the sort order instead of being completely random)
This is not strictly a rider issue, but maybe someone here has an answer that I can't find anywhere else.
This is something that I need to do in many packages, so the work arounds I have found are just too involved for more than a one off.
I need to have a text file installed in the consuming project that is a real, editable file preferably in the bin folder alongside the .dll
The closest I have gotten is an unusable linked file in the app root using target=content/contentFiles by marking the file as build action=content, the copy to output directory=always has no effect
Unusable because :
1 - the file is unmodifiable - or rather any modifications made are made globally for all projects using the package and lost when the package is updated. Also the file cannot be deleted or excluded.
2 - the file is marked as Item Type=Compile, which it is not and prevents the project from building
Using target=lib similar to the .dll, the file is packaged alongside the .dll in the .nupkg file but it is not installed into the consuming project anywhere
Using both the ide generated and a custom nuspec gets the same results
This is such a common ask but there seems to be no simple solution - hard to believe that the nuget designers just missed this scenario.
Gerry
Please sign in to leave a comment.
Hello Gerry, you might find the information from the following discussions helpful:
https://stackoverflow.com/questions/42850493/how-do-i-include-a-text-file-alongside-my-class-library-in-my-nuget-package-whic
https://blogit.create.pt/gustavobrito/2018/01/12/how-to-add-your-custom-content-files-into-a-nuget-package-for-visual-studio/