Skip to content

Commit 3689d85

Browse files
authored
Add SDKReference-sourced WinMDs when building (#679)
1 parent 61a55bc commit 3689d85

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

build_nuget.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ call msbuild /m /p:Configuration=Release,Platform=arm64,CppWinRTBuildVersion=%ta
1010

1111
call msbuild /m /p:Configuration=Release,Platform=x86,CppWinRTBuildVersion=%target_version% cppwinrt.sln /t:cppwinrt
1212

13-
nuget pack nuget\Microsoft.Windows.CppWinRT.nuspec -Properties cppwinrt_exe=%cd%\_build\x86\Release\cppwinrt.exe;cppwinrt_fast_fwd_x86=%cd%\_build\x86\Release\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_x64=%cd%\_build\x64\Release\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_arm=%cd%\_build\arm\Release\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_arm64=%cd%\_build\arm64\Release\cppwinrt_fast_forwarder.lib
13+
nuget pack nuget\Microsoft.Windows.CppWinRT.nuspec -Properties target_version=%target_version%;cppwinrt_exe=%cd%\_build\x86\Release\cppwinrt.exe;cppwinrt_fast_fwd_x86=%cd%\_build\x86\Release\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_x64=%cd%\_build\x64\Release\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_arm=%cd%\_build\arm\Release\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_arm64=%cd%\_build\arm64\Release\cppwinrt_fast_forwarder.lib

nuget/Microsoft.Windows.CppWinRT.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
33
<metadata minClientVersion="2.5">
44
<id>Microsoft.Windows.CppWinRT</id>
5-
<version>1.0.0.0</version>
5+
<version>$target_version$</version>
66
<title>C++/WinRT Build Support</title>
77
<authors>Microsoft</authors>
88
<owners>Microsoft</owners>

nuget/Microsoft.Windows.CppWinRT.targets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,12 @@ Copyright (C) Microsoft Corporation. All rights reserved.
248248

249249
<!--Get direct WinMD references (including Nuget packages) for projections, IDL processing, and AppX packaging-->
250250
<Target Name="GetCppWinRTDirectWinMDReferences"
251-
DependsOnTargets="ResolveAssemblyReferences;$(GetCppWinRTDirectWinMDReferencesDependsOn)"
251+
DependsOnTargets="ExpandSDKReferences;ResolveAssemblyReferences;$(GetCppWinRTDirectWinMDReferencesDependsOn)"
252252
Returns="@(CppWinRTDirectWinMDReferences)">
253253
<ItemGroup>
254254
<_CppWinRTDirectWinMDReferences Remove="@(_CppWinRTDirectWinMDReferences)" />
255255
<_CppWinRTDirectWinMDReferences Include="@(ReferencePath)" Condition="'%(ReferencePath.IsSystemReference)' != 'true' and '%(ReferencePath.WinMDFile)' == 'true' and '%(ReferencePath.ReferenceSourceTarget)' == 'ResolveAssemblyReference'" />
256+
<_CppWinRTDirectWinMDReferences Include="@(ReferencePath)" Condition="'%(ReferencePath.WinMDFile)' == 'true' and '%(ReferencePath.ReferenceSourceTarget)' == 'ExpandSDKReference'" />
256257
<CppWinRTDirectWinMDReferences Remove="@(CppWinRTDirectWinMDReferences)"/>
257258
<CppWinRTDirectWinMDReferences Include="@(_CppWinRTDirectWinMDReferences)">
258259
<WinMDPath>%(FullPath)</WinMDPath>

nuget/readme.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,14 @@ Example:
9494
9595
For more complex analysis of build errors, the [MSBuild Binary and Structured Log Viewer](http://msbuildlog.com/) is highly recommended.
9696

97+
## Building, Testing
98+
99+
Be sure to get the latest nuget.exe from [nuget.org](https://www.nuget.org/downloads) and place it in your path.
100+
101+
Build the package by running [build_nuget.cmd](../build_nuget.cmd) from a developer environment command line. For testing pass a version number that is much higher than your currently installed, like:
102+
103+
```
104+
c:\repos\cppwinrt> .\build_nuget.cmd 5.0.0.0
105+
```
106+
107+
Add the cppwinrt repo directory as a nuget source location and update your projects' references to point at it, update project references, then rebuild a test/sample project.

0 commit comments

Comments
 (0)