13
Vote

nuget 2.8 throws EXEC : warning : Unable to extract metadata from 'Silverlight.dll' and System.InvalidOperationException: The replacement token 'title' has no value afterwards when using title - works in nuget 2.7.x

description

nuget shows a warning Unable to extract metadata from dll, and after that throws an exception when trying to get the title from the nuspec file, which contains $title$ indeed.
<?xml version="1.0"?>
<package >
  <metadata>
    <id>$id$</id>
    <version>$version$</version>
    <title>$title$</title>
    <authors>$author$</authors>
    <owners>$author$</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>$description$</description>
    <copyright>Copyright 2014</copyright>
  </metadata>
</package>
build.log
06-Feb-2014 08:18:42    NuGetPack:
06-Feb-2014 08:18:42      C:\Chocolatey\bin\NuGet.bat pack "App.Silverlight.csproj" -Properties Configuration=Release -Verbosity detailed -Symbols -Version "1.2.0-SNAPSHOT"
06-Feb-2014 08:18:42      Attempting to build package from 'App.Silverlight.csproj'.
06-Feb-2014 08:18:42      Packing files from 'C:\b\SA-BLABLACI-JOB1\App.Silverlight\Bin\Release'.
06-Feb-2014 08:18:42    EXEC : warning : Unable to extract metadata from 'MyCompany.App.Silverlight.dll'. [C:\b\SA-IDENTITYPROVIDERAPPCI-JOB1\App.Silverlight\App.Silverlight.csproj]
06-Feb-2014 08:18:42      Using 'App.Silverlight.nuspec' for metadata.
06-Feb-2014 08:18:43      System.InvalidOperationException: The replacement token 'title' has no value.
06-Feb-2014 08:18:43         at NuGet.Preprocessor.ReplaceToken(String propertyName, IPropertyProvider propertyProvider, Boolean throwIfNotFound)
06-Feb-2014 08:18:43         at NuGet.Preprocessor.Process(Stream stream, IPropertyProvider propertyProvider, Boolean throwIfNotFound)
06-Feb-2014 08:18:43         at NuGet.Manifest.ReadFrom(Stream stream, IPropertyProvider propertyProvider, Boolean validateSchema)
06-Feb-2014 08:18:43         at NuGet.Commands.ProjectFactory.ProcessNuspec(PackageBuilder builder, String basePath)
06-Feb-2014 08:18:43         at NuGet.Commands.ProjectFactory.CreateBuilder(String basePath)
06-Feb-2014 08:18:43         at NuGet.Commands.PackCommand.BuildFromProjectFile(String path)
06-Feb-2014 08:18:43         at NuGet.Commands.PackCommand.BuildPackage(String path)
06-Feb-2014 08:18:43         at NuGet.Commands.PackCommand.ExecuteCommand()
06-Feb-2014 08:18:43         at NuGet.Commands.Command.Execute()
06-Feb-2014 08:18:43         at NuGet.Program.Main(String[] args)
06-Feb-2014 08:18:43    C:\Program Files (x86)\MSBuild\4.0\Microsoft.Common.targets\ImportAfter\MyCompany.NuGet.targets(214,5): error MSB3073: The command "C:\Chocolatey\bin\NuGet.bat pack "App.Silverlight.csproj" -Properties Configuration=Release -Verbosity detailed -Symbols -Version "1.2.0-SNAPSHOT"" exited with code 1. [C:\b\SA-BLABLAPCI-JOB1\App.Silverlight\App.Silverlight.csproj]
The belonging AssemblyInfo.cs (We are using a solutionwide SolutionInfo.cs for Assembly*Version)
using System.Reflection;
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("MyCompany.App.Silverlight")]
[assembly: AssemblyDescription("App Client library for Silverlight")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("MyCompany")]
[assembly: AssemblyProduct("MyCompany.App.Silverlight")]
[assembly: AssemblyCopyright("Copyright ©  2014")]
[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("e2f3a685-3b09-40ab-b2b1-9874bce7947f")]

file attachments

comments

gjulianm wrote Feb 9 at 5:24 PM

I'm having the same problem, a package which worked with Nuget 2.6 is returning the same error in Nuget 2.8. The project is a PCL, target .NETPortable,Version=v4.0,Profile=Profile104

jrillema wrote Mar 8 at 3:40 AM

Same here with a PCL library running 2.8, any ideas?

amontgomery wrote Apr 7 at 5:07 PM

Same problem here with a Silverlight library; running NuGet 2.8.1.
I've had to revert to NuGet 2.7.3 to keep working.

AndreyDotNet wrote Apr 10 at 3:25 AM

Same issue with 2.8. Rollback to 2.7 helps.

feiling wrote Apr 10 at 4:44 PM

Is it possible to attach your dll here?

DanHarman wrote Apr 11 at 12:47 PM

Same problem here with a pcl. This is a newly created nuspec from a csproj, as soon as I tried to build the package I get the error outlined above.

StephenCleary wrote May 10 at 3:43 AM

