-
Notifications
You must be signed in to change notification settings - Fork 367
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
NuGet package should not use system-level SHFBROOT by default #920
Comments
There seems to be an additional issue with code using the environment variable instead of the build property. I added
as a workaround for the issue above. This allowed the documentation build to start, only to end up failing shortly after:
The log has:
So despite SHFBROOT being cleared at the MSBuild level, causing the tools matching the NuGet package to be used, some of the processing seems to use the SHFBROOT envvar instead, in this case trying to use a transform that is apparently no longer included with SHFB. This means that using (Note: the apparently-unconditional use of |
The standalone GUI and Visual Studio package are built against a specific version of SHFB and if you use them, they will always use related tools and build engine. The Visual Studio package only contains enough to support project management so it does require the full set of tools be installed. If SHFBROOT isn't defined, they look for the tools locally based on the executing assembly location which likely won't work for Visual Studio as the package doesn't contain the full build engine. Bottom line, if you use the GUI or Visual Studio, use the installed version of SHFB and define SHFBROOT if using Visual Studio. The packages are for MSBuild and build servers and they'll run with or without SHFB installed. However, if you're mixing older and newer versions there is no guarantee that it will work. That's especially true if the packages are for an older version and you edit the project with a newer version of the GUI that then updates the project with breaking changes. Pick a consistent version and all will be well. You can use different versions as long as there are no breaking changes that affect the build engine. You need to review the release notes for the versions involved and any in between to see if that's possible. You can avoid issues by making the necessary import statements conditional. New projects contain the proper conditions and if you add the packages using the SHFB GUI or Visual Studio, it will attempt to update the project so that it will work either way. The template contains an example of the properties to use and make conditional (lines 3, 47, and 50). |
To me, it's the "they'll run with or without SHFB installed" that's a design error. That makes builds non-deterministic; the exact same source tree may or may not build depending on whether a particular version of SHFB is installed. For example, just because I am stuck using version X for my own projects, should not mean I'm unable to build someone else's project using a different version of the package. The whole point of NuGet packages is to use specific versions side by side. |
Changed the NuGet SHFB package build properties file to use `BuildingInsideVisualStudio` instead of an empty SHFBROOT value to determine when to define SHFBROOT for command line builds. Fixes #955 and should also resolve #920 but only in cases where projects use a package version containing this change (a version later the 2022.10.15.1). See the workaround in #955 for earlier packages.
Currently, when using a package reference to
EWSoftware.SHFB
in a .shfbproj, builds work just fine on a machine without SHFB installed (which is what the package is there for).However, if there is a version of SHFB installed on the machine, the package will use that, regardless of any version mismatch.
This leads to surprise broken builds on machines with a different version installed.
In my particular case, the project has
And this works fine for CI (with no SHFB on the build nodes).
However, building that project on a machine with the current SHFB release (2022.2.6) fails:
due to some change in behaviour/requirements.
The NuGet packages should probably use their bundled tools by default, in order to have reproducible builds.
If necessary, a property could be provided to explicitly choose to allow the override via the system install (e.g.
UseSystemSHFB
).The text was updated successfully, but these errors were encountered: