Question

I have a website, a windows service, and some shared class libraries in a single Visual Studio solution. I use Octopack on both the website and windows service, and on my machine these builds work as expected.

When using the TFS Build Server, the website nuget package is generated as expected, but the windows service nuget package contains all files from the website, as well as the service. E.g. it includes the _PublishedWebsites folder as well.

This is because TFS uses a single location to build projects.

What is the best way around this?

Was it helpful?

Solution 2

I ended up using this nuget package to ensure the console app built to a seperate directory on the TFS server.

https://nuget.org/packages/PublishedApplications/2.1.0.0

I then had to specify in the nuspec file, which files should be included for the console app. e.g

This works and I can now deploy using Octopus deploy.

The downside of this apporach is that the PublishedApplications build only works on the TFS build server, so I can't build the project locally in release mode. Still looking on how to overcome this.

OTHER TIPS

I know this question has since been closed, but I cam across this issue and solved it in a different way.

My solution is compromised of a number of websites and windows services and had the same issue of the OctoPack created nuget packages including all the solution assemblies from the 'pooled' output folder when building with Team Build. The reason the nuget packages get all the assemblies is OctoPack uses the outdir msbuild argument as the location to include assemblies from.

The way I got around it was to use the msbuild argument GenerateProjectSpecificOutputFolder=true. This instructs Team build to create a folder for each project in your output folder in the same way Visual Studio uses the bin folders under each project when building locally.

My build definition msbuild arguments looks like: /p:GenerateProjectSpecificOutputFolder=true;RunOctoPack=true;OctoPackPublishPackageToFileShare=\\<NugetServer>

I currently just push the packages onto a shared folder but the OctoPackPublishPackageToHttp and OctoPackPublishApiKey parameters can also be used.

The benefit of this solution over the one above is you don't need to specify the files to include the nuget package.

Hope this helps someone.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top