5

Reference this thread: Previous Question

I've tried each of the various solutions proposed, still the "Assembly outside lib folder" error persists.

I used this below nuspec file format for other projects and it works fine below is my nuspec file:

<?xml version="1.0"?>
<package >
  <metadata>
    <id>Workflow.Assembly</id>
    <version>1.0.0.0</version>
    <title>Workflow.Assembly</title>
    <authors>MyAuthor</authors>
    <owners>MyOwner</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>My Description</description>
    <releaseNotes>My Release notes</releaseNotes>
    <copyright>Copyright 2016</copyright>
    <tags>My Tags</tags>
  </metadata>
</package>

powershell command lines: nuget spec MyProject.csproj (creates the shell of the nuspec file, edited to look like the above sample)

nuget pack MyProject.csproj -IncludeReferencedProjects (output sample) WARNING: 11 issue(s) found with package 'MyAssembly'.

Issue: Assembly outside lib folder. Description: The assembly 'content\lib\MyReferenced.dll' is not inside the 'lib' folder and hence it won't be added as reference when the package is installed into a project. Solution: Move it into the 'lib' folder if it should be referenced.

I've tried the various <files /> <dependency /> combinations of modifiers mentioned in the previous question but still I get the error.

To what folder does this "lib" folder refer, how can I get the absolute path (if path is what it wants) of where nuget expects the dependent dll's to reside?

Community
  • 1
  • 1
user3683706
  • 93
  • 1
  • 7

1 Answers1

6

Add a 'files' section to your nuspec linking the output of your project to the 'lib' folder.

<files>
  <file src="bin\Release\MyAssembly.???" target="lib" />
</files>

https://docs.nuget.org/create/nuspec-reference

Andy Lamb
  • 2,151
  • 20
  • 22
  • 6
    This was part of the answer however, I had also added the DLLs to a "Lib" folder in the project. Then when building the project those DLLs were referenced and not moved to bin\debug. Once I removed the DLLs from the project the nuget package assembled fine. Adding the section worked in getting the target project references updated correctly. By the way, in case anyone is new to nuget package building the "lib" folder is your visual studio binaries output folder, normally bin\debug by default unless you've changed it. – user3683706 Jan 15 '16 at 15:24
  • 3
    @user3683706 Thanks for explicitly stating that `lib` is really `bin\debug` and not a folder named 'lib'! – Michael L. Nov 14 '16 at 21:20
  • 1
    To avoid the warning `WARNING: Description: The assembly 'lib\MyAssembly.???' is placed directly under 'lib' folder. It is recommended that assemblies be placed inside a framework-specific folder.`, simply change `target="lib"` to `target="lib\net45"` (or the corresponding version). – Jerad Rose Jul 13 '17 at 15:48