Skip to content

Commit a762017

Browse files
authored
Merge pull request #327 from augustoproiete/allow-package-reference-via-build-config
Allow devs to use PackageReference if they wish (despite current limitations)
2 parents 80b8016 + abdeecb commit a762017

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

Package/ExcelDna.AddIn/build/ExcelDna.AddIn.targets

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
<ExcelDna32BitAddInSuffix Condition="'$(ExcelDna32BitAddInSuffix)' == ''"></ExcelDna32BitAddInSuffix>
5555
<ExcelDna64BitAddInSuffix Condition="'$(ExcelDna64BitAddInSuffix)' == ''">64</ExcelDna64BitAddInSuffix>
5656

57+
<ExcelDnaAllowPackageReferenceProjectStyle Condition="'$(ExcelDnaAllowPackageReferenceProjectStyle)' == ''">false</ExcelDnaAllowPackageReferenceProjectStyle>
58+
5759
<ExcelDnaPackExePath Condition="'$(ExcelDnaPackExePath)' == ''">$(ExcelDnaToolsPath)ExcelDnaPack.exe</ExcelDnaPackExePath>
5860
<ExcelDnaPackXllSuffix Condition="'$(ExcelDnaPackXllSuffix)' == ''">-packed</ExcelDnaPackXllSuffix>
5961
<ExcelDnaPackCompressResources Condition="'$(ExcelDnaPackCompressResources)' == ''">true</ExcelDnaPackCompressResources>
@@ -64,9 +66,9 @@
6466
Target that checks if the project is not compatible with Excel-DNA
6567
-->
6668
<Target Name="ExcelDnaCheckPackageProjectStyle" BeforeTargets="CoreCompile">
67-
<Warning Code="DNA1546"
68-
Text="Excel-DNA is not compatible with projects that use NuGet `PackageReference`. Make sure you create a .NET Framework (Class Library) project and configure Visual Studio to use `packages.config`"
69-
Condition=" '$(PackageReferenceCompatibleProjectStyle)' == 'true' OR '$(RestoreProjectStyle)' == 'ProjectJson' OR '$(NuGetProjectStyle)' == 'PackageReference' " />
69+
<Error Code="DNA1546"
70+
Text="Excel-DNA is not compatible with projects that use NuGet `PackageReference`. Make sure you create a .NET Framework (Class Library) project and configure Visual Studio to use `packages.config`"
71+
Condition=" '$(ExcelDnaAllowPackageReferenceProjectStyle)' != 'true' AND ('$(PackageReferenceCompatibleProjectStyle)' == 'true' OR '$(RestoreProjectStyle)' == 'ProjectJson' OR '$(NuGetProjectStyle)' == 'PackageReference') " />
7072
</Target>
7173

7274
<!--

Package/ExcelDna.AddIn/content/ExcelDna.Build.props

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@
5252
<ExcelDna64BitAddInSuffix Condition="'$(ExcelDna64BitAddInSuffix)' == ''">64</ExcelDna64BitAddInSuffix>
5353
</PropertyGroup>
5454

55+
<PropertyGroup>
56+
<!--
57+
Enable/Disable using Excel-DNA with PackageReference projects (not officially supported)
58+
-->
59+
<ExcelDnaAllowPackageReferenceProjectStyle Condition="'$(ExcelDnaAllowPackageReferenceProjectStyle)' == ''">false</ExcelDnaAllowPackageReferenceProjectStyle>
60+
</PropertyGroup>
61+
5562
<!--
5663
Configuration properties for packing .dna files
5764
-->

0 commit comments

Comments
 (0)