Include build directory in nuget package using visual studio pack










0















I'm attempting to create a nupkg with Visual Studio using the built in nuget package building and include the build directory from my project in the nupkg. It seems like it should be a fairly simple task but I can't get it to work. From my googling adding either of these to my csproj file should work, but both create an empty 'build' directory in the nupkg:



 <ItemGroup>
<None Include="build**">
<Pack>true</Pack>
<PackagePath>build</PackagePath>
<IncludeInPackage>true</IncludeInPackage>
</None>
</ItemGroup>


Using nuget pack to create the package with the following in my nuspec does work:



 <files>
<!-- Include everything in build -->
<file src="build**" target="build" />
</files>









share|improve this question




























    0















    I'm attempting to create a nupkg with Visual Studio using the built in nuget package building and include the build directory from my project in the nupkg. It seems like it should be a fairly simple task but I can't get it to work. From my googling adding either of these to my csproj file should work, but both create an empty 'build' directory in the nupkg:



     <ItemGroup>
    <None Include="build**">
    <Pack>true</Pack>
    <PackagePath>build</PackagePath>
    <IncludeInPackage>true</IncludeInPackage>
    </None>
    </ItemGroup>


    Using nuget pack to create the package with the following in my nuspec does work:



     <files>
    <!-- Include everything in build -->
    <file src="build**" target="build" />
    </files>









    share|improve this question


























      0












      0








      0








      I'm attempting to create a nupkg with Visual Studio using the built in nuget package building and include the build directory from my project in the nupkg. It seems like it should be a fairly simple task but I can't get it to work. From my googling adding either of these to my csproj file should work, but both create an empty 'build' directory in the nupkg:



       <ItemGroup>
      <None Include="build**">
      <Pack>true</Pack>
      <PackagePath>build</PackagePath>
      <IncludeInPackage>true</IncludeInPackage>
      </None>
      </ItemGroup>


      Using nuget pack to create the package with the following in my nuspec does work:



       <files>
      <!-- Include everything in build -->
      <file src="build**" target="build" />
      </files>









      share|improve this question
















      I'm attempting to create a nupkg with Visual Studio using the built in nuget package building and include the build directory from my project in the nupkg. It seems like it should be a fairly simple task but I can't get it to work. From my googling adding either of these to my csproj file should work, but both create an empty 'build' directory in the nupkg:



       <ItemGroup>
      <None Include="build**">
      <Pack>true</Pack>
      <PackagePath>build</PackagePath>
      <IncludeInPackage>true</IncludeInPackage>
      </None>
      </ItemGroup>


      Using nuget pack to create the package with the following in my nuspec does work:



       <files>
      <!-- Include everything in build -->
      <file src="build**" target="build" />
      </files>






      visual-studio msbuild nuget






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 13 '18 at 16:42







      Nick

















      asked Nov 13 '18 at 13:12









      NickNick

      1,47021633




      1,47021633






















          2 Answers
          2






          active

          oldest

          votes


















          0















          Include build directory in nuget package using visual studio pack




          According to the document Including content in a package, you should use the properties <Pack>true</Pack> and <PackagePath>build</PackagePath>:




          If you want to copy all your content to only a specific root folder(s) (instead of content and contentFiles both), you can use the MSBuild property ContentTargetFolders, which defaults to "content;contentFiles" but can be set to any other folder names.



          PackagePath can be a semicolon-delimited set of target paths.
          Specifying an empty package path would add the file to the root of the
          package.




          So, you can change your ItemGroup like following:



           <ItemGroup>
          <None Include="build**" Pack="True" PackagePath="build" />
          </ItemGroup>


          Update:




          I believe this is the same as what I added but in a different XML
          structure and without the Pack attribute




          The Pack attribute is the key point. It works fine with your XML structure and the Pack attribute. You should make sure you have the files in the build folder in your project folder:



          enter image description here



          Check my test demo below:



          enter image description here



          Update2:



          Ah! You are using the .net framework project!! That the reason for this issue. This method is used for .net standard and .net core project by default and it not work for .net framework. To resolve this issue you have to use the .nupsec file, like you post in the question.



          If you still want to include build directory in nuget package using visual studio pack, you need change your project type to SDK type:



          Check this document for some more details.



          Then you can use the method, which we talked about before.



          Hope this helps.






          share|improve this answer

























          • I believe this is the same as what I added but in a different XML structure and without the Pack attribute which I also tried (so have now added to the question). Regardless, both have the same result – an empty build directory in the nupkg.

            – Nick
            Nov 13 '18 at 16:40












          • @Nick, Check my Update answer. If there is anything different from you, please point it out for free, I will keep follow.

            – Leo Liu-MSFT
            Nov 14 '18 at 2:07











          • I copied your xml but it still created an empty build folder. I’m using visual studio for Mac, will try windows later but I don’t think it is working either. The files are in the build directory. The nuspec file include does work.

            – Nick
            Nov 14 '18 at 7:47











          • @Nick, As you can see, it works fine on my side. But I don't currently have a VS for MAC environment, so I could not verify this for you, you can test it on the windows, and if it not work, please share a simple sample project via onedirve, I will check it.

            – Leo Liu-MSFT
            Nov 14 '18 at 7:56











          • 1drv.ms/u/s!Ag80d1rkUxp_hWoKTKNsdL26Oj4o

            – Nick
            Nov 14 '18 at 9:08


















          0














          The solution to this issue was to upgrade the project to SDK type (Xamarin binding projects by default use the old format but seem to work with the new type) and then use:



          <ItemGroup>
          <None Update="build**">
          <IncludeInPackage>true</IncludeInPackage>
          </None>
          </ItemGroup>


          To include the build directory. The alternative is using nuget pack.



          When converting the project make sure to leave in the Xamarin import:



          <Import Project="$(MSBuildExtensionsPath)XamariniOSXamarin.iOS.ObjCBinding.CSharp.targets" />


          Here's how my project file looks afterwards:



          <?xml version="1.0" encoding="utf-8"?>
          <Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
          <PropertyGroup>
          <PackageId></PackageId>
          <PackageVersion>3.3.2</PackageVersion>
          <ReleaseVersion>$(PackageVersion)</ReleaseVersion>
          <AssemblyVersion>$(PackageVersion)</AssemblyVersion>
          <Authors>Nick Brook</Authors>
          <Description></Description>
          <Copyright></Copyright>
          <PackageProjectUrl></PackageProjectUrl>
          <Summary></Summary>
          <PackageTags></PackageTags>
          <Title></Title>
          <PackageReleaseNotes>Initial Release</PackageReleaseNotes>
          <OutputType>Library</OutputType>
          <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
          <OutputPath>bin$(Configuration)</OutputPath>
          <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
          </PropertyGroup>
          <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
          </PropertyGroup>
          <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
          <Optimize>true</Optimize>
          <PackageOutputPath>packed</PackageOutputPath>
          <PackOnBuild>true</PackOnBuild>
          </PropertyGroup>
          <ItemGroup>
          <Reference Include="System" />
          <Reference Include="Xamarin.iOS" />
          </ItemGroup>
          <ItemGroup>
          <ObjcBindingApiDefinition Include="ApiDefinition.cs" />
          </ItemGroup>
          <ItemGroup>
          <ObjcBindingCoreSource Include="Structs.cs" />
          </ItemGroup>
          <ItemGroup>
          <Compile Remove="Structs.cs" Condition=" '$(EnableDefaultCompileItems)' == 'true' " />
          <Compile Remove="ApiDefinition.cs" Condition=" '$(EnableDefaultCompileItems)' == 'true' " />
          </ItemGroup>
          <ItemGroup>
          <None Remove="packed**" />
          </ItemGroup>
          <ItemGroup>
          <PackageReference Include="Xamarin.Build.Download" Version="0.4.11" />
          <PackageReference Include="NuGet.Build.Packaging" Version="0.2.2" />
          </ItemGroup>
          <ItemGroup>
          <None Update="build**">
          <IncludeInPackage>true</IncludeInPackage>
          </None>
          </ItemGroup>
          <Import Project="$(MSBuildExtensionsPath)XamariniOSXamarin.iOS.ObjCBinding.CSharp.targets" />
          </Project>





          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53281775%2finclude-build-directory-in-nuget-package-using-visual-studio-pack%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0















            Include build directory in nuget package using visual studio pack




            According to the document Including content in a package, you should use the properties <Pack>true</Pack> and <PackagePath>build</PackagePath>:




            If you want to copy all your content to only a specific root folder(s) (instead of content and contentFiles both), you can use the MSBuild property ContentTargetFolders, which defaults to "content;contentFiles" but can be set to any other folder names.



            PackagePath can be a semicolon-delimited set of target paths.
            Specifying an empty package path would add the file to the root of the
            package.




            So, you can change your ItemGroup like following:



             <ItemGroup>
            <None Include="build**" Pack="True" PackagePath="build" />
            </ItemGroup>


            Update:




            I believe this is the same as what I added but in a different XML
            structure and without the Pack attribute




            The Pack attribute is the key point. It works fine with your XML structure and the Pack attribute. You should make sure you have the files in the build folder in your project folder:



            enter image description here



            Check my test demo below:



            enter image description here



            Update2:



            Ah! You are using the .net framework project!! That the reason for this issue. This method is used for .net standard and .net core project by default and it not work for .net framework. To resolve this issue you have to use the .nupsec file, like you post in the question.



            If you still want to include build directory in nuget package using visual studio pack, you need change your project type to SDK type:



            Check this document for some more details.



            Then you can use the method, which we talked about before.



            Hope this helps.






            share|improve this answer

























            • I believe this is the same as what I added but in a different XML structure and without the Pack attribute which I also tried (so have now added to the question). Regardless, both have the same result – an empty build directory in the nupkg.

              – Nick
              Nov 13 '18 at 16:40












            • @Nick, Check my Update answer. If there is anything different from you, please point it out for free, I will keep follow.

              – Leo Liu-MSFT
              Nov 14 '18 at 2:07











            • I copied your xml but it still created an empty build folder. I’m using visual studio for Mac, will try windows later but I don’t think it is working either. The files are in the build directory. The nuspec file include does work.

              – Nick
              Nov 14 '18 at 7:47











            • @Nick, As you can see, it works fine on my side. But I don't currently have a VS for MAC environment, so I could not verify this for you, you can test it on the windows, and if it not work, please share a simple sample project via onedirve, I will check it.

              – Leo Liu-MSFT
              Nov 14 '18 at 7:56











            • 1drv.ms/u/s!Ag80d1rkUxp_hWoKTKNsdL26Oj4o

              – Nick
              Nov 14 '18 at 9:08















            0















            Include build directory in nuget package using visual studio pack




            According to the document Including content in a package, you should use the properties <Pack>true</Pack> and <PackagePath>build</PackagePath>:




            If you want to copy all your content to only a specific root folder(s) (instead of content and contentFiles both), you can use the MSBuild property ContentTargetFolders, which defaults to "content;contentFiles" but can be set to any other folder names.



            PackagePath can be a semicolon-delimited set of target paths.
            Specifying an empty package path would add the file to the root of the
            package.




            So, you can change your ItemGroup like following:



             <ItemGroup>
            <None Include="build**" Pack="True" PackagePath="build" />
            </ItemGroup>


            Update:




            I believe this is the same as what I added but in a different XML
            structure and without the Pack attribute




            The Pack attribute is the key point. It works fine with your XML structure and the Pack attribute. You should make sure you have the files in the build folder in your project folder:



            enter image description here



            Check my test demo below:



            enter image description here



            Update2:



            Ah! You are using the .net framework project!! That the reason for this issue. This method is used for .net standard and .net core project by default and it not work for .net framework. To resolve this issue you have to use the .nupsec file, like you post in the question.



            If you still want to include build directory in nuget package using visual studio pack, you need change your project type to SDK type:



            Check this document for some more details.



            Then you can use the method, which we talked about before.



            Hope this helps.






            share|improve this answer

























            • I believe this is the same as what I added but in a different XML structure and without the Pack attribute which I also tried (so have now added to the question). Regardless, both have the same result – an empty build directory in the nupkg.

              – Nick
              Nov 13 '18 at 16:40












            • @Nick, Check my Update answer. If there is anything different from you, please point it out for free, I will keep follow.

              – Leo Liu-MSFT
              Nov 14 '18 at 2:07











            • I copied your xml but it still created an empty build folder. I’m using visual studio for Mac, will try windows later but I don’t think it is working either. The files are in the build directory. The nuspec file include does work.

              – Nick
              Nov 14 '18 at 7:47











            • @Nick, As you can see, it works fine on my side. But I don't currently have a VS for MAC environment, so I could not verify this for you, you can test it on the windows, and if it not work, please share a simple sample project via onedirve, I will check it.

              – Leo Liu-MSFT
              Nov 14 '18 at 7:56











            • 1drv.ms/u/s!Ag80d1rkUxp_hWoKTKNsdL26Oj4o

              – Nick
              Nov 14 '18 at 9:08













            0












            0








            0








            Include build directory in nuget package using visual studio pack




            According to the document Including content in a package, you should use the properties <Pack>true</Pack> and <PackagePath>build</PackagePath>:




            If you want to copy all your content to only a specific root folder(s) (instead of content and contentFiles both), you can use the MSBuild property ContentTargetFolders, which defaults to "content;contentFiles" but can be set to any other folder names.



            PackagePath can be a semicolon-delimited set of target paths.
            Specifying an empty package path would add the file to the root of the
            package.




            So, you can change your ItemGroup like following:



             <ItemGroup>
            <None Include="build**" Pack="True" PackagePath="build" />
            </ItemGroup>


            Update:




            I believe this is the same as what I added but in a different XML
            structure and without the Pack attribute




            The Pack attribute is the key point. It works fine with your XML structure and the Pack attribute. You should make sure you have the files in the build folder in your project folder:



            enter image description here



            Check my test demo below:



            enter image description here



            Update2:



            Ah! You are using the .net framework project!! That the reason for this issue. This method is used for .net standard and .net core project by default and it not work for .net framework. To resolve this issue you have to use the .nupsec file, like you post in the question.



            If you still want to include build directory in nuget package using visual studio pack, you need change your project type to SDK type:



            Check this document for some more details.



            Then you can use the method, which we talked about before.



            Hope this helps.






            share|improve this answer
















            Include build directory in nuget package using visual studio pack




            According to the document Including content in a package, you should use the properties <Pack>true</Pack> and <PackagePath>build</PackagePath>:




            If you want to copy all your content to only a specific root folder(s) (instead of content and contentFiles both), you can use the MSBuild property ContentTargetFolders, which defaults to "content;contentFiles" but can be set to any other folder names.



            PackagePath can be a semicolon-delimited set of target paths.
            Specifying an empty package path would add the file to the root of the
            package.




            So, you can change your ItemGroup like following:



             <ItemGroup>
            <None Include="build**" Pack="True" PackagePath="build" />
            </ItemGroup>


            Update:




            I believe this is the same as what I added but in a different XML
            structure and without the Pack attribute




            The Pack attribute is the key point. It works fine with your XML structure and the Pack attribute. You should make sure you have the files in the build folder in your project folder:



            enter image description here



            Check my test demo below:



            enter image description here



            Update2:



            Ah! You are using the .net framework project!! That the reason for this issue. This method is used for .net standard and .net core project by default and it not work for .net framework. To resolve this issue you have to use the .nupsec file, like you post in the question.



            If you still want to include build directory in nuget package using visual studio pack, you need change your project type to SDK type:



            Check this document for some more details.



            Then you can use the method, which we talked about before.



            Hope this helps.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 14 '18 at 9:32

























            answered Nov 13 '18 at 16:37









            Leo Liu-MSFTLeo Liu-MSFT

            18.4k21932




            18.4k21932












            • I believe this is the same as what I added but in a different XML structure and without the Pack attribute which I also tried (so have now added to the question). Regardless, both have the same result – an empty build directory in the nupkg.

              – Nick
              Nov 13 '18 at 16:40












            • @Nick, Check my Update answer. If there is anything different from you, please point it out for free, I will keep follow.

              – Leo Liu-MSFT
              Nov 14 '18 at 2:07











            • I copied your xml but it still created an empty build folder. I’m using visual studio for Mac, will try windows later but I don’t think it is working either. The files are in the build directory. The nuspec file include does work.

              – Nick
              Nov 14 '18 at 7:47











            • @Nick, As you can see, it works fine on my side. But I don't currently have a VS for MAC environment, so I could not verify this for you, you can test it on the windows, and if it not work, please share a simple sample project via onedirve, I will check it.

              – Leo Liu-MSFT
              Nov 14 '18 at 7:56











            • 1drv.ms/u/s!Ag80d1rkUxp_hWoKTKNsdL26Oj4o

              – Nick
              Nov 14 '18 at 9:08

















            • I believe this is the same as what I added but in a different XML structure and without the Pack attribute which I also tried (so have now added to the question). Regardless, both have the same result – an empty build directory in the nupkg.

              – Nick
              Nov 13 '18 at 16:40












            • @Nick, Check my Update answer. If there is anything different from you, please point it out for free, I will keep follow.

              – Leo Liu-MSFT
              Nov 14 '18 at 2:07











            • I copied your xml but it still created an empty build folder. I’m using visual studio for Mac, will try windows later but I don’t think it is working either. The files are in the build directory. The nuspec file include does work.

              – Nick
              Nov 14 '18 at 7:47











            • @Nick, As you can see, it works fine on my side. But I don't currently have a VS for MAC environment, so I could not verify this for you, you can test it on the windows, and if it not work, please share a simple sample project via onedirve, I will check it.

              – Leo Liu-MSFT
              Nov 14 '18 at 7:56











            • 1drv.ms/u/s!Ag80d1rkUxp_hWoKTKNsdL26Oj4o

              – Nick
              Nov 14 '18 at 9:08
















            I believe this is the same as what I added but in a different XML structure and without the Pack attribute which I also tried (so have now added to the question). Regardless, both have the same result – an empty build directory in the nupkg.

            – Nick
            Nov 13 '18 at 16:40






            I believe this is the same as what I added but in a different XML structure and without the Pack attribute which I also tried (so have now added to the question). Regardless, both have the same result – an empty build directory in the nupkg.

            – Nick
            Nov 13 '18 at 16:40














            @Nick, Check my Update answer. If there is anything different from you, please point it out for free, I will keep follow.

            – Leo Liu-MSFT
            Nov 14 '18 at 2:07





            @Nick, Check my Update answer. If there is anything different from you, please point it out for free, I will keep follow.

            – Leo Liu-MSFT
            Nov 14 '18 at 2:07













            I copied your xml but it still created an empty build folder. I’m using visual studio for Mac, will try windows later but I don’t think it is working either. The files are in the build directory. The nuspec file include does work.

            – Nick
            Nov 14 '18 at 7:47





            I copied your xml but it still created an empty build folder. I’m using visual studio for Mac, will try windows later but I don’t think it is working either. The files are in the build directory. The nuspec file include does work.

            – Nick
            Nov 14 '18 at 7:47













            @Nick, As you can see, it works fine on my side. But I don't currently have a VS for MAC environment, so I could not verify this for you, you can test it on the windows, and if it not work, please share a simple sample project via onedirve, I will check it.

            – Leo Liu-MSFT
            Nov 14 '18 at 7:56





            @Nick, As you can see, it works fine on my side. But I don't currently have a VS for MAC environment, so I could not verify this for you, you can test it on the windows, and if it not work, please share a simple sample project via onedirve, I will check it.

            – Leo Liu-MSFT
            Nov 14 '18 at 7:56













            1drv.ms/u/s!Ag80d1rkUxp_hWoKTKNsdL26Oj4o

            – Nick
            Nov 14 '18 at 9:08





            1drv.ms/u/s!Ag80d1rkUxp_hWoKTKNsdL26Oj4o

            – Nick
            Nov 14 '18 at 9:08













            0














            The solution to this issue was to upgrade the project to SDK type (Xamarin binding projects by default use the old format but seem to work with the new type) and then use:



            <ItemGroup>
            <None Update="build**">
            <IncludeInPackage>true</IncludeInPackage>
            </None>
            </ItemGroup>


            To include the build directory. The alternative is using nuget pack.



            When converting the project make sure to leave in the Xamarin import:



            <Import Project="$(MSBuildExtensionsPath)XamariniOSXamarin.iOS.ObjCBinding.CSharp.targets" />


            Here's how my project file looks afterwards:



            <?xml version="1.0" encoding="utf-8"?>
            <Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
            <PropertyGroup>
            <PackageId></PackageId>
            <PackageVersion>3.3.2</PackageVersion>
            <ReleaseVersion>$(PackageVersion)</ReleaseVersion>
            <AssemblyVersion>$(PackageVersion)</AssemblyVersion>
            <Authors>Nick Brook</Authors>
            <Description></Description>
            <Copyright></Copyright>
            <PackageProjectUrl></PackageProjectUrl>
            <Summary></Summary>
            <PackageTags></PackageTags>
            <Title></Title>
            <PackageReleaseNotes>Initial Release</PackageReleaseNotes>
            <OutputType>Library</OutputType>
            <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
            <OutputPath>bin$(Configuration)</OutputPath>
            <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
            </PropertyGroup>
            <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
            </PropertyGroup>
            <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
            <Optimize>true</Optimize>
            <PackageOutputPath>packed</PackageOutputPath>
            <PackOnBuild>true</PackOnBuild>
            </PropertyGroup>
            <ItemGroup>
            <Reference Include="System" />
            <Reference Include="Xamarin.iOS" />
            </ItemGroup>
            <ItemGroup>
            <ObjcBindingApiDefinition Include="ApiDefinition.cs" />
            </ItemGroup>
            <ItemGroup>
            <ObjcBindingCoreSource Include="Structs.cs" />
            </ItemGroup>
            <ItemGroup>
            <Compile Remove="Structs.cs" Condition=" '$(EnableDefaultCompileItems)' == 'true' " />
            <Compile Remove="ApiDefinition.cs" Condition=" '$(EnableDefaultCompileItems)' == 'true' " />
            </ItemGroup>
            <ItemGroup>
            <None Remove="packed**" />
            </ItemGroup>
            <ItemGroup>
            <PackageReference Include="Xamarin.Build.Download" Version="0.4.11" />
            <PackageReference Include="NuGet.Build.Packaging" Version="0.2.2" />
            </ItemGroup>
            <ItemGroup>
            <None Update="build**">
            <IncludeInPackage>true</IncludeInPackage>
            </None>
            </ItemGroup>
            <Import Project="$(MSBuildExtensionsPath)XamariniOSXamarin.iOS.ObjCBinding.CSharp.targets" />
            </Project>





            share|improve this answer



























              0














              The solution to this issue was to upgrade the project to SDK type (Xamarin binding projects by default use the old format but seem to work with the new type) and then use:



              <ItemGroup>
              <None Update="build**">
              <IncludeInPackage>true</IncludeInPackage>
              </None>
              </ItemGroup>


              To include the build directory. The alternative is using nuget pack.



              When converting the project make sure to leave in the Xamarin import:



              <Import Project="$(MSBuildExtensionsPath)XamariniOSXamarin.iOS.ObjCBinding.CSharp.targets" />


              Here's how my project file looks afterwards:



              <?xml version="1.0" encoding="utf-8"?>
              <Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
              <PropertyGroup>
              <PackageId></PackageId>
              <PackageVersion>3.3.2</PackageVersion>
              <ReleaseVersion>$(PackageVersion)</ReleaseVersion>
              <AssemblyVersion>$(PackageVersion)</AssemblyVersion>
              <Authors>Nick Brook</Authors>
              <Description></Description>
              <Copyright></Copyright>
              <PackageProjectUrl></PackageProjectUrl>
              <Summary></Summary>
              <PackageTags></PackageTags>
              <Title></Title>
              <PackageReleaseNotes>Initial Release</PackageReleaseNotes>
              <OutputType>Library</OutputType>
              <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
              <OutputPath>bin$(Configuration)</OutputPath>
              <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
              </PropertyGroup>
              <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
              </PropertyGroup>
              <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
              <Optimize>true</Optimize>
              <PackageOutputPath>packed</PackageOutputPath>
              <PackOnBuild>true</PackOnBuild>
              </PropertyGroup>
              <ItemGroup>
              <Reference Include="System" />
              <Reference Include="Xamarin.iOS" />
              </ItemGroup>
              <ItemGroup>
              <ObjcBindingApiDefinition Include="ApiDefinition.cs" />
              </ItemGroup>
              <ItemGroup>
              <ObjcBindingCoreSource Include="Structs.cs" />
              </ItemGroup>
              <ItemGroup>
              <Compile Remove="Structs.cs" Condition=" '$(EnableDefaultCompileItems)' == 'true' " />
              <Compile Remove="ApiDefinition.cs" Condition=" '$(EnableDefaultCompileItems)' == 'true' " />
              </ItemGroup>
              <ItemGroup>
              <None Remove="packed**" />
              </ItemGroup>
              <ItemGroup>
              <PackageReference Include="Xamarin.Build.Download" Version="0.4.11" />
              <PackageReference Include="NuGet.Build.Packaging" Version="0.2.2" />
              </ItemGroup>
              <ItemGroup>
              <None Update="build**">
              <IncludeInPackage>true</IncludeInPackage>
              </None>
              </ItemGroup>
              <Import Project="$(MSBuildExtensionsPath)XamariniOSXamarin.iOS.ObjCBinding.CSharp.targets" />
              </Project>





              share|improve this answer

























                0












                0








                0







                The solution to this issue was to upgrade the project to SDK type (Xamarin binding projects by default use the old format but seem to work with the new type) and then use:



                <ItemGroup>
                <None Update="build**">
                <IncludeInPackage>true</IncludeInPackage>
                </None>
                </ItemGroup>


                To include the build directory. The alternative is using nuget pack.



                When converting the project make sure to leave in the Xamarin import:



                <Import Project="$(MSBuildExtensionsPath)XamariniOSXamarin.iOS.ObjCBinding.CSharp.targets" />


                Here's how my project file looks afterwards:



                <?xml version="1.0" encoding="utf-8"?>
                <Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
                <PropertyGroup>
                <PackageId></PackageId>
                <PackageVersion>3.3.2</PackageVersion>
                <ReleaseVersion>$(PackageVersion)</ReleaseVersion>
                <AssemblyVersion>$(PackageVersion)</AssemblyVersion>
                <Authors>Nick Brook</Authors>
                <Description></Description>
                <Copyright></Copyright>
                <PackageProjectUrl></PackageProjectUrl>
                <Summary></Summary>
                <PackageTags></PackageTags>
                <Title></Title>
                <PackageReleaseNotes>Initial Release</PackageReleaseNotes>
                <OutputType>Library</OutputType>
                <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
                <OutputPath>bin$(Configuration)</OutputPath>
                <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
                </PropertyGroup>
                <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
                </PropertyGroup>
                <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
                <Optimize>true</Optimize>
                <PackageOutputPath>packed</PackageOutputPath>
                <PackOnBuild>true</PackOnBuild>
                </PropertyGroup>
                <ItemGroup>
                <Reference Include="System" />
                <Reference Include="Xamarin.iOS" />
                </ItemGroup>
                <ItemGroup>
                <ObjcBindingApiDefinition Include="ApiDefinition.cs" />
                </ItemGroup>
                <ItemGroup>
                <ObjcBindingCoreSource Include="Structs.cs" />
                </ItemGroup>
                <ItemGroup>
                <Compile Remove="Structs.cs" Condition=" '$(EnableDefaultCompileItems)' == 'true' " />
                <Compile Remove="ApiDefinition.cs" Condition=" '$(EnableDefaultCompileItems)' == 'true' " />
                </ItemGroup>
                <ItemGroup>
                <None Remove="packed**" />
                </ItemGroup>
                <ItemGroup>
                <PackageReference Include="Xamarin.Build.Download" Version="0.4.11" />
                <PackageReference Include="NuGet.Build.Packaging" Version="0.2.2" />
                </ItemGroup>
                <ItemGroup>
                <None Update="build**">
                <IncludeInPackage>true</IncludeInPackage>
                </None>
                </ItemGroup>
                <Import Project="$(MSBuildExtensionsPath)XamariniOSXamarin.iOS.ObjCBinding.CSharp.targets" />
                </Project>





                share|improve this answer













                The solution to this issue was to upgrade the project to SDK type (Xamarin binding projects by default use the old format but seem to work with the new type) and then use:



                <ItemGroup>
                <None Update="build**">
                <IncludeInPackage>true</IncludeInPackage>
                </None>
                </ItemGroup>


                To include the build directory. The alternative is using nuget pack.



                When converting the project make sure to leave in the Xamarin import:



                <Import Project="$(MSBuildExtensionsPath)XamariniOSXamarin.iOS.ObjCBinding.CSharp.targets" />


                Here's how my project file looks afterwards:



                <?xml version="1.0" encoding="utf-8"?>
                <Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
                <PropertyGroup>
                <PackageId></PackageId>
                <PackageVersion>3.3.2</PackageVersion>
                <ReleaseVersion>$(PackageVersion)</ReleaseVersion>
                <AssemblyVersion>$(PackageVersion)</AssemblyVersion>
                <Authors>Nick Brook</Authors>
                <Description></Description>
                <Copyright></Copyright>
                <PackageProjectUrl></PackageProjectUrl>
                <Summary></Summary>
                <PackageTags></PackageTags>
                <Title></Title>
                <PackageReleaseNotes>Initial Release</PackageReleaseNotes>
                <OutputType>Library</OutputType>
                <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
                <OutputPath>bin$(Configuration)</OutputPath>
                <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
                </PropertyGroup>
                <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
                </PropertyGroup>
                <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
                <Optimize>true</Optimize>
                <PackageOutputPath>packed</PackageOutputPath>
                <PackOnBuild>true</PackOnBuild>
                </PropertyGroup>
                <ItemGroup>
                <Reference Include="System" />
                <Reference Include="Xamarin.iOS" />
                </ItemGroup>
                <ItemGroup>
                <ObjcBindingApiDefinition Include="ApiDefinition.cs" />
                </ItemGroup>
                <ItemGroup>
                <ObjcBindingCoreSource Include="Structs.cs" />
                </ItemGroup>
                <ItemGroup>
                <Compile Remove="Structs.cs" Condition=" '$(EnableDefaultCompileItems)' == 'true' " />
                <Compile Remove="ApiDefinition.cs" Condition=" '$(EnableDefaultCompileItems)' == 'true' " />
                </ItemGroup>
                <ItemGroup>
                <None Remove="packed**" />
                </ItemGroup>
                <ItemGroup>
                <PackageReference Include="Xamarin.Build.Download" Version="0.4.11" />
                <PackageReference Include="NuGet.Build.Packaging" Version="0.2.2" />
                </ItemGroup>
                <ItemGroup>
                <None Update="build**">
                <IncludeInPackage>true</IncludeInPackage>
                </None>
                </ItemGroup>
                <Import Project="$(MSBuildExtensionsPath)XamariniOSXamarin.iOS.ObjCBinding.CSharp.targets" />
                </Project>






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 14 '18 at 15:50









                NickNick

                1,47021633




                1,47021633



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53281775%2finclude-build-directory-in-nuget-package-using-visual-studio-pack%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    這個網誌中的熱門文章

                    How to read a connectionString WITH PROVIDER in .NET Core?

                    Node.js Script on GitHub Pages or Amazon S3

                    Museum of Modern and Contemporary Art of Trento and Rovereto