How to publish binaries TFS 2017 - tfs

Whenever i do the publish its having the CS and Solution files as well.
I tried too many things but all in vain
enter image description here
These are my MS build arguments
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\CC

You're specifying a package location in your MSBuild arguments: /p:PackageLocation="$(build.artifactstagingdirectory)\CC. That's the path you want to publish as an artifact if all you want is the packaged binaries.
The path you're currently specifying, $(agent.builddirectory)\s\Main\State is the location used by the build agent to synchronize source code, so of course you're capturing source code when you publish that as an artifact.

Related

Azure DevOps Server 2020 - Publish Artifact ignoring File Copy Options

We have a build pipeline that's been working for a year or two. This builds and creates a few artifacts - ASP.Net web application, windows services, etc. The issue here is with the ASP.Net web application.
We've added some REACT components to the build. There are now an enormous \React\node_modules\ folder with tens of thousands of files. I want to exclude the \React\node_modules folder from the "Publish Artifact" step. I've edited this step, by adding this under the File copy options setting:
/XD react/node_modules
I have a "Publish Artifact" task that has "/XD react/node_modules" set as the File Copy options. However, when I run the build pipeline, it still copies everything in the react/node_modules folder.
When I view the raw logs, I do not see that being passed as an argument in the Robocopy command. I only see this in the logfile for the Publish Artifact step:
2022-04-13T00:24:47.8605686Z ##[command]robocopy.exe /E /COPY:DA /NP /R:3 /MT:8 "C:\agent_agentwork\1\s\Website" "c:\builds\HF\HF_3.8.1.75\Website" "*"
Any idea why it's not working here?
This is a bug in the Publish artifact task. A github issue has been logged for this in 2019 (https://github.com/microsoft/azure-pipelines-tasks/issues/11451). Sadly, it is not fixed yet.
Awaiting a fix, you could work around it by putting a build step that explicitly calls robocopy to copy the build output to a temporary location (with the /XD switch). And then put the 'Publish artifact' step that copies from that temporary location.

What MSBuild Arguments do I need to set so that I can make this work?

I have a solution that has a Web Site (not a Web Application) and I'm having trouble setting up my Visual Studio Build task.
Usually I setup my MSBuild Arguments like so
/p:DeployOnBuild=true
Then in my Copy Publish Artifact, I e
$(build.sourcesDirectory)/AppSolution/Website/obj/$(BuildConfiguration)/Package/PackageTmp
What MSBuild Arguments do I need to set so that I can make the above work?
The files do not get copied over to the obj/$BuildConfiguration)/Package/PackageTmp folder. So when I go look at the output folder, it just looks like the code files. Not the binaries
Use the MSBuild argument /p:PackageLocation=$(Build.ArtifactStagingDirectory), then publish $(Build.ArtifactStagingDirectory) as an artifact.

Publish Binaries in TFS 2017 MS BUILD

These are my MS build arguments
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\CC
What should I use to Publish only binaries using Publish artifacts. I am getting code files only.
If you just want to output the files without zip, then you can try below ways:
Specify the argument OutputPath only (without specify the package
related arguments):
e.g:
/p:OutputPath="$(build.artifactstagingdirectory)\cc"
You can also output the target files to a shared path (UNC path):
e.g:
/p:OutputPath="\\myshare\DirA\0313"
Then use Copy and Publish build Artifacts task to publish the
files. Alternatively you can add a Copy Files task to copy the
files from OutputPath to a Temp folder, then use Publish
build Artifacts task to publish the files from Temp folder.
Reference the first screenshot.
Another workaround is using the publish profile:
Create a Folder publish profile, you can chose a shared folder
to publish. (Refer to this link to create the publish profile)
Add below MSBuild arguments in VS build or MSbuild task:
/p:DeployOnBuild=true /p:PublishProfile=YourPublishProfile
Check the published artifacts.
Reference the second screenshot:

MSBuild not copying files with PublishProfile

