Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Directory.Build.Props is not overriding property in nuget package

$
0
0

I am developing a WinForms application in Visual Studio 2017. I have a nuget package which contains a props file which causes a compiler error to happen if the platform is set to AnyCPU. However, there are times when I want to ignore this error, such as when I am using the Visual Designer, which fails to work when the configuration is x64. (That is a well known limitation).

The relevant part of the nuget props file is:

<PropertyGroup><BuildDependsOn>      SpeechPlatformCheck;      $(BuildDependsOn);</BuildDependsOn></PropertyGroup><Target Name="SpeechPlatformCheck"><Error Condition="'$(Platform.ToLower())' == 'anycpu'" Text="Cognitive Services Speech SDK doesn't support 'Any CPU' as a platform." /></Target>

I know this will all work fine, because if I manually edit the nuget props file the compile works and I can use the Visual Designer. (When we actually deploy the app we switch to x64 which also works fine). This is only a problem when using the Visual Designer.

I am attempt to override the nuget props file by adding a Directory.Build.props file to my csproj file, as shown below.

<?xml version="1.0" encoding="utf-8" ?><Project><PropertyGroup><BuildDependsOn>true</BuildDependsOn></PropertyGroup></Project>

Currently this is not working. I know for sure my Directory.Build.props file is being included early in the compile process. I've tried lots of permutations, setting it true/false/empty. I tried to see if I could override the "SpeechPlatformCheck" target. All to no avail.

My work-around is to hack the nuget props file, which I would rather not do. What can I do here? Is the nuget props file being processed last and trumping anything I attempt to do in my own props file?


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>