Exclude project from build configuration in TFS - visual-studio-2012

How do you exclude a project from the solution that is built by TFS?
I have:
Created a configuration and unticked build for the project I want to exclude.
Checked in the changes to the sln from above file to TFS.
Triggered a build under TFS with the build configuration I have added.
This doesn't work. When I build locally I can see that the build skips the project (I get "Project not selected to build for this solution configuration"). When I look at the TFS build log, I can confirm that the same configuration is used, and that the project gets built.

Looks like some sort of bug. Had the same issue.
I resolved it by manually removing the offending project from the solution file.
Find the project's GUID in the solution file - note it is the last GUID on the line, the first one seems to be the solution GUID.
Then find this project GUID and the various configurations for it in the GlobalSection(ProjectConfigurationPlatforms) section of the solution file and remove the ones you want.
Not ideal, but it works.

Related

MSBuilld copies unwanted files from Azure WebJob to another WebJob

We have 2 Azure Webjobs connected to our ASP WebApi application. None of them is using any dependencies from the other one. And yet, after publishing, one of them has executables from the other one. It's worth mantioning that this only happens on publish. Everything is normal on VS build.
This is how files hierachy looks like on Azure FTP
The first one, Deployment, is being published as expected. Those are executables in it's folder:
The second one, EmailSender, has executables from the Deployment:
What's curious, there is also app.publish folder in both of them, containing only one and the same file WebJob.Deployment.exe:
Deployment job works fine. Unfortunately Azure don't recognize EmailSender job, instead it executes Deployment. The only solution that works right now is to manualy delete Deployment's executables directly from FTP, on every publish.
Right now we tried couple of things from SO and blogs, but with no success.
Microsoft.Web.WebJobs.Publish producing duplicate assemblies in deploy package
Azure Webjobs not getting updated after new publish
GitHub solution
Azure Web Job Run Command Incorrectly Set
Edit:
I did accomplished something. It did not resolve the problem, but we don't have app.publish folder anymore. Here is the link to solution on SO. I don't know why we had 'ClickOnce security' options checked for WebJob.Deployment application.
Update:
I run few tests with MSBuild and found something curious. As I said before, Visual Studio Publish works just fine - no additional executables are deployed. But when I run MSBuildprogram (with the same publish profile and project configuration) I got additional Deployment.exe inside EmailsSender folder. This is the command I run:
MSBuild RestAPI.Host.csproj /t:Build /p:Configuration="Develop" /p:Platform="AnyCPU" /p:DocumentationFile="RestAPI.Host.XML" /p:DeployOnBuild="true" /p:PublishProfile="fakebuild_develop.pubxml" /p:OutputPath="backend\build\app\\" /p:SolutionDir="backend\\"
Can someone tell me what's the difference between MSBuild and VS Publish? I cannot find anything usefull on the internet.

How do I get images to publish to Azure through VSTS (Azure DevOps) build pipelines

I've added several images to the wwroot/images folder for an asp.net core MVC project. They are included and displaying just fine locally, however when they are published through the AzureDevOps pipeline the images aren't appearing.
I've looked at the wwroot in Kudu and determined that the files aren't in the images directory in Azure, and I looked in the build command line results in AzureDevOps and I can see that the copy command for those images isn't being run during the MSBuild, but the original banner.svg images from the base project template are being copied.
I did a search files and saw that there was a file called project.assets.json which has include statements for the original images, but not the images I've added to the project. I suspect that the issue lies with the new images not being added to the project.assets.json file. This file appears to be auto generated though. I've verfieid that the new images have a build action of "Content" and I've even tried setting to copy always but to no avail. I'm thinking there is something else I need to do to get those files to be included in the project.assets.json on build.
Anyone know how to get new images to be added and recognized through the build script in Azure DevOps?
More than likely it’s your csproj file not having the right element to include those files in publish. Try doing a dot net publish locally and see if the files show up in the output directory . If they do then you only need to run that same.net publish command at the same commit. If they do not, then you need to update your CS project file to include those files , then retry dotnet publish locally to verify issue was resolved
I figured out that if you add the images to the wwroot folder, they are added to your local wwroot but never added to the wwroot folder that's in source control. I went and added the images that were missing to the wwroot/images folder in source control and check them in. Afterwards the publish went through without issue. I tried copy/pasting to the images folder and going right click > add > existing item and both did not recognize the add operation as a pending change in source. Not sure if this is a bug in VS or what.

