Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
5ad0baf
Initial WinMD generator port
manodasanW Mar 24, 2026
8ce814f
Implement custom attribute copying and fix static class handling in W…
manodasanW Mar 24, 2026
07c6ab4
Fix interface filtering, method visibility check, and MethodImpl matc…
manodasanW Mar 24, 2026
4279033
Handle nested public types in WinMD generation
manodasanW Mar 24, 2026
66c8667
Fix synthesized interface duplication and nested type reference handling
manodasanW Mar 24, 2026
66cfbfb
Reorganize WinMD generator to match other build task conventions
manodasanW Mar 24, 2026
6d50286
Reuse shared properties from CsWinRTGen.targets in WinMD generator ta…
manodasanW Apr 12, 2026
1b7a421
Use shared tools directory and gate WinMD generation on CsWinRTComponent
manodasanW Apr 12, 2026
ba8c215
Import WinMD generator targets from CsWinRT.targets
manodasanW Apr 12, 2026
ee57a13
Fix UsingTask condition to use CsWinRTGeneratorTasksOverriden2
manodasanW Apr 12, 2026
d6b6358
Fix System.Type attribute arguments to use TypeSignature instead of s…
manodasanW Apr 12, 2026
841910d
Fix GuidAttribute detection for explicit user-specified GUIDs
manodasanW Apr 12, 2026
bdc92c0
Fix GUID encoding, delegate ctor, and delegate parameter attributes
manodasanW Apr 12, 2026
abf6da0
Set WinMD metadata version to WindowsRuntime 1.4
manodasanW Apr 12, 2026
466b802
Set assembly hash algorithm to SHA1 for WinMD output
manodasanW Apr 12, 2026
d7f6793
Fix MethodImplementation argument order (declaration, body)
manodasanW Apr 12, 2026
5909a23
Reference synthesized interfaces as TypeDefinition instead of TypeRef…
manodasanW Apr 12, 2026
31f151d
Fix self-referencing TypeRef/AssemblyRef and duplicate MethodImpls
manodasanW Apr 12, 2026
a337574
Fix enum field types and add DefaultAttribute on first user interface
manodasanW Apr 12, 2026
d6c5faf
Fix duplicate Module type and duplicate mscorlib AssemblyRef
manodasanW Apr 12, 2026
c7faf16
Fix parameter attributes and early type registration for all type kinds
manodasanW Apr 12, 2026
092c4d9
Process forward-referenced types on demand in ImportTypeReference
manodasanW Apr 12, 2026
adae9f0
Minor cleanup in AssemblyAnalyzer and TypeMapper
manodasanW Apr 12, 2026
a8d1eba
Implement custom mapped interface members for WinMD generation
manodasanW Apr 12, 2026
6df117e
Gather all interfaces including inherited ones for mapped interface p…
manodasanW Apr 12, 2026
496f448
Fix public detection for mapped interfaces and use short generic type…
manodasanW Apr 12, 2026
fd9c06b
Fix PropertySignature for static properties to use CreateStatic
manodasanW Apr 12, 2026
343b99b
Fix HasThis for static properties/events on synthesized interfaces
manodasanW Apr 12, 2026
1b4b83f
Apply WinRT type mappings in method signatures and filter mapped members
manodasanW Apr 12, 2026
6a1ce98
Filter DefaultMemberAttribute and fix generic type name formatting
manodasanW Apr 12, 2026
ef4fe04
Fix DefaultAttribute, explicit interface implementations, and Observa…
manodasanW Apr 12, 2026
b9f6f77
Fix explicit impl WinRT conventions and resolve generic base type args
manodasanW Apr 12, 2026
87f7934
Fix IBindableIterable vs IIterable<T> and ICollection member filtering
manodasanW Apr 12, 2026
4796c72
Fix WinMD comparison issues: generic resolution, MethodImpl encoding,…
manodasanW Apr 12, 2026
7798d37
Fix projected type matching, MethodImpl signatures, and dictionary en…
manodasanW Apr 12, 2026
7fa7d29
Fix ExplicltlyImplementedClass and ObservableVector MethodImpl matching
manodasanW Apr 13, 2026
f878424
Fix EventRegistrationToken mapping namespace
manodasanW Apr 13, 2026
4cc3ec7
Fix ObservableVector event MethodImpl and add TypedEventHandler mapping
manodasanW Apr 13, 2026
56a0b54
Fix Default attribute placement on first user-declared interface
manodasanW Apr 13, 2026
8e95ab5
Fix MethodImpl generic param encoding for event handlers and return t…
manodasanW Apr 13, 2026
bd257bd
Implement Span/ReadOnlySpan to WinRT array parameter mapping
manodasanW Apr 13, 2026
0b12fcd
Updated test
manodasanW Apr 13, 2026
eed3250
Fix code review findings: generic params, duplicate args, parameter a…
manodasanW Apr 13, 2026
2a7afa7
Fix IsProjectionEquivalent for generic type instances
manodasanW Apr 13, 2026
98472fe
Fix assembly references and TypeDef redirection for WinMD convention
manodasanW Apr 13, 2026
37a6588
Add comprehensive WinMD test types for edge case coverage
manodasanW Apr 13, 2026
0a824e2
Add contract versioning support for WinMD generation
manodasanW Apr 13, 2026
26987d9
Restore custom property
manodasanW Apr 13, 2026
0c69d9e
Update slnx
manodasanW Apr 13, 2026
115dee9
Update WinMD generator for AsmResolver 6.0.0-rc.1
manodasanW Apr 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions nuget/Microsoft.Windows.CsWinMD.Generator.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<!--
***********************************************************************************************
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Setup common properties for '_RunCsWinRTWinMDGenerator' below -->
<PropertyGroup>

