msbuild - Setting of BaseIntermediateOutputPath prevents running .targets from Nuget -


i have msvs 2017 (15.3) , following problem. project references system.data.sqlite contains targets file copies native dlls output folder. works correctly (dlls appear in correct place) until specify value baseintermediateoutputpath parameter in props file. after setting parameter build successful dlls missing.

project file:

<project sdk="microsoft.net.sdk">   <propertygroup>     <outputtype>exe</outputtype>     <targetframework>net452</targetframework>   </propertygroup>   <import project="common.net.props" />   <itemgroup>     <packagereference include="system.data.sqlite" version="1.0.105.2" />  </itemgroup> 

imported props has following content

<project>   <propertygroup>     <solutiondir>$(msbuildthisfiledirectory)</solutiondir>     <configuration condition="$(configuration) == ''">debug</configuration>   </propertygroup>   <propertygroup>     <synoutdir>$(targetframework)_$(platform)_$(configuration)</synoutdir>   </propertygroup>   <propertygroup>     <baseoutputpath>../bin/</baseoutputpath>     <baseintermediateoutputpath>../tmp/$(msbuildprojectname)/</baseintermediateoutputpath>     <outputpath>$(baseoutputpath)$(synoutdir)</outputpath>     <outdir>$(outputpath)</outdir>     <langversion>7</langversion>   </propertygroup> </project> 

you've hit known issue in msbuild caused import order. in msbuild 15, "sdk" attribute on <project> implicit top/bottom import. import happens late.

changing order should solve issue. this:

<project>    <import project="common.net.props" />    <import project="sdk.props" sdk="microsoft.net.sdk" />     <!-- rest of project -->    <import project="sdk.targets" sdk="microsoft.net.sdk" /> </project> 

you can name file "directory.build.props" , magically imported you. see https://github.com/microsoft/msbuild/issues/1603


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -