I am using Visual Studio Team Services to package a folder and pr documentation I have added a content folder, also tried with contentFiles folder, that contains another folder and then my powershell script. The package is created, but the content folder is not packaged.
Structure is like /content/ReleaseScripts/MyScript.ps1
If you package project file directly, you need to change that file’s Build Action to Content. (Right click the file in VS > Properties >Change Build Action to Content)
If you just create .nuspec file in a folder (no project file, such as .csproj) and pack this .nuspec file, you can refer to these steps:
Add Nuget.exe tool to source control and map to build agent (same folder level (content folder) that you need to package) or add it to the environment variable (path) of build agent service account.
Add Command Line task (Tool: nugget.exe; Arguments: spec; Working folder:[same level path that you need to package, such as the folder path that contains content folder]
Add NuGet Packager task (Path to csproj or nuspec files to pack: **\*.nuspec)
Related
I have created a sample Website project with a single page having HellowWord.aspx and HellowWord.aspx.cs. I am trying to create an Azure DevOps build pipeline for this project. The following are the tasks I have added to my build package.
But the publish artifacts always contains the aspx and aspx.cs file. Not sure which tasks I am supposed to add to make the proper publish package. Which will create proper dlls for .aspx file instead of aspx.cs.
Publish build artifacts task has an argument Path to publish, which defines the folder or file path to publish. This can be a fully-qualified path or a path relative to the root of the repository. Wildcards are not supported. Variables are supported. Example: $(Build.ArtifactStagingDirectory). By default, this argument uses variable $(Build.ArtifactStagingDirectory).
So you need to check your Copy files task, to see what you have copied to $(Build.ArtifactStagingDirectory), and copy the correct files in this task.
https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/copy-files?view=azure-devops&tabs=yaml
I have a file copy task in my build to copy the Web.config in the root of my create-react-app project folder, and it shows that it is copying it to the build file after the yarn build task completes.
But it is never in the archived folder. How do I modify this build or copy files task to get this Web.config file into my build folder so that it can get archived and dropped for release?
I copy it from the $/repo dir/app folder to build (yarn build step creates the build folder)....but the Create release package that archives the build folder does not contain it in the produced zip.
Here's a screenshot of my folder structure in my repo (what's in the $/repo dir/app folder):
In the Copy task you need to specify full path of the build folder, for example:
$(Build.SourcesDirectory)/build
Because you have coded all the paths, I can’t analyze this issue according to your specific situation.
You can specify the Web.config file from ... to see if it can be successfully copied to the build folder.
It would be much easier for people to investigate further and reply if you could attach detailed file path and logs.
Include the web.config file in the public folder
Now the file gets included in the build and dropped for release
I have a problem with my CI in Azure DevOps.
I need to have a generic PowerShell script run in each CI that copy files from the bin folder and put them to artifact(a) folder with each project folder name.
But bin path are dynamic e.g.
$projectBinDirectory\bin\release\net471\win-x64
$projectBinDirectory\bin\release\net471
$projectBinDirectory\bin\Release\netcoreapp2.1\win-x64
$projectBinDirectory\bin\Release\netcoreapp2.2\win-x64
$projectBinDirectory\bin\Release\netcoreapp2.1
in the future, if someone creates netcore 2.2 or something else how to configure publish path dynamically as I want to copy main project files
e.g.
copy from
bin\release\netcoreapp2.1\win-x64 all project *.dlls,*configs etc files
to
artifact\Projectname\ all project files
the issue
cannot figure out after bin\release\ path to reach to project files
I need to figure out what is the path dynamically after bin\release...\projectFiles
this argument fixed my issue
-c Release -o ./bin/$(BuildConfiguration)/publishNew:
I have three visual studio database projects with .sql files. Instead of publishing the projects to a database, the SQL needs to be executed at a specific moment.
I added another project to package everything into one nuget package (including some generic scripts). So the .nuspec file should specify the SQL files that need to be included.
<file src="..\otherproject\code.sql" target="Content" />
We use TeamCity to build our projects and Octopus Deploy to pack the nuget packages. When TeamCity tries to build the package OctoPack says it can't find the file:
error OCTONUGET: File not found:
'..\otherproject\code.sql'.
I've checked, the file is present on the build server on the requested location.
How to access the parent folder? Or is there another way to include files from other projects?
This code is perfectly fine. My .nuspec file was named like the solution instead of the project.
So I'm actually trying to package up a web site project (not web application so no csproj file) into a NuGet package ready for Octopus to consume but am running into one brick wall after another..
I looked into using OctoPack but it doesn't support web site projects only web application projects.
I am now trying to find a way of adding a folder (in my case a web site) into a Nuget package but Nuget doesn't allow this via the command line does it? It also requires a .csproj file!
I've also tried trying to create the NuGet spec files and pass it in a folder but not possible?
For the moment I may have to use the NuGet package explorer but I want to script this.
I've looked at this question but doesn't seem to handle my scenario
Can I create a nuget package without a project file
So does anyone know how to best add a folder to a NuGet package via the command line!?
I don't know OctoPack, but with nuget.exe, packaging is done in two steps:
Either create a .nuspec manually, or generate one from a .csproj or existing assembly (see nuget spec in the docs).
Call nuget pack with the .nuspec created in the previous step as a parameter.
Since you don't have a .csproj lying around, you're stuck creating the .nuspec manually (or with a GUI tool like NuGet Package Explorer).
You can read all about how to create a .nuspec file in the Nuspec Reference, specifically the section about Specifying Files to Include in the Package.
If you want to include a folder (recursively?) in the package, you need to add something like this to the XML:
<files>
<file src="bin\Release\**\*.*" target="content" />
</files>
This will take all the files and (recursive) sub-folders of the bin\Release folder and put them in the content folder of the NuGet package.
I have no idea what format OctopusDeploy expects in the packages, but that's how you include a folder in the package.
EDIT: There seems to be some documentation on this in the OctoPack README.