UWP certificate issue on hosted agents - tfs

I'm trying to run UWP build using Team Foundation Server and App Center and it gives me this error.
##[error]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(3090,5): Error MSB3325: Cannot import the following key file: AppCenterTest.UWP_TemporaryKey.pfx. The key file may be password protected. To correct this, try to import the certificate again or manually install the certificate to the Strong Name CSP with the following key container name: VS_KEY_480BF88F6934FA8C
I tried creating a private agent for Team Foundation Server which fixed the issue for Team Foundation Server only since the certificate is installed on my private agent. But for App Center by default is running a hosted agent.
How to resolve this issue? Thanks.

Instead of Creating a test certificate in Package.appxmanifest > Packaging > Choose Certificate. I create the certificate in my UWP project Properties > Signing > Choose a strong name key file: > New. This steps resolved my issue.

Take a look at below statement:
Select the right type of build agent
Choose the type of build agent that you want VSTS to use when it
executes the build process. A hosted build agent is deployed with the
most common tools and sdks, and it will work for most scenarios, see
the Software on the hosted build server article. However, you can
create a custom build agent if you need more control over the build
steps. You can use the following table to help you make that decision.
Note: If you plan to target the Windows Anniversary Update SDK (Build 14393) you will need to set up your custom build agent, since the hosted build pool only supports SDK 10586 and 10240. More information to choose a UWP version
Besides, if you use a Git repository, add the certificate file of your project to the repository so that the build agent can sign the appx package. If you don’t do this, the Git repository will ignore the certificate file. To add the certificate file to your repository, right-click the certificate file in Solution Explorer, and then in the shortcut menu, choose the Add Ignored File to Source Control command.
More details please refer this tutorial: Set up automated builds for your UWP app

Related

How to publish a prod build of our VSTS extensions package to my dev VSTS (not prod VSTS), so I can validate it before publishing to prod VSTS? [duplicate]

This question already has an answer here:
How to test new Azure DevOps extension version before publishing it for everyone
(1 answer)
Closed 3 years ago.
I want to take the package as-built by the release line, and install it to another (non-prod) VSTS, so I can validate it works, before installing to our prod VSTS.
We use VSTS vNext build with VSTS task 'Package Extension' to compile the package.
This compiles 'Publisher' with value 'my-prod-publisher' into file 'extension.vsixmanifest'
I've tried:
Manually upload package to VSTS marketplace portal for "my-dev-publisher".
Results are:
'Upload Error' :
Publisher ID 'my-prod-publisher' provided in the extension manifest
should match the publisher ID 'my-dev-publisher' under which you are
trying to publish this extension.
Modify VSIX package:
Unzip the .VSIX package
Edit file 'extension.vsixmanifest' to change 'Publisher' from value 'my-prod-publisher' to 'my-dev-publisher'
zip contents into new ZIP file
change package file suffix .ZIP to .VSIX
upload to VSTS marketplace portal for 'my-dev-publisher'
Results are:
TF400898: An Internal Error Occurred. Activity Id: 64d37121-ea19-42dc-9994-dbef8e6dc205.
My google-fu failed to find content about this error relevant to my case. Didn't search too hard on this, as I wasn't expecting re-zipping the files to produce same results as how these packages are compiled.
Publish via tfx-cli
tfx extension publish --service-url https://marketplace.visualstudio.com/ --publisher "my-dev-publisher" --vsix .\my-prod-publisher.vsts-buildrelease-tasks-0.6.181012.vsix --accounts my-dev-vsts --auth-type pat --token [my-dev-vsts-PAT] --trace-level debug
Results in error:
Received response 401 (Not Authorized).
Check that your personal access token is correct and hasn't expired.
I verified 'my dev vsts PAT' isn't expired, and is authorized for "All scopes", in VSTS 'my-dev-vsts'.
Validating a branch build, instead of release-line build
Compiling the package with 'Publisher' = 'my-dev-publisher' does allow me to publish to portal 'my-dev-publisher' which then allows me to install extensions package into 'my-dev-VSTS'.
This wasn't effective enough, since I've been burned by subtle issues such as:
package/tasks version numbers not getting bumped correctly, or different values from PROD.
files/changes missed during commit to release-line.
We have support for these features in the CI/CD tasks for extensions. These build tasks also offer the option of bumping the version of the extension and the build tasks included in the extension. You can standardize the build process using a Task Group if you want to. Or use Release Management to promote the vsix from dev to prod. These tasks will actually override the publisher-id. You will also have to override the extension-id and make it private. Only one public prod extension can be made public and extension-ids are globally unique.
The alternative is to build the dev and the release vsix at the same time to ensure they're matching. Then don't use the release package until you need it.
The issues you're seeing are the reason we built these tasks.
TF400898: An Internal Error Occurred. Activity Id: 64d37121-ea19-42dc-9994-dbef8e6dc205. This happens when the zip is using the wrong compression method. In the extension tasks I had to fiddle quite a bit to get the 7z syntx right.
Received response 401 (Not Authorized). Check that your personal access token is correct and hasn't expired. is caused by the fact that when publishing from vsix the --extension-id and --publisher are ignored. But TFX doesn't tell you.

Could not find SDK SQLite.UWP.2015 when building UWP application using Hosted TFS pool

