OctoPack loses App_Data directory

marchenko.alexandr's Avatar

marchenko.alexandr

06 Mar, 2018 11:17 AM

Hello, we have noticed one strange behaviour, when running octopack we do not see App_Data directory in generated nuget package. The directory itself is in repository, and has .gitkeep. Just wondering is it some kind of configuration option or something for this?

We are using TeamCity to build solution and just checked "Run OctoPack" checkbox, no nuspec files, everything is default

Thank you in advice

  1. 1 Posted by marchenko.alexa... on 06 Mar, 2018 01:40 PM

    marchenko.alexandr's Avatar

    strange fact in build log I do see following: OctoPack: Added file: "App_Data.gitkeep" but not seeing it in nupkg file

  2. 2 Posted by marchenko.alexa... on 06 Mar, 2018 02:12 PM

    marchenko.alexandr's Avatar

    one more fact: after running nuget pack foo.nuspec which is generated by octopack from csproj I also do see App_data folder

  3. Support Staff 3 Posted by Shannon Lewis on 07 Mar, 2018 10:30 AM

    Shannon Lewis's Avatar

    Hi Marchenko,

    Thanks for getting in touch. I've done some testing and this seems to be a limitation of NuGet.exe, which OctoPack uses to actually do the packaging. It ignores any files that do not have a filename (.gitkeep only has an extension, no actual filename). I have also verified this using NuGet.exe outside of OctoPack and it behaves the same way.

    Interestingly it doesn't seem to be an inherent issue with NuPkg, because I tested using Octo.exe to create a package with a .gitkeep file and it worked correctly.

    So the best option I can think of may be along the lines of what we recommend for .NET Core applications, where you get the build to publish to a folder and then use Octo.exe from there to do the pack.

    Sorry I don't have better news but hope that helps.

    Regards
    Shannon

  4. 4 Posted by marchenko.alexa... on 08 Mar, 2018 10:46 AM

    marchenko.alexandr's Avatar

    Hi Shannon, thank you for your suggestion. It seems that we have found a solution.

    For anyone else who will be fighting with same issue here is what you need to do:

    Ensure that you have something like this in your csproj:

    <ItemGroup>
      <Folder Include="App_Data\"/>
      <Content Include="App_Data\readme.txt" />
    </ItemGroup>
    

    Ensure that you have something like this in your .gitignore:

    **/App_Data/*
    !**/App_Data/readme.txt
    

    After that you will see your App_Data in generated nuget package - profit

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac