3

I like to use VSTS ("visual studio team service") but I have a major problem.

Basically, I have a few class library solutions (e.g. ClassLibrary1 , ClassLibrary2 ) which I use them as reference in my other projects (e.g. websiteSolution1, websiteSolution2 , websiteSolution3.)

Of course, I like to have a separate git repo (Team project in VSTS) for each solution, let's say the "team projects" have the same name as the solution which they contain.

Now I like to create some build definitions with the below rules:

  1. if someone commit any change to one of the classlibrary "team project" (e.g. ClassLibrary1) then first we build that classLibrary solution and use the result ( the DLL file) to feed it into Websites solutions (e.g. websiteSolution1, websiteSolution2 , websiteSolution3.) and finally build the web solutions (which are in different team project but the same account)

  2. if someone commit any change to one of the Websites solutions (e.g. websiteSolution1) then first we build every classlibrary "team projects" (e.g. ClassLibrary1 , ClassLibrary2 ) and use the result ( the DLL file) to feed it into Websites solutions thehas a commit (e.g. websiteSolution1, ) and finally build the web solution (which is in different team project but the same account)

Problem : when I create a new "build definition" I only can see the codes within the same Team project that contains the build definition.

Farzad J
  • 1,089
  • 2
  • 14
  • 28

1 Answers1

1

Multiple repositories for VSTS git build is not supported. (We can map multiple sources if we are using TFVC)

There is a related user voice that you can vote it.

The workaround:

You can get additional files in other repository via git command (Command line build step and you need to check Allow Scripts to Access OAuth Token in Option tag of your build definition).

enter image description here

1.if someone commit any change to one of the classlibrary "team project" (e.g. ClassLibrary1) then first we build that classLibrary solution and use the result ( the DLL file) to feed it into Websites solutions (e.g. websiteSolution1, websiteSolution2 , websiteSolution3.) and finally build the web solutions (which are in different team project but the same account)

Steps:

  1. Create a new build definition for classlibrary project/solution
  2. Add PowerShell build step to call build REST API to queue the build of your Website (Check this article for code)
  3. Check Continuous Integration (CI) and set the branch filters in Triggers tab of this build definition

2.if someone commit any change to one of the Websites solutions (e.g. websiteSolution1) then first we build every classlibrary "team projects" (e.g. ClassLibrary1 , ClassLibrary2 ) and use the result ( the DLL file) to feed it into Websites solutions thehas a commit (e.g. websiteSolution1, ) and finally build the web solution (which is in different team project but the same account)

Steps:

  1. Create a build definition for WebSites solution
  2. Add Command Line build step to Run git command to get classlibrary files in another repository (refer to previous screenshot)
  3. Add Visual Studio Build step to build classlibrary project/solution
  4. Add Copy Files step to copy build result file (e.g. .dll files) to necessary folder per related path of classlibray reference of website project. You can check it in the project file,

for example:

<Reference Include="ClassLibraryB">
      <HintPath>..\..\MSBuildDemoSolution1\ClassLibrary1\Lib\ClassLibraryB.dll</HintPath>
    </Reference>
  1. Add Visual Studio Build step to build website project/solution
starian chen-MSFT
  • 33,174
  • 2
  • 29
  • 53