I have a Visual Studio 2013 solution with the full Orchard source code. When I use "Publish..." on the "Orchard.Web" project in Visual Studio, it correctly publishes the site to the File System destination I've configured into the .PubXml file that I used.
However, if I build this site using Jenkins, the files do not get copied to the destination. I've created a separate PubXml file that is used by Jenkins.
In my Jenkins job, I have two Build steps of interest. The first uses the src\Orchard.sln file with a command line argument of /p:Configuration=Release. This runs correctly, and builds the entire solution.
The second Build step, immediately after, uses the Build File of src\Orchard.Web\Orchard.Web.csproj and these command line arguments:
/p:DeployOnBuild=true
/p:PublishProfile="D:\workspace\Site\trunk\src\Orchard.Web\Properties\PublishProfiles\Jenkins.pubxml"
/p:VisualStudioVersion=12.0
/p:Configuration=Release
/p:Platform=AnyCPU
/v:minimal
/nologo
/p:WarningLevel=1
With this, the build and deploy seems to work - but doesn't. Here are some lines from the build output:
Copying all files to temporary location below for package/publish:
obj\Release\Package\PackageTmp.
Auto ConnectionString Transformed obj\Release\Package\PackageTmp\Shapes\Scripts\Web.config into obj\Release\CSAutoParameterize\transformed\Shapes\Scripts\Web.config.
(... about 200 more "Auto ConnectionString..." lines...)
Finished: SUCCESS
No where does it actually copy the files to the destination defined in the PUBXML file.
In contrast, in Visual Studio, the output looks similar, but transforms only 4 config files and includes lots of "Publishing folder x" lines:
(...)
Transformed Modules\SH.GoogleAnalytics\web.config using ....
Copying all files to temporary location below for package/publish:
obj\Release\Package\PackageTmp.
Publishing folder /...
Publishing folder bin...
(etc.)
(I have installed the latest Windows Azure SDK for .NET on the Jenkins server.)
I have the same trouble,that work for me:
/t:Rebuild
/p:DeployOnBuild=true
/p:PublishProfile=Jenkins_Publish
/p:Configuration=Release
do not use /p:VisualStudioVersion=xxx
This is kind of old, but I actually just set up Orchard to be able to get built via command line and MSBuild. Here is what I did:
/p:VisualStudioVersion=12.0;PublishProfile="example-profile";DeployProjA=true;FrameworkPathOverride="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v4.5";Configuration=Release;PublishProfileRootFolder=c:\Workspace\src\Orchard.Web\Properties\PublishProfiles;Password=ExamplePass
Since you are using Orchard you want to make sure that only the Orchard.Web project gets published so do not use DeployOnBuild=true. This will attempt to deploy every web project in the solution, which is a lot for Orchard. Instead follow the guidelines here to see how to deploy only the web project: http://sedodream.com/2013/03/06/HowToPublishOneWebProjectFromASolution.aspx

How to send build package back to teamcity as build artifact when building on agent/client side?

Our teamcity server uses Windows OS, so build process checkouts git source to agent Macs, and so build result package (*.ipa package) remains on agent. How to send this *.ipa build package to teamcity server, so it would appear as artifact?
At first, I have assumed teamcity should grab build result - ipa package by itself, so I'v added "OurProject/build/ipa/*.ipa" in "Artifact paths" settings in General settings of build configuration, but no artifacts appear under build result in teamcity website. Probably missing something obvious here :)
Artifact pattern like:
**/*.ipa
should publish all these files.
See also: http://confluence.jetbrains.com/display/TCD8/Configuring+General+Settings#ConfiguringGeneralSettings-artifactPaths
By default teamcity searches for artifacts inside workDir/yourCheckoutedSourceDir. My build dir is located at the root of teamcity folder on agent side and I'm using BUILD_DIR environment variable in custom scripts to set where build result should be saved. So and I'v used this environment variable in custom scripts using this format:
${BUILD_DIR}
My problem was teamcity does not recognize such format when using inside artifact paths field, so you need to use this format instead:
%env.BUILD_DIR%
If build dir is set to outside of checkout dir then the other solution would be to use relative paths like ../../Builds, but the first solution is more clearer in case the name of build dir would change.

Resources