<!-- Output paths -->
<CsWinRTWinMDOutputDirectory Condition="'$(CsWinRTWinMDOutputDirectory)' == ''">$(IntermediateOutputPath)</CsWinRTWinMDOutputDirectory>
<_CsWinRTWinMDOutputPath>$(CsWinRTWinMDOutputDirectory)$(AssemblyName).winmd</_CsWinRTWinMDOutputPath>

<!--
Set the path of the file with the hash of all input properties for 'cswinrtwinmdgen'.
This is needed to make the target incremental with respect to property changes.
-->
<_RunCsWinRTWinMDGeneratorPropertyInputsCachePath Condition="'$(_RunCsWinRTWinMDGeneratorPropertyInputsCachePath)' == ''">$(IntermediateOutputPath)$(MSBuildProjectName).cswinrtwinmdgen.cache</_RunCsWinRTWinMDGeneratorPropertyInputsCachePath>
<_RunCsWinRTWinMDGeneratorPropertyInputsCachePath>$([MSBuild]::NormalizePath('$(MSBuildProjectDirectory)', '$(_RunCsWinRTWinMDGeneratorPropertyInputsCachePath)'))</_RunCsWinRTWinMDGeneratorPropertyInputsCachePath>
</PropertyGroup>

<!--
============================================================
_ResolveCsWinRTWinMDGenToolsDirectory

Resolves the location of the WinMD generator tools.
Uses the shared _CsWinRTToolsDirectory from _ResolveCsWinRToolsDirectory
when available (NuGet package), with a dev-only fallback.
============================================================
-->
<Target Name="_ResolveCsWinRTWinMDGenToolsDirectory" DependsOnTargets="ResolveAssemblyReferences;_ResolveCsWinRToolsDirectory" BeforeTargets="_ComputeRunCsWinRTWinMDGeneratorCache">
<PropertyGroup>
<CsWinRTWinMDGenEffectiveToolsDirectory Condition="'$(CsWinRTWinMDGenEffectiveToolsDirectory)' == ''">$(_CsWinRTToolsDirectory)</CsWinRTWinMDGenEffectiveToolsDirectory>
</PropertyGroup>
</Target>

<!--
============================================================
_ComputeRunCsWinRTWinMDGeneratorCache

Computes a hash of all input properties to detect when re-generation is needed.
============================================================
-->
<Target
Name="_ComputeRunCsWinRTWinMDGeneratorCache"
DependsOnTargets="CoreCompile;_ResolveCsWinRTWinMDGenToolsDirectory">

<ItemGroup>
<_RunCsWinRTWinMDGeneratorInputsCacheToHash Include="$(CsWinRTWinMDGenEffectiveToolsDirectory)" />
<_RunCsWinRTWinMDGeneratorInputsCacheToHash Include="$(CsWinRTUseWindowsUIXamlProjections)" />
<_RunCsWinRTWinMDGeneratorInputsCacheToHash Include="$(AssemblyVersion)" />
</ItemGroup>

<Hash ItemsToHash="@(_RunCsWinRTWinMDGeneratorInputsCacheToHash)">
<Output TaskParameter="HashResult" PropertyName="_RunCsWinRTWinMDGeneratorInputsCacheHash" />
</Hash>

<WriteLinesToFile
Lines="$(_RunCsWinRTWinMDGeneratorInputsCacheHash)"
File="$(_RunCsWinRTWinMDGeneratorPropertyInputsCachePath)"
Overwrite="true"
WriteOnlyWhenDifferent="true" />
</Target>

<!--
============================================================
_RunCsWinRTWinMDGenerator

