Change Artifacts Explore Link in Visual Studio Team Services - azure-devops

I have successfully created a build within Visual Studio Team Services. One step of the build is to copy the outcome (artifact) to a Drop Folder which contains all versions of the artifact for that build. So far so good.
As you can see in the following image. I am using a File share as the Artifact Type and then I specify the path where the artifact has to be copied.
Now the issue. When I go to the build summary and click on the artifact tab, I can see the explore link. Clicking on that link will pop up the following:
The browser cannot open the following location due to this browser's
security settings. You will need to copy the location and open it
manually.
The location is: file://BuildServer/BuildDrops/MyArtifactName/[version
here]
OK to copy the location to your clipboard.
So I set up an FTP server in such a way that the ftp://BuildServer/BuildDrops/ URL is pointing to the same path specified in the Copy Publish Artifact build task.
But I see no way to modify the link to use my custom URL.
Ideally, the Copy Publish Artifact task should accept a variable, let's say, Artifact Link Base URL so I can pass the value for the base URL and the link will use this value instead.
Anyway, my question.
Is there any way to modify the link whatsoever?

There isn’t the way or feature to modify the artifact link URL in Visual Studio Team Services.
You can build a custom extension (https://www.visualstudio.com/en-us/docs/integrate/extensions/overview_ to build a FTP URL according to build artifact download URL, then generate a hyperlink to navigate to corresponding FTP site.
Extension sample for build results: https://github.com/Microsoft/vsts-extension-samples/tree/master/build-results-enhancer

Related

CI/CD Pipeline Azure Devops - removed folder permissons

Every time I publish my project my folder permissons get removed. My project requires IIS APPPOOL\appPoolName and IUSR to have specific access right to specific folders.
Whats the best way to apply the folder permissons after the artifact has been published?
Not sure if totally get your point. You can use location elements in the web.config file, there is a lot of information on the web about that - this gives you a start: HOW TO: Control Authorization Permissions in an ASP.NET Application
Besides, for folder NTFS permissions here rather than web security permissions. You could also add a custom target to Visual Studio's web publishing pipeline. For detail ways please take a look at what Sayed Ibrahim Hashimi does here.

File updated deployed, new file ignored

I create a web project with Visual Studio.
I use GitHub desktop app to push my code to my Github
I create an Azure DevOps project throught the Azure portal to create a CI and don't change anything
When I commit a change all the CI run, the build is done with success and a new deployment is done.
To be sure everything work I did 2 differents tests
First : I created a new HTML file in my project with the other HTML files. When I commit, build and deployment run on Azure Devops without error, but I cannot see my new file in the wwwroot folder
Second : I updated a existing HTML file. When I commit, build and deployment run on Azure Devops without error, and I can see my update on the file present on the web app.
Why this difference ? I would like understood why update work correctly but not the add. I don't know where start to troubleshoot the issue
Could you please check the "build action" of the new .cshtml file?
In visual studio, right click on the file and go to properties.
Check if the build action is set to "Content", if not set it to content and commit.
Other build actions sometimes will not show any error but the view file will not be copied upon build. This is not Azure DevOps issue, rather visual studio filetype issue.
Let me know if this was the case. Good luck :)

Retrieve a downloadTicket for an artifact in VSTS

I am trying to obtain a "publicly accessible" link for the artifact produced during the build process. The API does reference something called a downloadTicket but the API call doesn't seem to return anything related. I understand that the download would need to provide the downloadTicket through a header, but for now, my question is:
What call do I need to make, either through the REST API or within a
build task itself, to get the artifact information, including the
downloadTicket?
Or option two, is there something else I can to avoid uploading
the file to Azure blob, etc.?
Why do you have to retrieve the downloadTicket?
If you just want to download the artifacts you can use the REST API - Artifacts - Get to retrieve the downloadUrl, then you can share and use that URL to download the specific artifact. (Pleas note that the users need the correct permission to view/download build artifacts)
"downloadUrl": "https://{account}.visualstudio.com/{project}/_apis/build/builds/235/artifacts?artifactName=drop&api-version=5.0-preview.3&%24format=zip"
If you want to download the artifacts in build/release process, then you can use Download Build Artifacts task.
For your option 2, you can create a share location then select a file share as the Artifact publish location and specify the share location. Thus the artifacts will be published to the shared folder... You can set the share folder to "publicly accessible"...

