TFS 2015 Publishing build artifacts using file share option failed - visual-studio

I wanted to created a demo app that does automatic deployment. In other words once I check-in my code changes, the changes can be seen on the published website. I did the following steps:
I created an .NET project on Visual Studio 2017, published the project with IIS instructions from here and here. I published my project to a local file on my machine;
The I did Continuous Delivery and Release Management using TFS 2015 and created a build and release definitions from here;
The final step was to use the Copy File to and Publish Artifacts tasks, using file share option to drop the contents to the publish folder I've created. So when I check-in my changes using TFS, the changes will be seen online.
Here is the configuration for the build definition:
The folder in the file share path is shared to everyone, and the path is correct (when I type it in the browser, I can see the folder's contents).
The error I keep getting is the following:
Publishing build artifacts failed with an error: Unable to create
directory '{p}'. Unable to verify the directory exists: '{testDir}'.
If directory is a file share, please verify the share name is correct,
the share is online, and the current process has permission to access
the share. \localhost\builddrop\drop \localhost\builddrop\drop
I've been trying to solve this for 2 days with no luck, but I could not find similar issues... I would like to know what is causing this error, or if you have any hints or tips that will get me closer to the solution.

Thanks to #Maxsur answer I realized that I did not install a build agent, which is needed for in case you want to publish your code into a file share.
I did that by going to the team foundation server web portal clicked on the gear sign, and chose Agent Queues and followed the steps. Additionally you will also need to acquire a token by clicking on your profile icon then choosing security and add new token.
Reference: https://learn.microsoft.com/en-us/vsts/pipelines/agents/v2-windows?view=vsts

Try to check (and change) an account for your build agent service.
It can be found at Windows Services -> VSTS Agent on build machine (or TFS server if it used as build machine).
This service can run under "local service" account, which cannot access network shares (even on local machine!).
Try to change this account to Administrator (for example) or setup one by guidelines of MSDN

In your Publish Artifacts Task, you've specified //localhost/builddrop/ in File share path, which is not correct. You need to specify the File share path as below:
\\servername\builddrop

Related

Azure Artifacts - Downloading Maven package content throws azure UnhandledPromiserejectionWarning

One of our development teams have recently migrated their Maven project files from another version control system to Azure DevOps. However, a major caveat is that these Maven projects were created with no POM files (I have no idea why).
The project team have in any case managed to move all of their Maven packages into Azure Artifacts. When a release pipeline job is then run, it is then expected to retrieve the desired artifacts (*.war files) from Azure Artifacts, download to the agent's artifacts directory and subsequently deploy to the target server. The pipeline itself is completed successfully (all tasks set to green status), however when we review the output log, we discover that the artifacts were never downloaded and instead, the download task returns an "UnhandledPromiserejectionWarning". Any idea why this is happening?
So far, we've tried using CURL as an alternative to download the artifacts, but all has been in vain. Naturally, we've also tried and failed with the Azure Artifacts' dedicated "Download Package" pipeline task, but are willing to try an alternative solution, if anyone has some kind suggestions. Been wondering something like Powershell (or other script) can for instance be used to download the desired package files.
I must also mention that the CURL option only appears to fail over a failed OAuth authentication. Any advice on that front will also be helpful, as it is probably our quickest route to a workaround.
I had a similar issue, it turns out the problem was just the capital case.
The DownloadPackage task was trying to download 0.0.30-SNAPSHOT, but instead you can only download the package as 0.0.30-snapshot, as it states on the microsoft official docs.
In order to fix it, I had to install an external plugin, then add an additional task before download, that task was converting the name to lower case.
I was using the classical release pipeline, btw.

How to setup and use VSTS for five user

Our office uses VSS as source control. Just come to know that VSTS is free for five users and our team is very small with 5 devs.
I have never use VSTS. so i have few questions. please answer pointwise and with detail along with images if possible.
how to create an account for VSTS?
how to upload our local project exist on my pc to VSTS
how could I send an invitation to other 4 developers in our team, as a result, they can clone our uploaded project on their own pc and start working?
I got one link which is showing how to Add Local Project to GIT in VSTS but I need to know how to add a project to TFVC in VSTS.
Create an account
Go to VisualStudio.com, log in using MSA, pick an available account name and register. If you have an Azure subscription and an Azure Active Directory, you can also create the account from the Azure portal, that way you can use your company-account to log on.
Upload local project
When you create your first project you get to choose whether you want TFVC or Git. Once the project is created, getting your sources in differs depending on your choice.
If you pick TFVC you must create a local workspace on your machine, copy the sources into that directory, then check them in.
Invite other users
To add other users to VSTS they need to have an MSA account or to be part of your AAD (depending on how you setup your account). Then go to the Users hub in the VSTS admin panel and add them to your account. The first 5 basic users are free. If users have an MSDN account (pro or higher) they do not count towards the free user limit as VSTS access is included in the subscription.

Visual Studio Team Services Could not load file or assembly 'classlibrary' or one of its dependencies when changed to build branch solution

We've got an agent build working on the main development branch from Visual Studio Team Services (VSTS).
With our agent build configuration set as:
This is working fine, the build agent picks up the source and builds.
Now, I want to make the build agent build the R5 code which is identical to the Main Dev Trunk code - newly created branch.
So in VSTS I change the folder to build to:
When a file is checked in it triggers the build. It builds no problem.
But for some reason I getting this error when loading the website.
"Could not load file or assembly 'classlibxxxx, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies. The
system cannot find the file specified."
The code is identical, so must some setting in VSTS?
Do I need to change anything else in VSTS, is the path correct, or what else could it be?
UPDATE - what I do notice now is that the log is telling me it is download all the sources (even for the previous R1-R4 releases)
Okay! Since it's way TL/DR to wade through the, what I'm finding is very poor, documentation for VSTS... Here is what was causing it:
The mystic _work directories of the agent... E.g. c:\agent\1,2 etc. are NOT output directories.
The website had been pointed to one of these folders and by some fluke must have been working.
What is needed is another step in the Build Definition to actually place the compiled files into something meaningful.
You need to supply an Admin Username and password even if it on a drive local to the Agent.
But hey presto, after 6hrs of madness... all the projects are lined up and will run without issue.

Team City not able to fetch source code from TFS for build

I know little about this, but it has fallen to be at work to look into. I know a really tiny bit about TFS, and a little less than that about Team City, but do have access to both.
I have a Team City project that watches for commits to a TFS repo. When someone checks in files, TeamCity fetches them, then builds the project and publishes it via web deploy to our 'Dev' environment. This process is much less automated for higher grade environments like UAT etc.
Now, suddenly about two weeks ago, someone changed something, and when do a build in TeamCity I get two error messages. The first seems more introductory, that there has been a problem:
Failed to collect changes, error: Failed to get current version of TFS
root. TF400324: Team Foundation services are not available from server
applogix-projects.visualstudio.com\DefaultCollection. Technical
information (for administrator): The remote name could not be
resolved: 'applogix-projects.visualstudio.com'
The second error message, displayed on the same screen as the first, is slightly more technical, and even includes a fairly verbose stack trace, which I will omit until clearly necessary. The 2nd message:
Failed for the root '"Hollard - MLAM - Web" {instance id=4, parent
internal id=1, parent id=HollardMlamWeb_HollardMlamWeb, description:
"tfs: https://applogix-projects.visualstudio.com/DefaultCollection
$/Hollard - MLAM/HollardMLAM/Hollard.MLAM"}: Failed to get current
version of TFS root. TF400324: Team Foundation services are not
available from server
applogix-projects.visualstudio.com\DefaultCollection. Technical
information (for administrator): The remote name could not be
resolved: 'applogix-projects.visualstudio.com'
Those remove names that cannot be resolved within Team City, e.g. applogix-projects.visualstudio.com\DefaultCollection resolves fine when I paste it into a browser, and it directs me to our Visual Studio Online location for the project.
What I would appreciate as an answer here is an overview how the TFS fetch and TC build basically occur, and then some settings in TeamCity and or VS Online TFS that could be causing something like this.
It might be worth noting that if I pull the 'official' publish profile for Dev, and manually straight from VS Publish wizard, the app builds OK is well deployed to the Dev environment.
You need to check VCS settings in your teamcity build. Follow below steps:
Go to Edit Configuraton settings
Click on Version Control Settings
Check TFS URL and other settings
Check Configuring VCS Roots for more details.
If the credentials are incorrect then Visual Studio Online will report that it does not exists to prevent hackers.
Tge most likely issue is that the credentials are invalid. You should check that the user still exists and has the correct permission. You may have to use the "alternative credentials" from a users profile.
You can use the TFS Credential Viewer to get master unattended credentials for your VSO account, however these are the keys to the kingdom, so protect them.

AppOffline rule issue w/ Continuous Integration/Build

I've connected Visual Studio Team Services to an Azure Website to enable automatic deployments. New Relic is running as a system process and therefore NewRelic.Agent.Core.dll is locked which prevents successful builds from being deployed.
I've tried adding a wpp.targets file to the solution in order to utilize MSDeploy to copy an app_offline document to the site before deployment, then delete it when deployment is done like seen here. However, it doesn't seem as if it is executing. I don't see anything in the build logs and my deployments continue to fail.
How do I take the app offline when using the VS Team Services/Azure CI process?
I came across this old post and there are now build tasks to start and stop an app service. See the Azure App Service Manage under the deployment tasks in the build task catalog.
Slightly different to what you are asking but what you could do is to login to your Azure website and set COR_ENABLE_PROFILING to 0 before your build runs. You then deploy as normal. Once done you set COR_ENABLE_PROFILING back to 1.
The act of changing the setting will cause an IIS reset and setting it to zero will disable the file from being locked again before the publish finishes.
Source: https://discuss.newrelic.com/t/visual-studio-online-azure-website-continuous-integration-fails/3825

Resources