I have build a UWP application using Sqlite. On my local machine I had to install the following SQLite for Universal Windows Platform Visual Studio Extension to get it to build. I followed this blog when using sqlite on UWP
I am now trying to implement Continuous integration with Visual Studio Team Services (was Team Foundation Server Online).
I am using a Hosted pool to build my application but I get the following message:
C:\Program Files
(x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(2049,5):
error MSB3774: Could not find SDK "SQLite.UWP.2015, Version=3.12.2".
and it breaks the build.
How can I fix this on a hosted pool? I do not have physical access to the machine as this is managed by TFS online
EDIT:
After finding this is a library that is installed on my local machine (through the Visual Studio Extension) and so doesnt exist on my hosted machine meaning the reference is broken I am trying to add the respective files to source control and reference it directly from source control. But I have no idea what dll it is actually referencing as it doesnt say. The properties of the reference are as follows:
Actually there is a simple solution that has worked perfectly for us:
Copy the Microsoft SDKs folder to your repo (or submodule).
Add this to the end of your csproj file:
<PropertyGroup>
<SDKReferenceDirectoryRoot>$(MSBuildProjectDirectory)\..\..\..\..\Microsoft SDKs;$(SDKReferenceDirectoryRoot)</SDKReferenceDirectoryRoot>
</PropertyGroup>
From now on the build process will first check this directory for the required extensions and then fallback to the locally installed extensions. This works perfectly on VSTS hosted agents and doesn't require you to install all the extensions on every dev machine.
There isn't any way to install the extension on Hosted Build Agent.
Q: Does your build depend on software other than this software that is
installed on hosted build resources?
A: No. Then you can use the hosted pool.
Here is the software installed on Hosted Build Agent: Software on the hosted build server.
The work around is deploy your own build agent. With this build agent, you can install the software you want to build your project.
You can not install extra extension in a Hosted VSTS. I tried with TS support and there is no way to do it right now.
You can use difference CI service like Appveyor with give you some control over installing extension via powershell.
Or you can wait for Windows 10 Anniversary with include Sqlite.
Download SQLite for Universal Windows Platform SDK from here
Install it by double clicking.
This solved same issue with my UWP project.

Install Certificate on Build Server

We have a dream to automate our build process using Visual Studio Online Build 2015 (vNext).
We are developing Desktop application that has Windows Logo program. That's why we have to sign-authenticode every binary and msi-installer file. For that purposes ideally we have to install authenticoding certificate on build server. Please help me with some tutorial.
Instead of using Hosted Build Pool/Controller, you should set up one on-premise build server.
To work with Windows Logo program, the Windows Hardware Certification Kit is required. However, this certificate kit is not installed on the hosted build pool/controller, and you don't have permissions to install it on hosted server either. So, you need to set up one on-premise build server, install the certificate kit on it and register it with VSO. Please check this blog for the steps on how to register a on-premise build server with VSO: http://myalmblog.com/2014/04/configuring-on-premises-build-server-for-visual-studio-online/

Add an xcode project in a repository tfs

I'm trying to connect to a repository tfs a written project with xcode 5.
I'm using git-tf and it seems that the configuration in xcode 5 is correct.
The problem that feedback occurs when authentication with the TFS repository.
In xcode 5 open preferences and go in the accounts. I enter the login information with the url and in response I Access denied credentials are incorrect.
What am I doing wrong?
I was encountering the same issues when trying to authenticate in Xcode 5.
Make sure that you enabled Basic Authentication for your user profile for the TFS user account and that you selected "New Team project + GIT" instead of "New Team Project".
You can also try to clone the repository by using Terminal. Type the following command into Terminal and replace XXXXX with your values.
git clone https://XXXXX.visualstudio.com/DefaultCollection/_git/XXXXX
Then provide your credentials. Terminal will now clone the repository when authentication succeeds and your credentials will be saved to your keychain. Now when you try to authenticate in Xcode it will use the saved keychain credentials and it will (probably) successfully add your TFS repository to Xcode.
I hope this will help you!
See:
http://tfs.visualstudio.com/en-us/learn/use-git-and-xcode-with-tfs.aspx
for more information
https://www.visualstudio.com/en-us/get-started/share-your-xcode-projects-vs
Share your Xcode projects in Visual Studio Online using a Git repository. Or, if your team project uses TFVC instead of Git, you can use the git-tf command line tool to check your files into Visual Studio Online.
Enable alternate credentials
You can’t sign in to Xcode with an account that contains an # character, so you’ll have to enable alternate credentials.

How to create web deployment package from team build?

I've been reading and experimenting for days. I bought the latest "Inside the Microsoft Build Engine - Using MSBUild and Team Foundation Build". I've been trying to figure things out by looking at the build targets.
I was quickly able to get a package to be built on the build server, but I want to be able to specify the installation folder, so it doesn't go into wwwroot. I read that I would have to switch the project over from using cassini to the local IIS server. Went through all of that.
The args I'm passing to msbuild through the definition:
/p:DeployOnBuild=true /p:DeployTarget=Package /p:MSDeployPublishMethod=InProc /p:CreatePackageOnPublish=True /p:MsDeployServiceUrl=localhost
I've got SO MANY questions, but I'll start simply. If anyone can provide guidance I'd be super thankful.
If the named application doesn't exist on the build server (which it shouldn't!) the package creation fails. If I add a shell app named accordingly the package is built.
Even if I hack my way past #1 when I try to deploy using Web.deploy.cmd, it fails:
Error: Using a 64-bit source and a 32-bit destination with provider appHostConfig is not supported.
Note that the build server is 64-bit and THIS target server (development) is 32-bit. I have the build configuration building against "any cpu". Oh, and I'm invoking the deployment FROM the 32-bit machine, so there's only the 32-bit msdeploy.exe available.
In the appropriate BuildDefinition under "Process", expand the "Advanced" section and set the value of "MSBuild Arguments" to "/p:DeployOnBuild=True".
That will make your WebDeploy Package built according to your settings in the project properties.
I write 2 articles about how to create Web Package and auto deploy it to a Web Server, I think it maybe useful for you.
Auto Deploy your Website for QA with Team Build click here
How to run remote deploy with MS Deploy? click here

Resources