0
votes

I'm building a NuGet package that uses the new features in NuGet 2.5 to automatically update the project file to include a *.props and *.targets file to add support for custom build steps. Currently these files are included in the NuGet package under the following paths:

  • /build/net35: These are the .props and .targets files for projects using MSBuild 3.5 (i.e. Visual Studio 2008), regardless of which target framework their project targets.
  • /build/net40: These are the .props and .targets files for projects using MSBuild 4.0 (i.e. Visual Studio 2010-2012), regardless of which target framework their project targets.

Unfortunately NuGet does not appear to behave the way I expected, and the /build/net35 folder is getting used for projects using MSBuild 4.0 (Visual Studio 2012) that target .NET 3.5. How can I restructure the package to separate my build customizations based upon which version of MSBuild the project uses, and not by what the target framework is?

1

1 Answers

0
votes

I resolved this problem by separating the original Antlr4 package into three separate packages:

  1. Antlr4.Runtime: This package contains the runtime libraries for each supported target framework.
  2. Antlr4: This package contains only the tools and build configuration for MSBuild 4.0 (Visual Studio 2010+). It depends on the Antlr4.Runtime package. The build files are placed in /build instead of the original /build/net40.
  3. Antlr4.VS2008: This package contains only the tools and build configuration for MSBuild 3.5 (Visual Studio 2008). It depends on the Antlr4.Runtime package. The build files are placed in /build instead of the original /build/net35.

With these packages separated, users install either Antlr4 or Antlr4.VS2008 (depending on which version of MSBuild they are using), and NuGet will properly install everything.