Runs 'cswinrtwinmdgen' to produce a .winmd file from the compiled assembly.
This target runs after CoreCompile since it needs the compiled DLL.
============================================================
-->
<UsingTask Condition="'$(CsWinRTGeneratorTasksOverriden2)' != 'true'" TaskName="RunCsWinRTWinMDGenerator" AssemblyFile="$(CsWinRTGenTasksAssembly)" />
<Target
Name="_RunCsWinRTWinMDGenerator"
DependsOnTargets="CoreCompile;_ComputeRunCsWinRTWinMDGeneratorCache"
AfterTargets="CoreCompile"
Inputs="@(IntermediateAssembly);@(ReferencePathWithRefAssemblies);$(_RunCsWinRTWinMDGeneratorPropertyInputsCachePath)"
Outputs="$(_CsWinRTWinMDOutputPath)"
Condition="'$(CsWinRTComponent)' == 'true'">

<!-- Invoke 'cswinrtwinmdgen' -->
<RunCsWinRTWinMDGenerator
InputAssemblyPath="@(IntermediateAssembly)"
ReferenceAssemblyPaths="@(ReferencePathWithRefAssemblies)"
OutputWinmdPath="$(_CsWinRTWinMDOutputPath)"
AssemblyVersion="$(AssemblyVersion)"
UseWindowsUIXamlProjections="$(CsWinRTUseWindowsUIXamlProjections)"
CsWinRTToolsDirectory="$(CsWinRTWinMDGenEffectiveToolsDirectory)"
CsWinRTToolsArchitecture="$(CsWinRTToolsArchitecture)"
StandardOutputImportance="$(CsWinRTGeneratorStandardOutputImportance)"
StandardErrorImportance="$(CsWinRTGeneratorStandardErrorImportance)"
LogStandardErrorAsError="$(CsWinRTGeneratorLogStandardErrorAsError)" />

<!-- Make the .winmd available as an output -->
<ItemGroup>
<FileWrites Include="$(_CsWinRTWinMDOutputPath)" />
</ItemGroup>
</Target>
</Project>
1 change: 1 addition & 0 deletions nuget/Microsoft.Windows.CsWinRT.targets
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ $(CsWinRTInternalProjection)
<Import Project="$(MSBuildThisFileDirectory)Microsoft.Windows.CsWinRT.Prerelease.targets" Condition="Exists('$(MSBuildThisFileDirectory)Microsoft.Windows.CsWinRT.Prerelease.targets')"/>
<Import Project="$(MSBuildThisFileDirectory)Microsoft.Windows.CsWinRT.Authoring.targets" Condition="'$(CsWinRTComponent)' == 'true'"/>
<Import Project="$(MSBuildThisFileDirectory)Microsoft.Windows.CsWinRT.CsWinRTGen.targets"/>
<Import Project="$(MSBuildThisFileDirectory)Microsoft.Windows.CsWinMD.Generator.targets" Condition="'$(CsWinRTComponent)' == 'true'"/>

<!-- Default values for all custom CsWinRT runtime feature switches -->
<PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<CsWinRTInteropGenEffectiveToolsDirectory>$(MSBuildThisFileDirectory)WinRT.Interop.Generator\bin\$(Configuration)\net10.0\$(_CsWinRTToolsArchFolder)</CsWinRTInteropGenEffectiveToolsDirectory>
<CsWinRTImplEffectiveToolsDirectory>$(MSBuildThisFileDirectory)WinRT.Impl.Generator\bin\$(Configuration)\net10.0\$(_CsWinRTToolsArchFolder)</CsWinRTImplEffectiveToolsDirectory>
<CsWinRTMergedProjectionEffectiveToolsDirectory>$(MSBuildThisFileDirectory)WinRT.Projection.Generator\bin\$(Configuration)\net10.0\$(_CsWinRTToolsArchFolder)</CsWinRTMergedProjectionEffectiveToolsDirectory>
<CsWinRTWinMDGenEffectiveToolsDirectory>$(MSBuildThisFileDirectory)WinRT.WinMD.Generator\bin\$(Configuration)\net10.0\$(_CsWinRTToolsArchFolder)</CsWinRTWinMDGenEffectiveToolsDirectory>
<CsWinRTToolsArchitecture>AnyCPU</CsWinRTToolsArchitecture>
</PropertyGroup>

Expand Down
1 change: 0 additions & 1 deletion src/Tests/AuthoringTest/AuthoringTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
<ItemGroup>
<ProjectReference Include="..\..\Projections\Windows\Windows.csproj" />
<ProjectReference Include="..\..\Projections\WinAppSDK\WinAppSDK.csproj" />
<ProjectReference Include="..\..\Authoring\WinRT.SourceGenerator.Roslyn4120\WinRT.SourceGenerator.Roslyn4120.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />

<ProjectReference Include="..\..\cswinrt\cswinrt.vcxproj" />
</ItemGroup>
Expand Down
Loading
Loading