deadlydog/New-NuGetPackage

Build commands that depend on on nuget file won't work

edanluna opened this issue · 4 comments

Install.ps1 removes the code to create the nuget then appends the new version.

We have code that depends on the nuget being present to run so the way you add the the code $postBuildEventText += "\n`r`n`r$postBuildEventCode" breaks our case, could you change it to make so the new version stays in the same place than before?

Thanks in advance.

I don't entirely understand the problem. Could you provide a bit more detail please, perhaps by using an example? Thanks.

Our Post-Build Events is like this:

[The block that you create in Install.ps1]
[Instructions that use the nuget package created by the first block]

Whenever we update the package we get this:

[Instructions that use the nuget package created by the first block]
[The block that you create in Install.ps1]

This is because you replace the block with an empty string:

$postBuildEventText = $postBuildEventText.Replace($oldPostBuildEventCode, [string]::Empty)

then append the new version of this block

$postBuildEventText += "`n`r`n`r$postBuildEventCode"
$project.Properties.Item("PostBuildEvent").Value = $postBuildEventText.Trim()

What I'm asking is to change this logic so you don't append the text, instead preserve the position of the block when you update with the new version.

Ah, that makes sense. That should be a fairly easy change to make, I'm just not sure when I'll have time to do it (my personal projects have been suffering lately as I've gotten busier at work). I'll try to get to it, but if you can submit a PR for it I could get a new version pushed out pretty quickly. Thanks @Thigan.