Is it possible to use VSTS release generate ipa and apk files and release to the stores ?
There should be Build Definitions to create an .apk and .ipa in VSTS. You can see the Build Steps here:
Xamarin.Android:
https://www.visualstudio.com/en-us/docs/build/apps/mobile/xamarin#build-steps
Inside the Build: Xamarin.Android step, there is a note saying that the project needs a PackageForAndroid target.
Note: The projects must have a PackageForAndroid target.
i.e. /t:PackageForAndroid
https://www.visualstudio.com/en-us/docs/build/steps/build/xamarin-android
Xamarin.iOS:
https://www.visualstudio.com/en-us/docs/build/apps/mobile/xamarin#build-steps-1
Inside the Build: Xamarin.iOS step, there is an Create App Package argument you can use:
https://www.visualstudio.com/en-us/docs/build/steps/build/xamarin-ios
I would highly advise that you read through each Build Steps on both Xamarin.Android and Xamarin.iOS to get a better idea of what's going on!
Related
I have a build build script(MyBuild.sh) set up for creating the Android apk for a xamarin forms application.
My requirement is when i give the internal test builds i want the microsoft app center crashes and analytics in the the project csproj but when i take the PROD builds i don't want the microsoft app center crashes and analytics in the project
so in the build script i check whether its a PROD build and tried to remove the app center packages from the csproj.
if [ $Env == 'PROD' ]
then
dotnet remove ./Sample/Sample.csproj package Microsoft.AppCenter.Analytics
dotnet remove ./Droid/Sample.Droid.csproj package Microsoft.AppCenter.Crashes
fi
My problem is when the script is executed it correctly removes the package from the Shared Code but not from the Droid.csproj and while trying to remove the package it throws
info : Removing PackageReference for package 'Microsoft.AppCenter.Crashes' from project './Droid/Sample.Droid.csproj'.
error: The imported project "/usr/local/share/dotnet/sdk/2.1.4/Xamarin/Android/Xamarin.Android.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. /Users/george.thomas/Documents/Nov/Candidate/Droid/Sample.Droid.csproj
Now if i remove the MSBuildExtensionsPath from the Droid.csproj and run the script it correctly removes the packages but the project cant be built
throwning The target "Build" does not exist in the project
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
I'm trying to create a pipeline in Azure DevOps and I get compilation errors caused by a missing reference:
[warning]C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5):
Warning MSB3245: Could not resolve this reference. Could not locate
the assembly "ABC". Check to make sure the assembly exists on disk. If
this reference is required by your code, you may get compilation
errors.
I have a VS2017 solution with 2 projects.
ABC which is the actual application
ABC.UnitTests where I added some unit tests (I'm using MSTest)
When I build the solution locally, I'm able to do a successful build with the following steps:
Build ABC project => ABC.dll is generated
Add reference in ABC.UnitTests proj to ABC.dll
Build the entire solution => build successful
The .cs file in ABC.UnitTests references the application in this way, and generates the warning above:
using ABC;
If I do a clean build where ABC.dll is deleted and then I do a build of the entire solution I get the same MSB3245 warning. So the issue is reproducible locally if the dll does not exist.
Then, when I upload the solution to Azure DevOps, I do the following steps.
Upload the solution from local VS2017 and a project is created in Azure
Build the project in Azure DevOps => reference issue reported
I have a YAML config file with name azure-pipelines.yml which references the hosted 2017 agent.
pool: vmImage: 'vs2017-win2016'
Alternate flow:
Upload the solution from local VS2017 and a project is created in Azure
Comment out the reference to ABC.UnitTests project from the sln file
Create the pipeline => build successful.
You shouldn't refer any DLL as you mentioned in the comment.
The proper way is to refer to as a project. This way the DLL takes care of itself during the build
Proper way is
References -> (Right Click) Add References -> From that using Projects tab you can choose the Project which is generating that DLL(assemblies)
You can refer this SO
I'm trying to build my solution and package up the web app into a web deploy (.zip) package to be deployed.
I've added the Visual Studio Build step with the following MSBuild Arguments:
/p:DeployOnBuild=True /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:PackageLocation="$(build.artifactstagingdirectory)\"
And I've set up the Copy and Publish Build Artifacts step to copy all .zip files to the drop folder.
The build completes successfully but nothing is copied to the drop folder because there are no .zip packages that get created.
So when I look on the TFS server, the only thing in the 'a' folder is an empty 'drop' folder. And in the 's' folder is the solution directory with a PrecompiledWeb folder in it. Not sure what that is but it doesn't look like the deployment package (and it's not a .zip).
Any ideas?
I have tried the same on VS2015 MVC web application using VSTS and TFS 2015.2.1 both. I had to do a slight change to the Build arguments in Visual Studio build. That is removing the trailing "\" in /p:PackageLocation="$(build.artifactstagingdirectory)\".
Here is the argument I passed to Visual studio build step
/p:DeployOnBuild=True /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:PackageLocation="$(build.artifactstagingdirectory)"
Then I used Copy and Published Build Artifacts (Deprecated in VSTS you should use Copy task and Publish task instead of this task) as shown below
This gives me output as below.
First suggest you manually remote in the build agent and build the project through MSBuild command line with arguments to see if the project builds properly.
This will narrow down the issue is related to the environment on your build agent or your build definition.
You should directly use /p:PackageLocation=$(build.stagingDirectory
Besides since you have multiple assemblies that are referenced in the web app. Please also double check dependencies that are building in the correct order or referenced correctly.
Make sure the ASP.NET development workload of Visual Studio is installed.
If DeployOnBuild is having no effect, you may need to install the ASP.NET Development "workload" with the VS setup tool.
There are specific .targets files that, if they don't exist, cause these parameters to be silently ignored. Installing this adds those .targets and the parameters become active, allowing the .zip to be created.
For me (VS 2017) the relevant target file (or one of them, anyway) that was missing but is needed is:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Web\Microsoft.Web.Publishing.targets
If it is missing, you'll need to install as above, and if it is there, then you have a different problem. ;)
First of all, I'm a complete beginner on the whole Xamarin-life-cycle, build tools and terms, so sorry if this is quite basic/incorrect in some wording.
We have a Example.sln file with the following project definitions; one for Android and one for iOS:
Project("{...}") = "Example", "Example\Example\Example.csproj", "{...}"
EndProject
Project("{...}") = "Example.Droid", "Example\Example.Droid\Example.Droid.csproj", "{...}"
EndProject
Project("{...}") = "Example.iOS", "Example\Example.iOS\Example.iOS.csproj", "{...}"
EndProject
I'm currently trying to build just the iOS project with xbuild on the command line. My question is if there's a way to specify this on an xbuild flag; e.g. tried with /t:Example.ios:Build and stuff alike without luck. So I simply tried unbundling the Android project and running:
$ xbuild /p:Configuration="Ad-Hoc" \
/p:Platform="iPhone" \
/p:IpaPackageDir="./Builds" \
/t:Build Example.sln
Which, I guess, since the Droid project is still before iOS on the .sln, is failing when looking for the Android SDK:
/Users/ci/Example-app/Example.sln (Build) ->
(Build target) ->
/Users/ci/Example-app/Example/Example.Droid/Example.Droid.csproj (default targets) ->
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets (_BuildSdkCache target) ->
: error XA5205: The Android SDK Directory could not be found. Please set via /p:AndroidSdkDirectory.
Temporarily removing the Android project from the solution did the trick (preserving the Example\Example.Droid files but commenting out the 2 lines) but it's not quite optimal for me, i.e. maybe in some other CI job I want to just build the Android app, etc.
Thanks!
You could disable the Android project from being built for your Platform=iPhone case via the Configuration manager (see Solution Configurations section). Or you can create a separate config/platform combo for your solution that enables only the common projects and the iOS ones.
Once you have that, then you can just select that configuration and platform combination on the command line with xbuild or msbuild with
xbuild /p:Configuration=.. /p:Platform=.. foo.sln.
I would suggest you to execute the xbuild command from the folder of your Xamarin iOS project or specify a target for your command like this:
xbuild /p:..... iOSProject/app.csproj
xbuild takes the path of the project or solution file to build, as the
main argument. If no file is specified then it tries to build any
solution file or project file in the current directory, that has a
*proj extension.
If you need to force an SDK or a specific build tools path you have to specify:
/p:AndroidSdkDirectory=$YOUR_SDK_PATH
/p:AndroidSdkBuildToolsVersion=23.x.x
xbuild command reference
I've read many articles on publishing from TeamCity using various versions of Visual Studio. I'm currently using v.9.1.7 of TeamCity and Visual Studio 2015.
I have my 3 build steps on check-in:
Clean & Rebuild
Unit Test
Publish
When I check in my files I get a Tests Passed success message:
I can tell from here something isn't right as I'm expecting it to say something about publishing. When I look at the Build Log I see the following:
[12:48:22][API\API.sln] Publish [12:48:22][Publish] MSBuild [12:48:22][MSBuild] API\API\API.csproj: Build target: Publish
[12:48:22][API\API\API.csproj] _DeploymentUnpublishable
My Publish Build Step is setup this way:
In my API project in Visual Studio I can publish to the correct location on the network. Here is my publish profile:
I'm not sure what I'm missing. I'm expecting the Publishing build step to work like when I click the Build->Publish menu item in Visual Studio.
I'm guessing that I'm missing something or misunderstanding what the publishing build step is supposed to do.
Any help is appreciated.
I was able to get it to work after days and days of searching. I found part of the answer here on Stack Overflow. The trick was to get it to work from the MSBuild Command Line:
C:\TFS\project\myProject\APIproject>msbuild apiproject.csproj
/p:DeployOnBuild=true
/p:PublishProfile="Properties\PublishProfiles\DEV.pubxml"
/p:VisualStudioVersion=14.0
Once I got this running several times I was able to create a Build Step in Team City (see this question/answer) and I set the following:
Build file path: <location of the apiproject.csproj>
MSBuild version: Microsoft Build Tools 2015
MSBuild ToolsVersion: 14.0
Run platform: x86
Command Line Parameters: /p:DeployOnBuild=true /p:PublishProfile= "C:\TFS\API\API\Properties\PublishProfiles\DEV.pubxml" /p:VisualStudioVersion=14.0
IIRC, publishing from TeamCity requires certain files or alternatively VS installed on the build agent (which really isn't recommendable). Have you copied the necessary files to the build agent?
Where are artifacts location defined.
And you can use Tentacles for publishing build into various environments.
I guess, you need to look towards artifacts configurations.
You can use MSBuild runner to Deploy your Application/API
Add Command line parameter :
/t:Clean /p:DeployOnBuild=true /t:build /t:publish /p:PublishProfile=C:\_works\teamcity\publishprofiles\Publiush_Profile.pubxml /p:VisualStudioVersion=12.0
PublishPrfile URL should be your publish profile path.
This will work for you.
VS will probably find your publish profile with just the name, like:
/p:DeployOnBuild=true;/p:PublishProfile=DEV; very useful if you run more than one build agent.
And if you're deploying to an IIS you might need to add AllowUntrustedCertificate=true;