Closed mawl closed 4 years ago
I have exact the same issue.
I downloaded nuget.exe 3.4.4 and it worked again so it seems the bug was introduced in 3.5
@JohannesDrexler @mawl This is actually a different bug : https://github.com/NuGet/Home/issues/3146
If you change the name of your nuget-3.5.exe to nuget.exe, it should work for you.
@rohit21agrawal the nuget.exe in my project is named nuget.exe and it doesn't work. Im creating a repro project now
please include the nuget.exe in your repro project as well.
the repro project provided by @mawl actually works well with nuget.exe 3.5.0 RTM (build 1938). Attaching the project with its build result and the nuget.exe used.
I am having problems recreating this issue but i don't want to attach the original project where it occures. In the project where it occured the "Author" and "Description" were included as a shared AssemblyInfo.cs that was included as "LinkedFile" in the project
I'm facing the same issue in my project: in the nuspec file I'm using $author$
and $description$
, which -- according to the documentation -- should be replaced with the content of the assembly attributes AssemblyCompany
and AssemblyDescription
respectively.
However, NuGet v3.5 (and even the current NuGet/NuGet.Client@04f9b91fbb78b2adc2f81fd78badcee02f62212b ) says
Attempting to build package from 'TinyLittleMvvm.nuspec'. Authors is required. Description is required. Press any key to continue . . .
@thoemmi i would be more than happy to take a look if you could tell me the repro steps for your project..
I'm out of office currently, but will provide you with repro steps in a couple of days.
It took me a while, but then I was able to reproduce it. It happens, when GitVersion writes a long AssemblyInformationalVersion
including SHA, e.g.
[assembly: AssemblyInformationalVersion("0.5.1-wizard.1+7.Branch.feature/wizard.Sha.eb2021104d20c964ed7374c6c5e02c3b123f8e36")]
I have attached a small demo for reproduction, you just have to call build.bat
.
NuGetIssue4234.zip
I tried to investigate the issue. My assumption was right, AssemblyMetadataExtractor.GetMetadata throws an InvalidDataException
if the AssemblyInformationalVersion
is not a valid NuGet version.
However, this information never arrives at the user. Because the method throws an exception, it does not return a AssemblyMetadata
object and thus author and description is not retrieved from the assembly.
Some more information for the user would be appreciated.
This related to this http://nuget.codeplex.com/discussions/262324 A work around documented here is to set the default project to release in the csproj instead of debug and then set author="Frank Dux" property.
I'm getting the same issue, even with new projects straight from the Class Library (.NET Framework)
template. The value of the AssemblyInformationalVersion
attribute (or whether it even exists) doesn't seem to matter (@thoemmi).
Repro (using nuget 3.5):
Class Library (.NET Framework)
template.nuget spec
in the project folder.nuget pack <ProjectName>.csproj
.Result:
Attempting to build package from '<ProjectName>.csproj'.
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.
Packing files from '<PathToBinFolder>'.
Using '<ProjectName>.nuspec' for metadata.
Authors is required.
Description is required.
Just for reference here's a Stackoverflow question regarding this issue.
I just ran into this issue as well. I can confirm it has to do with the AssemblyInformationalVersion produced by GitVersion.
On my local machine packaging works. The version generated locally is
[assembly: AssemblyInformationalVersion("0.1.0-unstable.6+Branch.develop.Sha.5e3df28141ab83c853b26f35d1732d491cc266c2")]
On the buildserver a different version is produced:
[assembly: AssemblyInformationalVersion("0.1.0-origin-develop.1+6.Branch.origin/develop.Sha.5e3df28141ab83c853b26f35d1732d491cc266c2")]
The latter does not work due to the branch name "origin/develop". A checkout to develop resolved my issue because the forward slash is no longer present.
I'm running Win 7 enterprise SP1 with VS2015 and VS2017 installed side by side. Targetting .Net 4.6.2
I cannot reproduce all of the above - this is happening to me with nuget versions v4.1 - NOT v3.5
I do notice that :
Attribute value is:
[assembly: AssemblyInformationalVersion("6.0.1-LOCAL-0000")]
Nuspec tag is:
<authors>$author$</authors>
This value is shared through a linked file common to all solution projects
Any ideas?
OK I've narrowed this down: V.3.5.0.1938 - works correctly V.3.5.0.1996 - gives the "authors required" bug
I ran into this same problem and was able to fix it by making sure that the <authors></authors>
section was defined in my .csproj file. Afterwards I had to update the token in the .nuspec file to $authors. It looks like the generated file uses $author without the "s" which caused the problem in my case.
The same issue! When that will fixed?
+1
pack failed with "Authors is required" if assembly has:
[assembly: AssemblyInformationalVersion("1.0.1-beta Branch:master Commit(SHA1):0917d95390880b1be64dd26fddc5be4dcc19605e")]
For example if change to [assembly: AssemblyInformationalVersion("1.0.1-beta.0917d95390880b1be64dd26fddc5be4dcc19605e")]
then pack works fine.
According to this https://blog.nuget.org/20140924/supporting-semver-2.0.0.html NuGet supported Build Metadata, but even with such format got same "Authors is required" exception:
[assembly: AssemblyInformationalVersion("1.0.1-beta+Branch:master Commit(SHA1):0917d95390880b1be64dd26fddc5be4dcc19605e")]
Futher investigation shows that NuGet pack works fine according SemVer 2.0.0 specification. Error cause found by @thoemmi known as Build metadata and must has such format.
Same issue here!
Create lib project in Csharp. nuget spec on the folder nuget pack {mynugetspecfile} : Value cannot be null or an empty string. Nombre del parámetro: value
I change version manually to 1.0.0 then nuget spec -Force and pack :
Id is required. Authors is required. Description is required.
My AssemblyInfo is :
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("WebCacheHelper")] [assembly: AssemblyDescription("Cache Helper for web applications. Aside strategy.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("MyCompany")] [assembly: AssemblyProduct("WebCacheHelper")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("dcef87c2-1c69-4e59-be44-e9d2ee63194a")]
// Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")]
Same issue here, please fix the bug ASAP @zhili1208
Problem still exists in NuGet 4.6.2.5055, although after 18 months, I assume this is WONTFIX?
Problem still exists in NuGet 4.9.2.5706. I ran into this issue right now.
Can confirm. This still seems to be an issue with NuGet Version: 4.9.2.5706
.
Same here :(
lol!
Same here 😢
Likewise for me - I specifically need to do a debug build of my package. NuGet Version: 4.9.3.5777
I ran into this issue today with NuGet Version: 4.9.3.5777.
Same issue with 4.9.3.5777. Had to replace $author$ with $authors$ manually.
I'm having the same issue when building in Azure DevOps and using GitVersion task in my build pipeline. I would assume that it's related and points out to the issue with the AssemblyInformationalVersion generated by GitVersion.
NuGet Version: 4.1.0.2450 Assembly Informational Version 12.2.2-beta.1+1.Branch.hotfix/12.2.2.Sha.15e4cc6e6d3b9da9d03449b6d62f282a502bcb73
Edit Confirmed that the issue went away by replacing the Assembly Informational Version with only major.minor.patch 12.2.2 This further verifies that the issue is indeed with parsing the data in AssemblyMetadataExtractor.GetMetadata function, as pointed out by @thoemmi
I just ran into this issue and in my opinion its a problem in GitVersion. I just posted a comment on GitVersion's github too Bug: Branch contains / is not replaced by - in build metadata
As i posted: GitVersion is not following the Semantic Versioning 2.0.0 specs. '/' or ':' aren't allowed metadata characters. They should replace these characters with '.' or '-'.
Build metadata MAY be denoted by appending a plus sign and a series of dot separated identifiers immediately following the patch or pre-release version. Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Build metadata SHOULD be ignored when determining version precedence. Thus two versions that differ only in the build metadata, have the same precedence. Examples: 1.0.0-alpha+001, 1.0.0+20130313144700, 1.0.0-beta+exp.sha.5114f85.
Same issue
My Solution
Ensure the the following AssemblyInfo properties are not empty strings.
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("")]
This resolved the 'Authors is required' and 'Description is required' error. I guess these can be non empty.
Update This seems to have resolved my issue locally, but still trying to figure out why my devops build is still throwing the same error after this fix.
Run into this issue as well! Nuget version 5.2
is this bug gaining any traction? 2-year delay doesn't seem great to me.
Is anyone able to repro this issue with nuget.exe
as the tool name? Specifically trying to figure if #3146 is the root cause for these problems.
At this point I'm treating this as a dup of #3146 but keeping this open as it has more engagement.
Using the exact same project and build:
Nuget Version 5.6.0.6591 does not display the Authors/Description error. However, version 5.7.0.6726 does.
I'm surprised this important issue doesn't seem to be regression tested.
5.6 output
nuget pack -verbosity detailed
NuGet Version: 5.6.0.6591
Attempting to build package from 'ClassLibrary1.csproj'.
MSBuild auto-detection: using msbuild version '16.7.0.37604' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
Packing files from 'C:\Users\charl\Google Drive\Development\NuGet Testing\NuGet Dependency Resolution\Framework Major-Numbered\ClassLibrary1\ClassLibrary1\bin\Debug'.
Using 'ClassLibrary1.nuspec' for metadata.
Add file 'C:\Users\charl\Google Drive\Development\NuGet Testing\NuGet Dependency Resolution\Framework Major-Numbered\ClassLibrary1\ClassLibrary1\bin\Debug\ClassLibrary1.dll' to package as 'lib\net472\ClassLibrary1.dll'
Id: ClassLibrary1
Version: 1.0.0
Authors: C
Description: D
Dependencies:
Added file '[Content_Types].xml'.
Added file '_rels/.rels'.
Added file 'ClassLibrary1.nuspec'.
Added file 'lib/net472/ClassLibrary1.dll'.
Added file 'package/services/metadata/core-properties/0a9c65c5d99145c6af36a7c3d0d48724.psmdcp'.
Successfully created package 'C:\Users\charl\Google Drive\Development\NuGet Testing\NuGet Dependency Resolution\Framework Major-Numbered\ClassLibrary1\ClassLibrary1\ClassLibrary1.1.0.0.nupkg'.
5.7 output
nuget pack -verbosity detailed
NuGet Version: 5.7.0.6726
Attempting to build package from 'ClassLibrary1.csproj'.
MSBuild auto-detection: using msbuild version '16.7.0.37604' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
Packing files from 'C:\Users\charl\Google Drive\Development\NuGet Testing\NuGet Dependency Resolution\Framework Major-Numbered\ClassLibrary1\ClassLibrary1\bin\Debug'.
Could not load file or assembly 'file:///C:\Program Files (x86)\NuGet CLI\nuget.exe' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
Using 'ClassLibrary1.nuspec' for metadata.
Authors is required.
Description is required.
System.Exception: Authors is required.
Description is required.
at NuGet.Packaging.Manifest.Validate(Manifest manifest)
at NuGet.Packaging.Manifest.ReadFrom(Stream stream, Func`2 propertyProvider, Boolean validateSchema)
at NuGet.CommandLine.ProjectFactory.ProcessNuspec(PackageBuilder builder, String basePath)
at NuGet.CommandLine.ProjectFactory.CreateBuilder(String basePath, NuGetVersion version, String suffix, Boolean buildIfNeeded, PackageBuilder builder)
at NuGet.Commands.PackCommandRunner.BuildFromProjectFile(String path)
at NuGet.Commands.PackCommandRunner.RunPackageBuild()
at NuGet.CommandLine.PackCommand.ExecuteCommand()
at NuGet.CommandLine.Command.ExecuteCommandAsync()
at NuGet.CommandLine.Command.Execute()
at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args)
I see the original thread is closed. Should I start a new one, or can this be reopened?
I think it's better to start a new thread. This thread was closed when a PR was merged, meaning this issue is linked to our release notes.
@bladewolf55
The change for this particular issue is in 5.7, not 5.6.
I'm using NuGet 5.7.0.6726 and this still has to be fixed
@sintecnos-lucabiffi You might add your comment to the new thread so it's clear the issue exists in the latest build.
Details about Problem
NuGet Version: 3.5.0.1938 On Windows 10
Ignores Placeholder during pack: nuget.exe pack "NugetBug.csproj" -Properties Configuration=Release -Verbosity detailed -Symbols -Version "2.0.0"
Worked before? If so, with which NuGet version 2.8 (and 3.4.x)
Detailed repro steps so we can see the same problem
Other suggested things
Placeholder were ignored.