11<Project Sdk =" Microsoft.NET.Sdk" >
2+ <!--
3+ The imports (on top and bottom) should be replaced with a single Sdk element at the top,
4+ <Sdk Name="CodeGeneration.Roslyn.PluginMetapackage.Sdk" Version="x.y.z" />
5+
6+ see https://docs.microsoft.com/en-us/visualstudio/msbuild/how-to-use-project-sdk?view=vs-2019#reference-a-project-sdk
7+
8+ But it's using local Sdk, so we can't use it like that.
9+ -->
10+ <Import Project =" $(CodeGenerationRoslynPluginMetapackageSdkPath)Sdk.props" />
211
312 <PropertyGroup >
4- <!-- Declare the TargetFramework the same as in your Attributes package -->
5- <TargetFramework >netstandard1.0</ TargetFramework >
13+ <!-- Declare the TargetFramework(s) the same as in your Attributes package -->
14+ <TargetFrameworks >netstandard1.0;netstandard2.0</ TargetFrameworks >
615 <!-- This project contains no files, so building can be skipped -->
716 <NoBuild >true</NoBuild >
817 <!-- Since we don't build, there'll be no build output -->
918 <IncludeBuildOutput >false</IncludeBuildOutput >
1019 </PropertyGroup >
1120
1221 <ItemGroup >
13- <!-- Reference your Attributes normally -->
14- <PackageReference Include =" MetapackageSample.Attributes" Version =" $(PackageVersion)" />
15- <!-- Reference your generators with PrivateAssets="none" to flow "build" assets -->
16- <PackageReference Include =" MetapackageSample.Generators" Version =" $(PackageVersion)" PrivateAssets =" none" />
17- <!-- Reference CodeGeneration.Roslyn.Tool with PrivateAssets="none" to flow "build" assets -->
18- <PackageReference Include =" CodeGeneration.Roslyn.Tool" Version =" $(LocalNuGetVersion)" PrivateAssets =" none" />
19- <!-- Add an empty placeholder to keep valid package structure -->
20- <None Include =" _._" Pack =" true" PackagePath =" lib/$(TargetFramework)/" />
22+ <!-- Reference your Attributes project normally -->
23+ <ProjectReference Include =" ../MetapackageSample.Attributes/MetapackageSample.Attributes.csproj" />
24+ <!--
25+ Reference your generators package by adding an item to NupkgAdditionalDependency
26+ with IncludeAssets="all" to flow "build" assets.
27+ Version used will be the PackageVersion Pack resolves,
28+ but you can specify Version metadata to override it.
29+
30+ This is necessary to do like that, because it ensures the dependency is setup
31+ correctly (e.g. simple transient dependency), and skips validation of TFM (Plugin is a tool,
32+ it's TFM has no meaning for the consumer).
33+ -->
34+ <NupkgAdditionalDependency
35+ Include =" MetapackageSample.Generators"
36+ IncludeAssets =" all" />
2137 </ItemGroup >
2238
23- </Project >
39+ <!-- See top comment -->
40+ <Import Project =" $(CodeGenerationRoslynPluginMetapackageSdkPath)Sdk.targets" />
41+ </Project >
0 commit comments