Unable to check into TFS and Build with Continuous Integration '

I have an Azure Web application that I checked into TFS yesterday with no issues. Upon checking in, the resource manager will inject our nuget packages and deploy if it builds successfully.
I made a few changes (added a class) and checked in today. I received this error on the build:
Here's the quote to help the future search bots:
Exit code 1 returned from process: file name 'tf', arguments 'vc unshelve Gated_xxxxxx;****** /loginType:OAuth /login:.,******** /noprompt'.
I looked into the log response, to see if I get more detail, but it says the exact same thing. I have not changed my password or username.
How can I debug this to figure out the issue?
UPDATE
To save others from the headache. The issue was that we had CI builds per project. A file from another project had snuck in as well. So I was checking in for 2 different projects on 2 different solutions (Which both go to the same TFS server). So make sure you only check in for that one project!
To save others from the headache. The issue was that we had CI builds per project. A file from another project had snuck in as well. So I was checking in for 2 different projects on 2 different solutions (Which both go to the same TFS server). So make sure you only check in for that one project!
You can receive that error as well if you try to check in a file that is in a project that is not mapped in your build definition.
Let's say that you have a file named FileA.cs that is in a project named ProjectA.csproj. If you do changes in FileA.cs and this file is included in your changes, you need to map ProjectA.csproj in the Get source step of the build definition.

Visual Studio Team Services - Release Management cannot locate tests

When using the Visual Studio Test task in Release Management, the release always returns:
No test assemblies found matching the pattern
currently Test Assembly is set to: **\*test*.dll;-:**\obj\**
I have tried multiple defaults like $(System.DefaultWorkingDirectory), etc.
The documentation I've been able to find is either not current with the existing layout of tasks, (such as the Publish Build Artifacts screen no longer containing the Contents box), is for the on premise Visual Studio 2015, or related specifically to the Build.
I've read and attempted the following:
https://msdn.microsoft.com/Library/vs/alm/Release/getting-started/deploy-to-azure
https://msdn.microsoft.com/Library/vs/alm/Release/author-release-definition/understanding-tasks
https://msdn.microsoft.com/en-us/library/gg265783.aspx#Activity_RunTests
http://blogs.msdn.com/b/visualstudioalm/archive/2015/07/31/dev-test-in-azure-and-deploy-to-production-on-premises.aspx
http://blogs.msdn.com/b/visualstudioalm/archive/2015/05/29/testing-in-continuous-integration-and-continuous-deployment-workflows.aspx
UPDATE:
I added a step to the build to Copy and Publish the test.dlls. They are now located. They all fail, due to missing other code, but they are located.
UPDATE II:
My 3_Run_Tests.log file contains the following clues:
Error calling Initialization method for test class ... To run tests that interact with the desktop, you must set up the test agent to run as an interactive process.
Test Run deployment issue: The assembly or module ... directly or indirectly referenced by the test container ... was not found.
Because of the above, I am going to accept #eddie-msft's answer.
You need to make sure that the complied file of the project which you'd like to test is also been copied and published to the same path with Test Assembly. The test will fail if only Test Assembly is copied.
I assume you are working on a C# project, in the step to copy test assembly, you can set the copy content as this:
**\YourTestProjectName\bin\$(BuildConfiguration)
I have been having a similar issue. Multiple projects in build and the test file would not be found.
No test assemblies found matching the pattern *test*.dll;-:\obj**
Fix: added additional build step "build solution" and "Copy Files to". This build was pointed to VS solution file with automated test. "Copy Files to" was left at default

Separate TFS Build excluding a single project

I have a solution that currently builds nicely in TFS. I have just added a Sandcastle help File Builder project to it so that the help files can be generated. Now the solutions takes ages to build locally (it has also doubled the build time on the TFS Server).
In practice I'd be happy generating the help files once per day, or only when specifically requested as part of a build.
I tried creating a separate solution (for a new build) which included the Sandcastle project but I got a warning saying that the projects were already under source control.
What is the best way to configure TFS/the solution for this sort of situation? Can I have two builds that run on separate schedules and include/exclude certain projects in the solution?
You can create a new solution configuration that excludes building your help project. Then in your TFS build you can specify which configuration to build. You could have a CI build that doesn't include your help project, and then a nightly build that includes everything.

Resources