Skip to content

Instantly share code, notes, and snippets.

@ricaun
Last active May 8, 2025 17:31
Show Gist options
  • Save ricaun/b5b1d212238e277c5df46221f6d0834b to your computer and use it in GitHub Desktop.
Save ricaun/b5b1d212238e277c5df46221f6d0834b to your computer and use it in GitHub Desktop.
Copy BundleFiles Target for Autodesk AutoCAD
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<CopyBundleFiles>true</CopyBundleFiles>
</PropertyGroup>
<PropertyGroup>
<BundleDestinationFolder>$(AppData)\Autodesk\ApplicationPlugins\$(MSBuildProjectName).bundle</BundleDestinationFolder>
</PropertyGroup>
<Target Name="_CopyBundleFiles" AfterTargets="Build" Condition="$(CopyBundleFiles) and $(TargetFramework) != ''">
<ItemGroup>
<PackageContentsFile Include="$(ProjectDir)\PackageContents.xml" />
<BundleItems Include="$(OutputPath)**\*" />
</ItemGroup>
<Copy SourceFiles="@(BundleItems)" SkipUnchangedFiles="false" DestinationFolder="$(BundleDestinationFolder)\%(RecursiveDir)" ContinueOnError="true" Retries="1" />
<Copy SourceFiles="@(PackageContentsFile)" SkipUnchangedFiles="false" DestinationFolder="$(BundleDestinationFolder)" ContinueOnError="true" />
<Message Text="$(MSBuildProjectName) -&gt; $(BundleDestinationFolder) -&gt; [@(BundleItems -> '%(Filename)%(Extension)', ', ')] ($(TargetFramework)) " Importance="high" />
</Target>
<Target Name="_CleanBundleFiles" AfterTargets="Clean" Condition="$(CopyBundleFiles) and $(TargetFramework) != ''">
<RemoveDir Directories="$(BundleDestinationFolder)" ContinueOnError="true" />
<Delete Files="$(BundleDestinationFolder)\PackageContents.xml" ContinueOnError="true" />
</Target>
</Project>
@ricaun
Copy link
Author

ricaun commented May 7, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment