I set up a local nuget package repository and create a custom package.
I followed these two guides:
http://nuget.codeplex.com/wikipage?title=Hosting%20Your%20Own%20Local%20and%20Remote%20NuPack%20Feeds
http://nuget.codeplex.com/documentation?title=Creating%20a%20Package
and here is the nuspec file of my package:
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>NLog</id>
<version>1.0.0.505</version>
<authors>NLog</authors>
<description>NLog</description>
</metadata>
<files>
<file src="NLog.dll" target="lib"/>
</files>
</package>
the package was successfully created and the package shows up the package library.
But nothing happens when I click "INSTALL".
Can anyone help?
Looks like there was an issue with package building (Maybe the dll file didn't make it into lib). Try unzipping the package (rename to zip and extract) and seeing what's inside. We've updated nuget.exe and have added a -v flag to pack so that you can see the contents of your package after you build. You can install it from the ci machine http://ci.nuget.org:8080/guestAuth/repository/download/bt4/.lastSuccessful/Console/NuGet.exe).
Related
I have a Nuget package. Example: 'Sample'.
I have generated a .nupkg file using nuspec file.
and then pushed 'Sample' nuget package to feed using Nuget push azure build task.
my nuspec file:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Sample</id>
<version>1.0.0.0</version>
<title>Sample</title>
<authors>Name</authors>
<copyright>Copyright © 2009-2019. All rights reserved.</copyright>
<tags>Sample</tags>
<description>This package is for testing.</description>
<owners>Name</owners>
</metadata>
<files>
<file src="./Sample.dll" target="lib\net46\Sample.dll"/>
</files>
</package>
Now I want to change the name of my nuget package, For example: 'SamplePackageForTesting'.
Nuget pakage name is not updated eventhough I change the title, and then pushed.
But when I change the id and push, then it is updating as new package.
Can you provide any solution how to change the name of my nuget package 'Sample' to 'SamplePackageForTesting'.
A rename is not possible: from NuGet's perspective, Sample and SamplePackageForTesting are two different packages as they have different IDs.
If you're using nuget.org, a workaround would be to deprecate your package (see here).
And if the NuGet feed is under your control you could also delete the Sample package. But for this, you have to make sure that nobody ever consumed it because otherwise deterministic builds won't be possible when going back in Git history.
I generate a NuGet that is is just a number of redist files that I want to use in one of my projects. If I install it in a C# or C++ projects, it works. But when I try to install it in a wixproj project and I get the following message:
Could not install package 'package-1.0.0'. You are trying to install this package into a project that targets 'Unsupported,Version=v0.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
I generate the package through a TeamCity task (using NuGet 5.6.0). When trying to generate the package with a NuGet CLI 5.8.1, I get the following warning:
*WARNING: NU5128: Some target frameworks declared in the dependencies group of the nuspec and the lib/ref folder do not have exact matches in the other location. Consult the list of actions below:
Add a dependency group for native0.0 to the nuspec*
Looked at https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu5128, one of the solutions was trying a dependencies group targetFramework, (I used "native0.0") with no success. My nuspec is as follows:
<?xml version="1.0"?>
<package>
<metadata>
<id>package</id>
<version>1.0.0</version>
<authors>package</authors>
<owners>owner</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>my package</description>
<copyright>© 2021 company, Inc</copyright>
<tags>native</tags>
</metadata>
<files>
<file src="downloads\Folder\win32.vs2017\file1.lib" target="lib\native\lib\win32.vs2017\" />
<file src="downloads\Folder\win32.vs2017\file1-debug.lib" target="lib\native\lib\win32.vs2017\" />
<file src="downloads\Folder\Include\**" target="lib\native\include\" />
<file src="build\package.props" target="build\native" />
</files>
</package>
And my props file
<Project>
<PropertyGroup>
<MyVersion>1.0.0</MyVersion>
</PropertyGroup>
</Project>
I can install other NuGet packages into wixprojects, so how I configure mine to work? Thanks.
OK I found it, the issue lies at the line
<file src="build\package.props" target="build\native" />
changing target to "build\" allows the NuGet to be loaded to any project type, included WixProj. Note that the NU5128 warning still exists though, but not an issue for me.
I am trying to understand how NuGet packages work so that I can package some of my repeatedly used source for future projects.
I am working with a simple class library (.Net Foundation) and using the CLI to make the nuspec file and then packing from the CLI I get a nuget package that installs the Class Library DLL perfectly.
But now I want to add a transform to the App.Config that includes a connection string and I want to copy a simple readme type file to the destination project.
Using the following nuspec file the readme does not install to the readme folder as expected (doesn't install at all) and I can't get any of the app.config.transforms to work at all.
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>$id$</id>
<version>$version$</version>
<title>$title$</title>
<authors>$author$</authors>
<owners>$author$</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>$description$</description>
<releaseNotes>Stuff</releaseNotes>
<copyright>Copyright 2019</copyright>
<tags>123 1234</tags>
</metadata>
<files>
<file src="app.config.transform" target="content\app.config.transform" />
<file src="Model\State1.cs" target="content\State1.cs"/>
<file src="new.txt" target="content\new.txt"/>
</files>
</package>
Where should I put the transform files? It seems that they should be in a content folder in my source project but that isn't working. When I pack the nuget package I get an error about the files not being inside the content folder even though they clearly are.
With the above nuspec file I get an error:
Access to the path 'C:\Users\ UserName \.nuget\packages\MyDLLProject.lookups\1.1.7041.17482\content' is denied.
Why is that?
I am currently creating a nuget package with a nuspec file but getting the following error:
An item with the same key has already been added.
My command I am using is:
nuget pack "MyProject.csproj" -o "..\Packages"
This is my nuspec file:
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>$id$</id>
<version>$version$</version>
<title>$title$</title>
<authors>$author$</authors>
<owners>$author$</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>$description$</description>
<language>$language$</language>
</metadata>
<files>
<file src="bin\MyLibrary*.dll" target="lib\net45" />
</files>
</package>
The nuspec file I am using is also used when packaging other packages withing the same library. Could this be the reason why the above error is occurring? Any ideas?
It might be that you are adding files in nuspec that are also getting added when you call pack on the .csproj (files/dlls referenced by the csproj). If so you can remove the file references from the nuspec file and give it a try.
how does your nuspec file look like?
I created it with the following steps
1. create the Mylibrary project
2. let me add a dependency, I installed ninject package to the project
3. build
4. nuget spec mylibrary.csproj
5. nuspec file generated, I didn't add any file or dependency manually to the file
6. nuget pack mylibrary.csproj
7. nuget pack would automatically add ninject as a dependency and also add mylibrary.dll into the correct folder
8. http://npe.codeplex.com/ is a nice tool to open the nupkg file and see what got generated inside the package.
I had this error trying to use the package visualizer and it ended up that my packages.config had the same package name in it more than once with different versions.
I created a nuspec file:
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>MyPackage.dll</id>
<version>3.5</version>
<authors>Me</authors>
<owners>Me</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>The description</description>
<tags>tag1</tags>
</metadata>
</package>
In a directory with the file strucutre
MyPackage
Assemblies
MyPackage.dll
MyPackage.nuspec
I created my package using nuget.exe pack myPackage.nuspec and placed it in my local sources. I can find and install it from visual studio at which point
The dll is copied into the packages directory
But the reference is not added to the project
No repositories.config is created
No packages.config is created
What am I missing?
In case someone runs into this in the future. The solution was that the 'Assemblies' directory needed to be renamed 'lib'. The documentation was wrong (been updated, now it's correct).
Big thanks to dotnetjunky over on codeplex