I have a .zip file which contains 3 directory(folder) inside this.
Now I want to create a nuget package for this .zip file so that I can use this into my git repo.
I know basic way to create nuget package though not sure how to create for existing .zip file.
Please check this article
https://learn.microsoft.com/en-us/nuget/create-packages/creating-a-package
No matter what your package does or what code it contains, you use one
of the CLI tools, either nuget.exe or dotnet.exe, to package that
functionality into a component that can be shared with and used by any
number of other developers. To install NuGet CLI tools, see Install
NuGet client tools.
Related
I am using GitHub packages to publish my private NPM packages. I need to download the published package of specific version for carrying out automation work. How can I download the package as a zip bundle using GitHub REST API or equivalent? Additionally, since it is a private package, it needs to be authenticated.
I know that equivalent functionality exists but it works for GitHub releases and assets. I could not find anything yet for GitHub packages!
After a few days of intermittent research regarding this question, here is what I have found. There seem to be two methods of retrieving and/or consuming privately published NPM packages from the GitHub Package Registry. And neither of them is an exact match to your desired method, so, here goes...
OPTION 1.
You can consume the npm package directly within your application provided you have a locally configured .nprmc file on your machine in your user directory (check first #~/.npmrc),
AND
you have created a GitHub personal access token with the following scopes.
repo: full (this is how you will be authenticated.)
workflow
write: packages
adminOrg: read
user: email
NOTE: You may not require all of these, but these are the permissions I used and had no issues. Once you generate the token, create or add it to your .npmrc file like so, replacing TOKEN with the actual token value.
//npm.pkg.github.com/:_authToken=TOKEN
Be sure you additionally add the following snippet into the project or container itself within another .npmrc file in the root directory of the codebase.
#YOUR_GITHUB_USERNAME:registry=https://npm.pkg.github.com
OPTION 2:
You can connect your package to a private GitHub repository, which will allow you to access the tar.gz artifact for each version of your package and directly download it to your local machine from the web.
github.com > Your profile > Packages > Connect repository > Select and link.
REFERENCE: How to publish packages to the GitHub Package Registry
I'm working in a completely offline environment & lately, I've had to code some react applications. I wonder if there is a way to download npmjs packages manually without using the command npm install <package-name>.
For example, while I'm coding with python in the same offline env, I'm downloading everything from PyPi manually & use the .whl in my offline environment using removable devices from one online environment to the offline environment.
I'll appreciate for any help or direction to the solution.
You need to download their source from the github. Find the main file and then include it in your main file.
You need to find the source and go through the package.json file. There you can find which is the main file. So that you can include that in your application.
To include example.js in your app. Copy it into your application folder.
Once you do that, your requirements will just be:
var moduleName = require("path/to/example.js")
It will always look for a node_modules directory at the root of your app (and a few other places as well).
It's important you download the full repo and not just the lib folder if you plan to use it this way since the package.json file is used to find the main entry point. As long as the repository has a valid package.json file it should work.[
Can Chocolatey package source code? We use Subversion for PHP code running on IIS and we currently do an svn switch to c:\inetpub\. The source includes all the necessary directories like wwwroot and the code.
Could this be done in the nuspec file?
It shouldn't package source code, but it could run svn/git/hg/etc functions to work with source code in the package install script.
It's considered an antipattern to have the source control folders (.svn, .hg, .git, etc) included in the package itself.
I have an ASPNET mvc project using both Nuget and Bower for dependencies. Now I need to either trigger bower to install components upon deployment or as fallback include the packages by allowing them in my .gitignore. Of course I would like to not include those in the repo and just have them installed while deploying, just like with nuget packages. I tried to follow this guide http://gregtrowbridge.com/deploying-a-bower-dependent-node-app-on-windows-azure/ but still nothing seems to happen. So any help is welcome :)
Best regards
All of Azure Websites workers have bower pre-installed and should be on your path.
All you need to do is add a custom deployment script that would do bower install
Here is a sample repo for an ASP.NET MVC site that uses bower
Basically make sure bower.json is there and referenced in your csproj
<Content Include="bower.json" />
Then download your custom deployment script. if you go to https://<yourSiteName>.scm.azurewebsites.net then click on Tools -> Download custom deployment script or just download it from D:\home\deployment\tools then check it in the root of your repo like here basically there will be 2 files deploy.cmd and .deployment
this is the deployment logic, add a step to restore bower in it like here after the last step there
:: 4. Bower Install
if EXIST "%DEPLOYMENT_TARGET%\bower.json" (
pushd "%DEPLOYMENT_TARGET%"
call :ExecuteCmd bower install
IF !ERRORLEVEL! NEQ 0 goto error
popd
)
You can use the console feature of Azure web app to fire the commands. Even if the console has access to a restricted features, you can still install the bower components by using the command:
bower install
The console option is listed under the deployment section of the Web Apps. You can refer the below the screen for reference.
Prerequisites:
Do not publish the bowerComponents folder to the Web app.
Include the bower.json file including all the dependencies.
Hope it helps.
One important addition to the above - you must push both the unchanged .deployment file and modified .cmd file to deployment root for Azure to subsequently copy/execute your .cmd amendments. Otherwise it will regenerate a default .cmd
I have a project which has a NuGet package called MSBuildTasks installed. It installs two files: MSBuild.Community.Tasks.targets and MSBuild.Community.Tasks.dll to the .build directory within the solution directory. This package reference has been added to the packages.config file in that project directory so that when I build the project (and with the NuGet package restore settings enabled) it will restore the package which is great because then I can distribute the source to other developers and build it on our build server without any missing files...
However, the problem is that when NuGet restores the package, it doesn't restore these two files to the expected location it was originally in when I first installed it with the Install-Package MSBuildTasks command, which was in to the $(SolutionDir)\.build directory. Instead, it has installed it to the $(SolutionDir)\packages\MSBuildTasks.1.4.0.78\tools directory, so now if I wish to include the MSBuild.Community.Tasks.targets file, I must reference this path absolutely in my .csproj or other .targets file. This presents a problem since the version number will undoubtedly change, requiring manual work to correct.
Is there some way that I can restore the MSBuildTasks .targets and .dll files to the original location of $(SolutionDir)\.build where it first installs to? The current behaviour of restoring in to the packages directory, while it makes sense for other packages, seems like a bug for this particular package since I will not be able to know the version number of the directory to include in my other .targets or .csproj files.
NuGet restore will only download files to the packages directory. It will not make any other modifications.
Looking at the MSBuildTasks NuGet package the files added to the $(SolutionDir)\.build are added by a PowerShell script. This PowerShell script will not be run when restoring the NuGet package.
You should add the $(SolutionDir)\.build to your source control repository.
With the newer versions 1.5+ the Nuget package doesn't install itself in the solution directory; this worked for me though:
<PropertyGroup>
<MSBuildCommunityTasksPath>$(USERPROFILE)\.nuget\packages\msbuildtasks\1.5.0.235\tools</MSBuildCommunityTasksPath>
</PropertyGroup>
It does involved adding the version, but if someone knows a way to remove having to update the version on the path when you update the package that would be awesome.