WebApi and WebApp share a class library. How can I ensure the same build of the class library is used when either the WebApp or the WebApi is deployed?
Hello,
Originally, I had just a WebApp and it consisted of three projects/layers: WebApp -references Services -references Data Access.
Now, I have a WebApi and it uses the same Services library that the WebApp project uses: WebApi -references Services -references Data Access.
Everything is in the same solution and repository.
We now want to deploy the WebApp and WebApi simultaneously because they use the same Services library. (We wouldn't ever want two different versions of Services being used by different apps).
The main question I have is: Should we use separate Build Configurations or just add more Build Steps in the Configurations we already have?
Adding more Build Steps would look something like:
Configuration: Build
-Step 1: Build WebApp
-Step 2: Build WebApi
Configuration: Deploy
-Step 1: Deploy WebApp
-Step 2: Deploy WebApi
Adding new Configurations would look something like:
Configuration: Build_WebApp
-Step 1: Build WebApp
Configuration: Build_WebApi
-Step 1: Build WebApi
Configuration: Deploy
-Step 1: Deploy WebApp
-Step 2: Deploy WebApi
(Or possibly even two separate Deploy configurations?)
With adding new Configurations, I'm not sure how I could ensure the same build of the Services library is used.
Also, the references are direct project references...not sure if that makes a difference.
Please sign in to leave a comment.
Hi John-Luke,
thanks for your request. This is precisely what our dependency system is thought for. A method for this would be to use build pinning (https://confluence.jetbrains.com/display/TCD10/Pinned+Build) in conjunction with Artifact dependencies (https://confluence.jetbrains.com/display/TCD10/Artifact+Dependencies). Obviously, if both have a Snapshot dependency, you can run them as a custom build and select a specific build to be reused.
The suggested approach would be to have your class library on a specific build configuration. Then pin a build of it (the one you want to use), and set the artifact dependencies on your WebApi and WebApp to use that artifact from the last pinned build.
This would be the main option. If it wouldn't work, please mention why not and I'll try to suggest other possibilities.