I’m facing an issue while packing a Windows service with Octopack.
The App.config is renamed by msbuild to MyApp.exe.config at compile time, but its not included in the .nupkg.
Instead the App.config is included, important to notice is that the \bin\release folder does only contain the renamed MyApp.exe.config.
To me this looks like an timing issue in OctoPack where the packaging is done too soon.
Thanks for letting us know about this issue, it definitely should not be happening.
Could you please send us the full build log so we can determine the issue here and raise a bug.
I’ve included the build log for the Windows service project.
Maybe the issue is in here:
The config file of the windows service is linked from another project called ApplicationLogic
@@@
App.config
@@@
Please take a look at line 49 of the log:
The App.config is copied and renamed correctly.
@@@
Copying file from “…\Company-App.Hosted.Api.Workflow.ApplicationLogic\App.config” to “bin\Debug\Company-App.Hosted.Api.Workflow.exe.config”.
@@@
OctoPack takes the App.config instead of the Company-App.Hosted.Api.Workflow.exe.config:
@@@
OctoPack: Packaging a console or Window Service application
OctoPack: Add binary files
OctoPack: Added file: App.config
OctoPack: Added file: Company-App.Hosted.Api.Workflow.exe
@@@
We have a related issue using OctoPack attempting to package an Application with one or more environment configurations e.g. ‘App.Staging.config’.
Our goal is to be able to keep our environment configs for Application projects named as ‘App.*.config’ and have them automatically renamed to the correct output config filename during build.
We have a custom build target that copies and renames our ‘environment’ config files to output path as ‘MyApp.exe.*.config’ to suit the special instructions for transforming ‘App’ configs at the bottom of this article: http://docs.octopusdeploy.com/display/OD/Configuration+files
We also set all our ‘environment’ configs to Build Action ‘Content’ to indicate that they’re copied to the output folder when built and (presumably) this would mean they should be included in the OctoPack deployment package that’s created too. At least, this approach works for ‘Web’ projects.
However, for Applications, when we run OctoPack, the transformed ‘MyApp.exe.Staging.config’ files are not included in the package.
The article also notes that we should set the ‘Copy to Output Directory’ property to ensure it’s copied, however this merely copies the originally named ‘App.Staging.config’ to the output folder, which Octopus Deploy won’t transform.
Is there a reason why OctoPack is ignoring our transformed config files? Our transforms are the first targets to run, and everything else in the OutputPath folder seems to get included just fine.
In old versions of OctoPack we used to just package up everything in the output path. This turned out to cause a lot of problems - some build servers use the same output path for all projects, for example, so we end up packaging a lot of files we aren’t supposed to. Instead, we use a property that MSBuild provides called @(FileWrites), which tells us the files that were output during the project build. I’m not sure how you are renaming your App.*.config files during the build, but if you can change the process so that the written files are appended to @(FileWrites), then OctoPack should pick them up.
Hi all, I’m stuck here and wondering if someone could share some more details/code snippet? I can’t seem to figure out how to append the files to the msbuild property.
From: Larry Asakura
Sent: Monday, November 3, 2014 9:34 AM
To: ‘Henrik Andersson’
Subject: RE: Linked App.config is renamed to MyApp.exe.config but not included in Octopack package [Problems #21023]