What's correct way to setup NuGet analyzer package build

Leonid Tsarev's Avatar

Leonid Tsarev

17 May, 2017 08:44 AM

I'm trying to invent good way to pack my Roslyn analyzer projects into NuGet. It requires specific NuGet package structure with .dll put into \analyzer\, not \lib\.

For this to work, I have to call nuget pack <name>.nuspec, not nuget pack <name>.csproj. But if I use nuspec, than $version$ tag gets ignored.

Seems that my only option is to manually update version in .nuspec on every rebuild. What is correct and right way to accomplish this?

There is a question on SO with upvotes, so it's probably worth to have public answer
https://stackoverflow.com/questions/43610749/appveyor-nuget-analyser

  1. 1 Posted by Leonid Tsarev on 22 May, 2017 08:56 AM

    Leonid Tsarev's Avatar

    Hi, should I expect any answer?
    Will it help if I paid for some time of premium account?

  2. Support Staff 2 Posted by Ilya Finkelshte... on 22 May, 2017 05:33 PM

    Ilya Finkelshteyn's Avatar

    No need to pay :) We were not able to find quick solution for you. Will try one more time in day or two and will update you.

    Ilya.

  3. 3 Posted by Leonid Tsarev on 25 May, 2017 11:06 AM

    Leonid Tsarev's Avatar

    Ilya, any updates on this?

  4. Support Staff 4 Posted by Ilya Finkelshte... on 25 May, 2017 05:00 PM

    Ilya Finkelshteyn's Avatar

    Hi Leonid,

    I forked your repo and tried to make it work with nuget pack <name>.nuspec, but without a luck. I believe that yes, you have to replace version on the fly with custom script inside .nuspec file. Simple string replace can be done easily with PowerShell.
    Then you have to use custom after_build script to run nuget pack <name>.nuspec, and also add your .nuspec files to artifacts.

    I still believe that it may exist a better way, but I just do not know it. Maybe you can reach nuget people on GitHub and ask them, how to make nuget to respect $version$ and substitute it with data from AssemblyInfo when you are calling nuget pack <name>.nuspec and not .csproj

    Ilya.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac