Quantcast
Channel: WE MOVED to github.com/nuget. This site is not monitored!
Viewing all articles
Browse latest Browse all 7612

Commented Issue: Creating the first nuget package? [1517]

$
0
0
Hi,

I've just setup my companies Nuget server without any issues.

When I try to create a package however I run into all sorts of trouble.

Steps to reproduce:

Create a new project in VS2010 called myfirstnugetpackage.
Create a lib folder inside the myfirstnugetpackage folder.
Set the output of the project to the lib folder.
Update the assemlyinfo.cs file in the project:

using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("myfirstnugetPackage")]
[assembly: AssemblyDescription("nugetPackage")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("nuget")]
[assembly: AssemblyProduct("myfirstnugetPackage")]
[assembly: AssemblyCopyright("Copyright nuget© 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("46850e2e-33c8-458e-9819-ef144b9134a7")]
[assembly: AssemblyVersion("1.0.*")]

Open cmd:
nuget spec myfirstnugetpackage.csproj

Creates a nuget spec file looking like this:
<?xml version="1.0"?>
<package >
<metadata>
<id>$id$</id>
<version>$version$</version>
<title>$title$</title>
<authors>$author$</authors>
<owners>$author$</owners>
<licenseUrl>http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE</licenseUrl>
<projectUrl>http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE</projectUrl>
<iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>$description$</description>
<copyright>Copyright 2011</copyright>
<tags>Tag1 Tag2</tags>
</metadata>
</package>

create the package:
nuget pack myfirstnugetpackage.nuspec

results in:
The replacement token 'id' has no value.

Edit the nuspec file as so:
<?xml version="1.0"?>
<package >
<metadata>
<id>myfirstnugetPackage</id>
<version>1.0.0.0</version>
<title>MyFirstNugetPackage</title>
<authors>Nuget</authors>
<owners>Nuget</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Nuget package test</description>
<copyright>Copyright 2011</copyright>
<tags>Tag1 Tag2</tags>
</metadata>
</package>

run the nuget pack myfirstnugetpackage.nuspec again.
results in:

WARNING: 4 issue(s) found with package 'myfirstnugetPackage'.

Issue: Assembly not inside a framework folder.
Description: The assembly 'lib\myfirstnugetPackage.dll' is placed directly under
'lib' folder. It is recommended that assemblies be placed inside a framework-specific folder.
Solution: Move it into a framework-specific folder. If this assembly is targeted for multiple frameworks, ignore this warning.

Issue: Assembly outside lib folder.
Description: The assembly 'bin\Debug\myfirstnugetPackage.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 'lib' folder.

Issue: Assembly outside lib folder.
Description: The assembly 'obj\Debug\myfirstnugetPackage.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 'lib' folder.

Issue: Assembly outside lib folder.
Description: The assembly 'obj\x86\Release\myfirstnugetPackage.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 'lib' folder.

So first off, why is the id, version, description tags not being read from the assemblyinfo.cs file correctly (did some incremental changes which resulted in hardcoding all the values in the nuspec file).
Secondly, where is the lib folder supposed to be for nuget to skip these warnings?

I'm trying to setup a company nuget source that gets built from my CI (jenkins) but if I can't get it working from a simple project like this I don't see my CI doing it.

Any help appreciated (update the docs or a detailed blog).

thanks,
nisbus
Comments: I had to copy my "nuget stuff" away from all the .sln , .csproj, and .cs files (and anything else). I used msbuild to copy over everything "nuget related" to a clean directory. Folders c:\nugetbase\content c:\nugetbase\lib c:\nugetbase\lib\net40 Files: c:\nugetbase\Package.nuspec c:\nugetbase\content\web.config.install.xdt c:\nugetbase\content\web.config.uninstall.xdt c:\nugetbase\lib\net40\MyAssembly.dll Then my "pack" and "push" commands worked fine. In a nutshell, get the "nuget stuff" isolated to a "clean" area, then work with them.

Viewing all articles
Browse latest Browse all 7612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>