ProGet Nuget Package
▌Introduction
We will
learn some tips for installing and setting ProGet
and upload first nuget package to it.
▌Environment
▋ProGet 5.0.11
▋Windows Server 2008 R2
▌Installation
▋Download
▋Install
Before
you start the installation, create a new database in SQL Server.
▋Trouble shooting
When
installing ProGet, I encountered the following error.
The database could not be exclusively locked
to perform the operation.
ALTER DATABASE failed. Cannot set
database XXX’s default collation as SQL_Latin1_General_CP1_CI_AS
System.Data.SqlClient.SqlConnection.OnError(SqlException
exception, Boolean breakConnection, Action`1 wrapCloseInAction)
於
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
於
System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand
cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet
bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
於
System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName,
Boolean async, Int32 timeout, Boolean asyncWrite)
於
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1
completion, String methodName, Boolean sendToPipe, Int32 timeout,
Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
於
System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
於
Inedo.ProGet.Setup.InstallProGetTask.CheckCreateDB()
於
Inedo.ProGet.Setup.InstallProGetTask.Install()
於
Inedo.Installer.InstallationTask`1.Inedo.Installer.IInstallationTask.RunInternal()
ClientConnectionId:59abd9f0-3013-4b14-be74-1f8e3344e424
Error Number:5030,State:2,Class:16
|
One of
the solution is to set the database to single user manually.
(Reference:
Installer Issue with
'SQL_Latin1_General_CP1_CI_AS’)
ALTER DATABASE [Your_DbName] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
|
PS. Don’t
forget to set it back as MULTI_USER after installation.
ALTER DATABASE [Your_DbName] SET MULTI_USER WITH ROLLBACK IMMEDIATE
|
However, it didn’t work for me.
I finally solved this issue by manually
executing the ALTER DATABASE sql like this,
ALTER DATABASE [DbName] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
ALTER DATABASE [DbName]
COLLATE SQL_Latin1_General_CP1_CI_AS
;
GO
ALTER DATABASE [DbName] SET MULTI_USER WITH ROLLBACK IMMEDIATE
|
Done!
▌Setup and upload a NuGet package
▋Setup
Now open http://server-name:8624 and login as Admin.
(Default ID/PWD: Admin/Admin)
Then create
a new Feed
Select NuGet as following.
For more
information about setting the Feed, see document.
Since we
have a Feed, create an api key for it.
▋Upload a nupkg package
Use
either of the following ways to upload a NuGet package.
2.
NuGet
CLI
▋NuGet Package Explorer
【FILE】→【Publish】
Publish
Url: http://server-name/nuget/Feed-name/
▋NuGet CLI
$ nuget push MyPackage.nupkg -ApiKey
XXXXXXXXX -source http://server-name/nuget/Feed-name/
|
Now you
can add the NuGet package Feed (http://server-name/nuget/Feed-name/)
into
Visual Studio: Package Sources.
Enjoy it!
▌Reference
沒有留言:
張貼留言