Answers: <p>I managed to resolve this by installing the Nuget package Octopack on the projects that I wanted to be deployed as either separate websites or website applications. </p>
  
  <p>In this context, I installed Octopack to the 3 projects in green squares and checked-in the changes. Then on the Octopus Deploy side, I created 3 separate IIS deploy steps and just followed the typical steps. Octopus deploy now receives a NuGet package from TeamCity using the Octopus deploy plugin, Octopack build step, from there Octopus deploy has 3 IIS deploy steps, one for the main website and 2 for the website applications, each was given a custom directory path but after I had installed the Octopack NuGet packages into the appropriate projects in the solution through Visual Studio it was smooth sailing just using the general user-guide and tutorial videos.</p>
  
  <p>@richard slater - Thank-you for letting me know about Octopack, this was one of the key missing pieces that I needed.</p>
  
  <p>TLDR - If you want to deploy projects in a solution as separate websites, install the Octopus Deploy plugin to TeamCity and follow the basic tutorials, add the Octopack NuGet package to the projects you want as separate websites or web applications, set-up the Octopack step to push to Octopus Deploy over the API and use IIS steps in Octopus Deploy and you should be golden.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-11-12T22:07:33.493Z
Answers: 2019-11-12T22:14:35.507Z
Answers: 2019-11-12T22:14:35.507Z
Answers: HQ216493
Answers: <p>So you need to create packages for each of the three sites so that you can deploy each one individually.</p>
  
  <p>The first step is to <a href="https://octopus.com/docs/packaging-applications/create-packages/octopack" rel="nofollow noreferrer">create a <code>.nuspec</code></a> file for each of the IIS websites you want to package:</p>
  
  <ol>
  <li>Install OctoPack and <a href="https://octopus.com/docs/packaging-applications/create-packages/octopack" rel="nofollow noreferrer">read the entire article</a></li>
  <li>Create three empty text files next to the <code>.csproj</code>, give it the same base filename as the <code>.csproj</code>, thus if it is <code>MyApp.API.csproj</code> you want to create an empty text file called <code>MyApp.API.nuspec</code>.</li>
  <li>In each of these <code>.nuspec</code> files paste in the following template:
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"&gt;
  &lt;metadata&gt;
      &lt;id&gt;Sample.Web&lt;/id&gt;
      &lt;title&gt;Your Web Application&lt;/title&gt;
      &lt;version&gt;1.0.0&lt;/version&gt;
      &lt;authors&gt;Your name&lt;/authors&gt;
      &lt;owners&gt;Your name&lt;/owners&gt;
      &lt;licenseUrl&gt;http://yourcompany.com&lt;/licenseUrl&gt;
      &lt;projectUrl&gt;http://yourcompany.com&lt;/projectUrl&gt;
      &lt;requireLicenseAcceptance&gt;false&lt;/requireLicenseAcceptance&gt;
      &lt;description&gt;A sample project&lt;/description&gt;
      &lt;releaseNotes&gt;This release contains the following changes...&lt;/releaseNotes&gt;
  &lt;/metadata&gt;
  &lt;/package&gt;
  </code></pre></li>
  <li>Customize the template for each of your projects.</li>
  <li>Update TeamCity to add <code>/p:RunOctoPack=true</code> to the <code>msbuild</code> command line</li>
  <li>Publish your packages with the following msbuild arguments:
  
  <ul>
  <li><code>/p:OctoPackPublishPackageToHttp=http://your.octopusserver.com/nuget/packages</code></li>
  <li><code>/p:OctoPackPublishApiKey=API-ABCDEFGMYAPIKEY</code></li>
  </ul></li>
  </ol>
  
  <p>You may have to play around a bit, but essentially the above is taken from <a href="https://octopus.com/docs/packaging-applications/create-packages/octopack" rel="nofollow noreferrer">this article</a> so treat that as your bible.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-11-07T21:15:11.587Z