Attaching a dll that exhibits this issue with NuGet 2.8.1 and 2.8.2-beta.

StephenCleary wrote May 10 at 2:46 PM

Attaching a Process Monitor capture of NuGet 2.8.2-beta attempting to read Comparers.dll.

StephenCleary wrote May 10 at 3:19 PM

Console log with full verbosity turned on:
PM> nuget pack -Symbols ".\Comparers (NET4, Win8, SL5, WP8, WPA)\Comparers (NET4, Win8, SL5, WP8, WPA).csproj" -Prop Configuration=Release -Verbosity Detailed
Attempting to build package from 'Comparers (NET4, Win8, SL5, WP8, WPA).csproj'.
Packing files from 'D:\Personal\Comparers-GitHub\Source\Comparers (NET4, Win8, SL5, WP8, WPA)\bin\Release'.
WARNING: Unable to extract metadata from 'Comparers.dll'.
WARNING: System.IO.FileNotFoundException: Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, R
etargetable=Yes' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean supp
ressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppr
essSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean s
uppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.ReflectionOnlyLoad(String assemblyString)
   at NuGet.AssemblyMetadataExtractor.MetadataExtractor.AssemblyResolver.ReflectionOnlyAssemblyResolve(Object sender, ResolveEventArgs args)
   at System.AppDomain.OnReflectionOnlyAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

   at System.ModuleHandle.ResolveMethod(RuntimeModule module, Int32 methodToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount)
   at System.ModuleHandle.ResolveMethodHandleInternalCore(RuntimeModule module, Int32 methodToken, IntPtr[] typeInstantiationContext, Int32 typeInstCount, IntPtr[] methodInstantiationContext, Int32 methodInstCount)
   at System.ModuleHandle.ResolveMethodHandleInternal(RuntimeModule module, Int32 methodToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   at System.Reflection.CustomAttributeData..ctor(RuntimeModule scope, CustomAttributeRecord caRecord)
   at System.Reflection.CustomAttributeData.GetCustomAttributes(RuntimeModule module, Int32 tkTarget)
   at System.Reflection.CustomAttributeData.GetCustomAttributesInternal(RuntimeAssembly target)
   at System.Reflection.RuntimeAssembly.GetCustomAttributesData()
   at System.Reflection.CustomAttributeData.GetCustomAttributes(Assembly target)
   at NuGet.AssemblyMetadataExtractor.MetadataExtractor.GetMetadata(String path)
   at NuGet.AssemblyMetadataExtractor.MetadataExtractor.GetMetadata(String path)
   at NuGet.AssemblyMetadataExtractor.GetMetadata(String assemblyPath)
   at NuGet.AssemblyMetadataExtractor.ExtractMetadata(PackageBuilder builder, String assemblyPath)
   at NuGet.Commands.ProjectFactory.CreateBuilder(String basePath)


Using 'Comparers (NET4, Win8, SL5, WP8, WPA).nuspec' for metadata.
nuget : System.InvalidOperationException: The replacement token 'author' has no value.
At line:1 char:1
+ nuget pack -Symbols ".\Comparers (NET4, Win8, SL5, WP8, WPA)\Comparers (NET4, Wi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (System.InvalidO...' has no value.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
   at NuGet.Preprocessor.ReplaceToken(String propertyName, IPropertyProvider propertyProvider, Boolean throwIfNotFound)
   at NuGet.Preprocessor.Process(Stream stream, IProper
tyProvider propertyProvider, Boolean throwIfNotFound)
   at NuGet.Manifest.ReadFrom(Stream stream, IPropertyProvider propertyProvider, Boolean validateSchema)
   at NuGet.Commands.ProjectFactory.ProcessNuspec(PackageBuilder builder, String basePath)
   at NuGet.Commands.ProjectFactory.CreateBuilder(String basePath)
   at NuGet.Commands.PackCommand.BuildFromProjectFile(String path)
   at NuGet.Commands.PackCommand.BuildPackage(String path)
   at NuGet.Commands.PackCommand.ExecuteCommand()
   at NuGet.Commands.Command.Execute()
   at NuGet.Program.Main(String[] args)

PM> 

karldodd wrote Jun 12 at 6:06 AM

Come on Nuget team.. Quite a few months passed and the issue is still "proposed"? At least some one should look at and merge the pull request from Stephen!

edandersen wrote Jun 13 at 3:03 AM

Yeah, this needs to be fixed. We've had to resort to keeping the version number in the .nuspec until this is fixed. Please look at the PR someone.

davedev wrote Jun 23 at 10:36 PM

I'm getting a similar error for a portable lib targeting Windows 8.1 and Windows Phone 8.1 only. (Note that it wasn't created from a "Universal" project template; it's just a regular Portable library with these Fx targets selected.)

csmacnz wrote Jul 10 at 5:32 AM

Any chance this can be merged in?
Its causing me issues building locally (which i can work around by copying the pcl versions of the dlls into my bin directory)
but it means appveyor cannot build my packages because the official release of nuget.exe it uses needs this fix!
Can we get someone to look at getting this into a release?