How can packages be published to a TeamCity nuget

2019-06-16 04:31发布

问题:

We have a TeamCity 7 server configured for nuget. It's hosted on a machine with no external connectivity. Is it possible to publish packages to the TeamCity nuget server? For example, if we want to add a log4net package dependency to one of our projects, it needs to be published to the TeamCity server, as nuget.org is unreachable. So far, I've tried publishing to variations on http://teamcity:port/guestauth/app/nuget/v1/FeedService.svc but no luck so far.

Thanks, Andy

回答1:

"The workaround is to create a build configuration that publishes those packages as artifacts."

http://blogs.jetbrains.com/teamcity/2011/12/01/setting-up-teamcity-as-a-native-nuget-server/



回答2:

ack, not supported yet: http://devnet.jetbrains.net/message/5456081#5456081



回答3:

We had the same issue before, and the actual solution is to create a build configuration, as @Robert said. But teamCity free version has a 20 build configurations limit, and sometimes you don't want to use them in single Nuget packages, so our workaround was:

  • You need write access to the packages folder at TeamCity Server.
  • Create a shared folder to the packages folder with proper permissions.
  • In the project folder, create a .cmd file with the statements:
set output=\\teamcityserver\Packages
<nuget.exe path>\nuget pack "MyProject.csproj" -o %output% -build -Properties Configuration=Release

So the key is to package the projects directly to the server packages folder.

If you have several nuget packages in the Solution, just repeat the "nuget pack" line for each one, and you're done. Wacht out the path to nuget.exe and change it properly.

I haven't tried to publish in the last TeamCity version either.