Answers: 2019-11-07T21:15:11.587Z
Answers: Richard Slater
Body: <p>I have a multi-project .NET solution that I'm trying to set-up with TeamCity (TC) for CI and Octopus Deploy (OD) for CD.</p>
  
  <p>I originally set-up TC to pull the latest from SVC, build the solution and deploy it as a .zip on the Dev server, but I've been having issues trying to deploy the solution to IIS with OP. I was informed that I should instead have TC take the solution and create multiple packages from it for OP to pick-up. I currently don't know how to do this.</p>
  
  <p>I have the following build steps:</p>
  
  <p><a href="https://i.sstatic.net/Ja3sQ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Ja3sQ.png" alt="Current build steps set in TC"></a></p>
  
  <p>And I have this in my General Settings Publish Artifact settings:</p>
  
  <p><a href="https://i.sstatic.net/NUdwy.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/NUdwy.png" alt="General Settings Publish Artifact settings"></a></p>
  
  <p>Visual Studio solution set-up (Blue shows the projects that make up the entire application we want to deploy. Green boxed will be the separate packages, BLL, Services and Repository because of project dependency get rolled up into the API project.):</p>
  
  <p><a href="https://i.sstatic.net/glWJv.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/glWJv.png" alt="Solution loaded in Visual Studio"></a></p>
  
  <p>I have manually deployed the solution in IIS, below is how it needs to deploy in IIS:</p>
  
  <p><a href="https://i.sstatic.net/wWkV8.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/wWkV8.png" alt="Manually deployed IIS setup"></a></p>
  
  <p>The root site is a .NET project using MVC that communicates, hubs is a Signal-R project and API has the repository project and services project under it. So essentially The root website is a client, it communicates can only see API and hubs and any communication to the repository project would go through the API project first, it's supposed to be using a service-orientated architecture.</p>
  
  <p>The goal is that TC should spit out 3 packages, one for the root website, one for the Signal-R project and one for the API which holds several projects but all projects are entirely in a single solution and this isn't something that I can get around for the time being. Once TC can do that I will need to set-up OD to deploy each of those packages to their required locations (which should hopefully be pretty simple).</p>
  
  <p>Any information/assistance with this is greatly appreciated as I do not have a Dev-Ops background and this is the first time I've had to set-up this kind of a project with TeamCity.</p>
  
  <p>Kind regards.</p>
  
