We do not use *.nuspec files in our projects because we do not want to have 2 sources of truth for dependencies (project file and nuspec). All our projects are internal so description and all other optional fields are not important for us.
MsBuild OctoPack task produces this warning if you don’t have *.NuSpec file in the project:
[07:21:56]warning OCT001: A NuSpec file named ‘Abc.Xyz.nuspec’ was not found in the project root, so the file will be generated automatically. However, you should consider creating your own NuSpec file so that you can customize the description properly
How can we suppress this warning?
NoWarn=OCT001 does not work, because CSC does not recognize warning ID:
[07:21:53]CSC warning CS1691: ‘OCT001’ is not a valid warning number
We keep our builds clean and do not want to see/review any warnings. We DO want to enforce all the checks and keep WarningLevel at the maximum and keep treating Warnings as errors so build helps us identifying real/potential problems.
Currently including the NUSPEC is the only option; however:
we do not want to have 2 sources of truth
Just omit the
<files> element from the NuSpec, and Octopus will use the files indicated by the CSPROJ file only - no second source of truth.
Thanks for your reply!
If we don’t have files section in NuSpec file - will OctoPack use project
file for this info (assuming it will take all items that have to be copied
to the output) or it will pack all files located in the project folder?
We are also worried about dependency section in NuSpec file.
We want dependencies to be managed in the project file. Againbfor the same
reason - we don’t want to have them in two places because they will be
immediately out of sync.
Can we omit dependencies section as well? Are they at all used by OctoPack?
You can leave the files section and dependencies sections empty, and OctoPack will behave exactly as if you didn’t have a NuSpec file at all. The only difference is that it will use the
<title> and any other elements that you do specify.
Here’s an example of a NuSpec file that I use with OctoPack - you’ll notice I don’t use any dependencies, files or anything except some basic metadata:
Hope that helps!
Thanks a lot for your replies!
We will look into how to use rudimentary NuSpec files.
The way to suppress warning would be much better option for us, of course,
because if we leave warning unsuppressed TeamCity to GitHud integration is
complaining about potential pull request merge issues and having NuSpec
files means we need to keep checking that nobody puts files section there.
We have 100+ packages that we build daily so we can’t leave it up to devs
discipline or code reviews.
I see what you mean, we’ll fix this in our next OctoPack release:
Looking more into the problem and how OctoPack runs NuGet it seems to me
that it would be more logical for OctoPack to have an ability to build
package out of Project file (
instead of building always from NuSpec and generating NuSpec file on the
fly if it is missing.
The benefits of this approach would be:
- “One source of truth” for files, description, copyright, etc as
- Default package metadata values will be consistent with NuGet (
http://docs.nuget.org/docs/reference/nuspec-reference) and will not have
some hardcoded values that are defined in CreateOctoPackPackage.
- NuGet and Visual Studio packages will evolve - it is better to rely on
NuGet to keep up with required/default values in NuSpec file instead of
keep updating CreateOctoPackPackage
- We may start using additional NuGet pack parameters like “
IncludeReferencedProjects” and any new one when they come around.
So, having an option something like OctoPackUseProjectFileToPack=true would
be very helpful.
I could not find relevant help topic - should I start one or building from
Project file is obviously wrong direction?