How to configure hub uri to mvc controller in tfs 2017 extension

I try to add extension to tfs 2017.
I created mvc web application and uploaded assembly to bin directory to tfs (and it normally opened by direct link "http://currentip/tfs/{collectionname/{projectname}/controllername" being processed in controller and displaying view)
Also I added hub group and hub, that normally displayed.
When clicking hub I need to be redirected to relative uri like http://currentip/tfs/{collectionname/{projectname}/controllername
But now I'm always redirected to http://ip/tfs/{collectionname/{projectname}/_apps/hub/extensionname-hubgroup-hub.
How can i configure link of hub to redirect to my controller in the same server?
ps. I made attention to "base uri" core parameter of extension. But there is too pure info about it on official help page.
uri path (relative to the extension's baseUri) of the page to surface as the hub.
You could set only *.html files(html page to be used for your hub) that described in the your extension's manifest file: vss-extension.json . Can't not configured the detail uri yourself. Since it will be loaded from VSTS or TFS server.
Actually baseuri is used for local debug/develop your extension. Without this, for every small change you make, you need to completely redeploy the package and then use your browser to validate the changes.
When you add this property, you override the default location of your assets. By letting this property point to your local host you can serve the files locally and your extension will load them into the context of VSTS or TFS.
After you finished with development, just remove the baseUri from your manifest file and publish the extension to the marketplace. Afraid this is not helpful in your case. More details please refer this tutorial: Using BaseUri to develop your VSTS extension

Azure Continuous Integration Overwriting App_Data even with WebDeploy file specified to "exclude app data"

I have a Windows Azure Website and I've setup Azure Continuous Integration with hosted Team Foundation Server. I make a change on my local copy, commit to TFS, and it gets published to Azure. This is great, the problem is that I have an Access database in the ~\App_Data\ folder and when I check-in the copy on Azure gets overwritten.
I setup a web-deploy publish profile to "Exclude App_Data" and configured the build task to use the web-deploy profile, and now it DELETES my ~\App_Data\ folder.
Is there a way to configure Azure Continuous Integration to deploy everything and leave the App_Data alone?
I use the 'Publish Web' tool within Visual Studio, but I think the principles are the same:
if you modify a file locally and publish, it will overwrite whatever's on the web
if you have no file locally - but the file exists on the web - it will still exist on the web after publishing
The App_Data folder gets no special treatment in this behaviour by default. Which makes sense - if you modified an .aspx or .jpg file locally, you would want the latest version to go on the web, right?
I also use App_Data to store some files which I want the web server (ASP.NET code) to modify and have it stay current on the web.
The solution is to:
Allow the web publishing to upload App_Data, no exclusions.
Don't store files in App_Data (locally) that you want to modify on the web.
Let the web server be in charge of creating and modifying the files exclusively.
Ideally you would not have to change any code and the server can create a blank file if necessary to get started.
However if you must start off with some content, say, a new blank .mdf file, you could do the following:
Locally/in source repository, create App_Data/blank.mdf (this is going to be a starting point, not the working file).
In Global.asax, modify "Application_Start" to create the real working .mdf file from the blank starting file:
// If the real file doesn't exist yet (first run),
// then create it using a copy of the placeholder.
// If it exists then we re-use the existing file.
string real_file = HttpContext.Current.Server.MapPath("~/App_Data/working.mdf");
if (!File.Exists(real_file))
File.Copy(HttpContext.Current.Server.MapPath("~/App_Data/blank.mdf"), real_file);