Tags: <continuous-integration><continuous-deployment><cicd><teamcity><octopus-deploy>
Title: TeamCity - CI w/ Multi-project .NET solution using SOA build and delivery issues
UserDisplayName: HQ216493
ThreadText: # TeamCity - CI w/ Multi-project .NET solution using SOA build and delivery issues
  
  (Asked by: username_0 on 2019-11-07)
  
  I have a multi-project .NET solution that I'm trying to set-up with TeamCity (TC) for CI and Octopus Deploy (OD) for CD.
  
  I originally set-up TC to pull the latest from SVC, build the solution and deploy it as a .zip on the Dev server, but I've been having issues trying to deploy the solution to IIS with OP. I was informed that I should instead have TC take the solution and create multiple packages from it for OP to pick-up. I currently don't know how to do this.
  
  I have the following build steps:
  
  [![Current build steps set in TC](https://i.sstatic.net/Ja3sQ.png)](https://i.sstatic.net/Ja3sQ.png)
  
  And I have this in my General Settings Publish Artifact settings:
  
  [![General Settings Publish Artifact settings](https://i.sstatic.net/NUdwy.png)](https://i.sstatic.net/NUdwy.png)
  
  Visual Studio solution set-up (Blue shows the projects that make up the entire application we want to deploy. Green boxed will be the separate packages, BLL, Services and Repository because of project dependency get rolled up into the API project.):
  
  [![Solution loaded in Visual Studio](https://i.sstatic.net/glWJv.png)](https://i.sstatic.net/glWJv.png)
  
  I have manually deployed the solution in IIS, below is how it needs to deploy in IIS:
  
  [![Manually deployed IIS setup](https://i.sstatic.net/wWkV8.png)](https://i.sstatic.net/wWkV8.png)
  
  The root site is a .NET project using MVC that communicates, hubs is a Signal-R project and API has the repository project and services project under it. So essentially The root website is a client, it communicates can only see API and hubs and any communication to the repository project would go through the API project first, it's supposed to be using a service-orientated architecture.
  
  The goal is that TC should spit out 3 packages, one for the root website, one for the Signal-R project and one for the API which holds several projects but all projects are entirely in a single solution and this isn't something that I can get around for the time being. Once TC can do that I will need to set-up OD to deploy each of those packages to their required locations (which should hopefully be pretty simple).
  
  Any information/assistance with this is greatly appreciated as I do not have a Dev-Ops background and this is the first time I've had to set-up this kind of a project with TeamCity.
  
  Kind regards.
  
  **Tags:** continuous-integration, continuous-deployment, cicd, teamcity, octopus-deploy
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2019-11-12. Score: 0 | Accepted answer
  
  I managed to resolve this by installing the Nuget package Octopack on the projects that I wanted to be deployed as either separate websites or website applications.
  
  In this context, I installed Octopack to the 3 projects in green squares and checked-in the changes. Then on the Octopus Deploy side, I created 3 separate IIS deploy steps and just followed the typical steps. Octopus deploy now receives a NuGet package from TeamCity using the Octopus deploy plugin, Octopack build step, from there Octopus deploy has 3 IIS deploy steps, one for the main website and 2 for the website applications, each was given a custom directory path but after I had installed the Octopack NuGet packages into the appropriate projects in the solution through Visual Studio it was smooth sailing just using the general user-guide and tutorial videos.
  
  @username_1 username_1 - Thank-you for letting me know about Octopack, this was one of the key missing pieces that I needed.
  
  TLDR - If you want to deploy projects in a solution as separate websites, install the Octopus Deploy plugin to TeamCity and follow the basic tutorials, add the Octopack NuGet package to the projects you want as separate websites or web applications, set-up the Octopack step to push to Octopus Deploy over the API and use IIS steps in Octopus Deploy and you should be golden.
  
  
  ---
  
  ### Answer by username_1 on 2019-11-07. Score: 1
  
  So you need to create packages for each of the three sites so that you can deploy each one individually.
  
  The first step is to [create a `.nuspec`](https://octopus.com/docs/packaging-applications/create-packages/octopack) file for each of the IIS websites you want to package:
  
  1. Install OctoPack and [read the entire article](https://octopus.com/docs/packaging-applications/create-packages/octopack)
  2. Create three empty text files next to the `.csproj`, give it the same base filename as the `.csproj`, thus if it is `MyApp.API.csproj` you want to create an empty text file called `MyApp.API.nuspec`.
  3. In each of these `.nuspec` files paste in the following template:
  
     ```
     <?xml version="1.0"?>
     <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
     <metadata>
         <id>Sample.Web</id>
         <title>Your Web Application</title>
         <version>1.0.0</version>
         <authors>Your name</authors>
         <owners>Your name</owners>
         <licenseUrl>http://yourcompany.com</licenseUrl>
         <projectUrl>http://yourcompany.com</projectUrl>
         <requireLicenseAcceptance>false</requireLicenseAcceptance>
         <description>A sample project</description>
         <releaseNotes>This release contains the following changes...</releaseNotes>
     </metadata>
     </package>
  
     ```
  4. Customize the template for each of your projects.
  5. Update TeamCity to add `/p:RunOctoPack=true` to the `msbuild` command line
  6. Publish your packages with the following msbuild arguments:
     * `/p:OctoPackPublishPackageToHttp=http://your.octopusserver.com/nuget/packages`
     * `/p:OctoPackPublishApiKey=API-ABCDEFGMYAPIKEY`
  
  You may have to play around a bit, but essentially the above is taken from [this article](https://octopus.com/docs/packaging-applications/create-packages/octopack) so treat that as your bible.
  
  
  ---
  
  