-
-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an MSBuild property for disabling any NBGV tasks #568
Comments
Second on this requirement, as I need to package it with a custom constant version for purposes of unit tests, and this is messing with the results. Additionally, due to the quirks of MSBuild, conditional package references don't work for me in the way the workaround suggests. |
@macsux When tests need to predict the version number, do you find the generated @m0sa I'm interested in how NB.GV is failing for you such that you want to shut it off. Are these cases where we can improve so as to not fail? |
I only get value from NerdBank when I need to stamp a (pre-)release via CI/CD. At other times (dev inner loop), I just don't care about having everything set up so that NerdBank is happy, and there's always something. e.g. last time I was fighting this when I had to pull in a dependency via a submodule:
And that extends to the PR unit test builds etc, when I just want the DLL but don't care about checking out the entire depth of the github repo, etc. |
Thanks, @m0sa. Did this build failure happen for a project within the submodule then? Did you mean for your version stamp to apply within the submodule, or would you rather turn it off for that project for all builds anyway? What you show above shouldn't happen within a submodule. And the fact that you're using a 3.4 prerelease makes me wonder if we have a regression that should be fixed. I would love to get some repro steps from you, or more details of how I might recreate the problem. On the other hand, if the error message is right and the project being built is legitimately not in a submodule, I would potentially change this exception to a build warning and no-op when no git repo is found. |
Yeah, I have a root repository with multiple submodules. This was inside one of the submodule folders, building that submodule with dotnet build. e.g.
What I'd want is for something to force that noop, explicitly, even where there is a git repo. |
@AArnott I need an actual nuget version number which is not present in |
To clarify, do you want it to no-op all the time, even for your official builds, @m0sa? If so, then you should prevent the
Then create a Does that help? |
I'd like to throw my vote and use case in here. I'm setting up a GitHub Action workflow where I do tests -> matrix build. The matrix build defines 3 different runtimes for
This makes my matrix builds faster, and also means I'm testing code 1 time instead of 3 times. However, my test task fails right now because of the shallow clone with:
I realize this is "working as designed", but in my test job, I don't care about versioning. I want to use the shallow clone to improve the total build time of this step. I would like to selectively disable all NBGV functionality in the test job, but keep it enabled in later builds after it. OP's workaround (utilizing conditions) works for now, but I feel that this should be built in. |
I agree there should be a way to opt out with a property -- I just don't see that we need to invent a way when MSBuild itself already offers one by virtue of the Condition attribute. |
I've spent half a day to try to get msbuild to properly recognize
conditional package import, doesn't work
…On Sat., Apr. 10, 2021, 2:43 p.m. Samo Prelog, ***@***.***> wrote:
Conditions on PackageReferences are full of gotchas, see
- NuGet/Home#5895 <NuGet/Home#5895>
-
https://stackoverflow.com/questions/48590270/packagereference-condition-is-ignored
-
https://stackoverflow.com/questions/44803176/conditional-package-reference-in-uwp-project
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#568 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAINFWGLUSYW55SMBSABLFDTICL5HANCNFSM4ZUWY5PQ>
.
|
I realized a while after I posted that the workaround doesn't exactly work in my case. I introduced a usage of |
Ok, with @m0sa and @macsux's comments, perhaps we should add a property check (e.g. @rcdailey: yes, that's exactly the scenario I'm concerned about by "supporting" a way to disable versioning. For some projects (that depend on |
Yeah, that's what I'd expect. If you disable NBGV it still generates that assembly info, but with stubbed-out data as appropriate. |
Any volunteers to implement that? |
I'd love to take a stab at it
…On Mon, Apr 12, 2021, 12:22 AM Andrew Arnott ***@***.***> wrote:
Any volunteers to implement that?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#568 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAD27FWZDW7ZEBCZVGEBPVDTIIOKPANCNFSM4ZUWY5PQ>
.
|
I want this as a way to speed up incremental Debug builds as a developer. I can almost get this effect by conditionally setting #586 looks like it would work in my scenario, but it is still a draft. Would it be easier to move Nerdbank.GitVersioning.targets to Nerdbank.GitVersioning.Enabled.targets and then add a new Nerdbank.GitVersioning.targets that conditionally imports Nerdbank.GitVersioning.Enabled.targets? That way, the Another possible workaround at the application side might be to add |
TL;DR
It would be great to have something like
> dotnet build -p:NBGV_Disabled=true
Longer version
I'm constantly hitting issues with NBGV in various inner-loop (developer machine, devcontainers, omnisharp, git submodule) scenarios. It usually works great once it's set up and running correctly in the CI environment, but I find myself adding a condition to the package import so I can turn it of when I don't need it, e.g.
... so I can opt out of it via an environment variable. I usually don't care what the package version turns out to be while working on a project in my IDE. It would be great if something like this would be supported out of the box.
The text was updated successfully, but these errors were encountered: