Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
36 changes: 33 additions & 3 deletions Microsoft.Windows.CsWin32.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29322.22
# Visual Studio Version 17
VisualStudioVersion = 17.0.31601.41
MinimumVisualStudioVersion = 15.0.26124.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1CE9670B-D5FF-46A7-9D00-24E70E6ED48B}"
ProjectSection(SolutionItems) = preProject
Expand Down Expand Up @@ -29,7 +29,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{36CCE840-6
test\Directory.Build.targets = test\Directory.Build.targets
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Windows.CsWin32", "src\Microsoft.Windows.CsWin32\Microsoft.Windows.CsWin32.csproj", "{E3E96466-44B6-41AF-BBC8-9D30183ED8A9}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Windows.CsWin32.Roslyn38", "src\Microsoft.Windows.CsWin32\Roslyn38\Microsoft.Windows.CsWin32.Roslyn38.csproj", "{E3E96466-44B6-41AF-BBC8-9D30183ED8A9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Windows.CsWin32.Tests", "test\Microsoft.Windows.CsWin32.Tests\Microsoft.Windows.CsWin32.Tests.csproj", "{0129FE6E-3480-408A-BF40-9E6343CDB06C}"
EndProject
Expand All @@ -41,7 +41,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SpellChecker", "test\SpellC
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinRTInteropTest", "test\WinRTInteropTest\WinRTInteropTest.csproj", "{0E067B66-C2EC-4106-87D2-5310CFCDC5B8}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Microsoft.Windows.CsWin32.Shared", "src\Microsoft.Windows.CsWin32.Shared\Microsoft.Windows.CsWin32.Shared.shproj", "{D820AF8C-46E2-4AE4-B045-0D70B81BDF7E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Windows.CsWin32.Package", "src\Microsoft.Windows.CsWin32.Package\Microsoft.Windows.CsWin32.Package.csproj", "{F8CE8211-C0C0-440C-904D-7C5444A29933}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Windows.CsWin32.Roslyn40", "src\Microsoft.Windows.CsWin32\Roslyn40\Microsoft.Windows.CsWin32.Roslyn40.csproj", "{11AC1BA1-614A-4332-9448-1DD6E1B75D48}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\Microsoft.Windows.CsWin32.Shared\Microsoft.Windows.CsWin32.Shared.projitems*{11ac1ba1-614a-4332-9448-1dd6e1b75d48}*SharedItemsImports = 5
src\Microsoft.Windows.CsWin32.Shared\Microsoft.Windows.CsWin32.Shared.projitems*{d820af8c-46e2-4ae4-b045-0d70b81bdf7e}*SharedItemsImports = 13
src\Microsoft.Windows.CsWin32.Shared\Microsoft.Windows.CsWin32.Shared.projitems*{e3e96466-44b6-41af-bbc8-9d30183ed8a9}*SharedItemsImports = 5
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|NonWindows = Debug|NonWindows
Expand Down Expand Up @@ -95,6 +106,22 @@ Global
{0E067B66-C2EC-4106-87D2-5310CFCDC5B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0E067B66-C2EC-4106-87D2-5310CFCDC5B8}.Release|Any CPU.Build.0 = Release|Any CPU
{0E067B66-C2EC-4106-87D2-5310CFCDC5B8}.Release|NonWindows.ActiveCfg = Release|Any CPU
{F8CE8211-C0C0-440C-904D-7C5444A29933}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F8CE8211-C0C0-440C-904D-7C5444A29933}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F8CE8211-C0C0-440C-904D-7C5444A29933}.Debug|NonWindows.ActiveCfg = Debug|Any CPU
{F8CE8211-C0C0-440C-904D-7C5444A29933}.Debug|NonWindows.Build.0 = Debug|Any CPU
{F8CE8211-C0C0-440C-904D-7C5444A29933}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F8CE8211-C0C0-440C-904D-7C5444A29933}.Release|Any CPU.Build.0 = Release|Any CPU
{F8CE8211-C0C0-440C-904D-7C5444A29933}.Release|NonWindows.ActiveCfg = Release|Any CPU
{F8CE8211-C0C0-440C-904D-7C5444A29933}.Release|NonWindows.Build.0 = Release|Any CPU
{11AC1BA1-614A-4332-9448-1DD6E1B75D48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{11AC1BA1-614A-4332-9448-1DD6E1B75D48}.Debug|Any CPU.Build.0 = Debug|Any CPU
{11AC1BA1-614A-4332-9448-1DD6E1B75D48}.Debug|NonWindows.ActiveCfg = Debug|Any CPU
{11AC1BA1-614A-4332-9448-1DD6E1B75D48}.Debug|NonWindows.Build.0 = Debug|Any CPU
{11AC1BA1-614A-4332-9448-1DD6E1B75D48}.Release|Any CPU.ActiveCfg = Release|Any CPU
{11AC1BA1-614A-4332-9448-1DD6E1B75D48}.Release|Any CPU.Build.0 = Release|Any CPU
{11AC1BA1-614A-4332-9448-1DD6E1B75D48}.Release|NonWindows.ActiveCfg = Release|Any CPU
{11AC1BA1-614A-4332-9448-1DD6E1B75D48}.Release|NonWindows.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -106,6 +133,9 @@ Global
{7E8A5179-F94C-410F-8BBE-FDAAA95A19C3} = {36CCE840-6FE5-4DB9-A8D5-8CF3CB6D342A}
{744BE74F-8C4A-49E8-9683-52D987224285} = {36CCE840-6FE5-4DB9-A8D5-8CF3CB6D342A}
{0E067B66-C2EC-4106-87D2-5310CFCDC5B8} = {36CCE840-6FE5-4DB9-A8D5-8CF3CB6D342A}
{D820AF8C-46E2-4AE4-B045-0D70B81BDF7E} = {9E154A29-1796-4B85-BD81-B6A385D8FF71}
{F8CE8211-C0C0-440C-904D-7C5444A29933} = {9E154A29-1796-4B85-BD81-B6A385D8FF71}
{11AC1BA1-614A-4332-9448-1DD6E1B75D48} = {9E154A29-1796-4B85-BD81-B6A385D8FF71}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E3944F6A-384B-4B0F-B93F-3BD513DC57BD}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>

<!-- Special properties for analyzer packages. -->
<IncludeBuildOutput>false</IncludeBuildOutput>
<IncludeSymbols>false</IncludeSymbols>
<NoWarn>$(NoWarn);NU5128;NU5127</NoWarn>
</PropertyGroup>

<PropertyGroup>
<NuSpecFile>Microsoft.Windows.CsWin32.nuspec</NuSpecFile>

<PackageId>Microsoft.Windows.CsWin32</PackageId>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Microsoft.Windows.CsWin32\Roslyn38\Microsoft.Windows.CsWin32.Roslyn38.csproj" Private="true" ReferenceOutputAssembly="false" />
<ProjectReference Include="..\Microsoft.Windows.CsWin32\Roslyn40\Microsoft.Windows.CsWin32.Roslyn40.csproj" Private="true" ReferenceOutputAssembly="false" />
Comment on lines +21 to +22

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 The Roslyn38 and Roslyn40 subfolders seemed the easiest way to achieve all of:

  1. Share version.json
  2. Not move settings.schema.json
  3. Not have 3 top-level folders for one multi-targeted assembly

</ItemGroup>

<ItemGroup>
<None Update="readme.txt" Pack="true" PackagePath="" />
<None Include="build\**" Pack="true" PackagePath="build\" />
</ItemGroup>

<Import Project="$(MSBuildProjectName).targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

<Target Name="SetNuSpecProperties" BeforeTargets="GenerateNuspec" DependsOnTargets="GetBuildVersion">
<PropertyGroup>
<NuspecProperties>$(NuspecProperties);Version=$(Version);BaseOutputPath=$(OutputPath);MetadataVersion=$(MetadataVersion);ApiDocsVersion=$(ApiDocsVersion);PackageReleaseNotes=$(PackageReleaseNotes);commit=$(GitCommitId);</NuspecProperties>
<OutputPath38>$(RepoRootPath)bin\Microsoft.Windows.CsWin32.Roslyn38\$(Configuration)\netstandard2.0\</OutputPath38>
<OutputPath40>$(RepoRootPath)bin\Microsoft.Windows.CsWin32.Roslyn40\$(Configuration)\netstandard2.0\</OutputPath40>
<NuspecProperties>$(NuspecProperties);Version=$(Version);BaseOutputPath=$(OutputPath);BaseOutputPath38=$(OutputPath38);BaseOutputPath40=$(OutputPath40);MetadataVersion=$(MetadataVersion);ApiDocsVersion=$(ApiDocsVersion);PackageReleaseNotes=$(PackageReleaseNotes);commit=$(GitCommitId);</NuspecProperties>
</PropertyGroup>
</Target>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>Microsoft.Windows.CsWin32</id>
<version>$version$</version>
<authors>Microsoft</authors>
<developmentDependency>true</developmentDependency>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
<projectUrl>https://github.com/Microsoft/CsWin32</projectUrl>
<description>Microsoft Windows SDK Win32 API Source Generator</description>
<releaseNotes>$PackageReleaseNotes$</releaseNotes>
<readme>README.md</readme>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<repository type="git" url="https://github.com/microsoft/CsWin32.git" commit="$commit$" />
<dependencies>
<group targetFramework="net20">
<dependency id="Microsoft.Windows.SDK.Win32Metadata" version="$MetadataVersion$" include="buildTransitive" />
<dependency id="Microsoft.Windows.SDK.Win32Docs" version="$ApiDocsVersion$" include="buildTransitive" />
</group>
<group targetFramework="net45">
<dependency id="Microsoft.Windows.SDK.Win32Metadata" version="$MetadataVersion$" include="buildTransitive" />
<dependency id="Microsoft.Windows.SDK.Win32Docs" version="$ApiDocsVersion$" include="buildTransitive" />
<dependency id="System.Memory" version="4.5.4" include="All" />
</group>
<group targetFramework=".NETStandard1.1">
<dependency id="Microsoft.Windows.SDK.Win32Metadata" version="$MetadataVersion$" include="buildTransitive" />
<dependency id="Microsoft.Windows.SDK.Win32Docs" version="$ApiDocsVersion$" include="buildTransitive" />
<dependency id="System.Memory" version="4.5.4" include="All" />
</group>
</dependencies>
</metadata>
<files>
<!-- Roslyn 3.8 -->
<file src="$BaseOutputPath38$Microsoft.Windows.SDK.Win32Docs.dll" target="build\analyzers\dotnet\roslyn3.8\cs\Microsoft.Windows.SDK.Win32Docs.dll" />
<file src="$BaseOutputPath38$Microsoft.Windows.CsWin32.Roslyn38.dll" target="build\analyzers\dotnet\roslyn3.8\cs\Microsoft.Windows.CsWin32.dll" />
<file src="$BaseOutputPath38$MessagePack.dll" target="build\analyzers\dotnet\roslyn3.8\cs\MessagePack.dll" />
<file src="$BaseOutputPath38$MessagePack.Annotations.dll" target="build\analyzers\dotnet\roslyn3.8\cs\MessagePack.Annotations.dll" />
<file src="$BaseOutputPath38$Microsoft.Bcl.AsyncInterfaces.dll" target="build\analyzers\dotnet\roslyn3.8\cs\Microsoft.Bcl.AsyncInterfaces.dll" />
<file src="$BaseOutputPath38$System.Text.Json.dll" target="build\analyzers\dotnet\roslyn3.8\cs\System.Text.Json.dll" />
<file src="$BaseOutputPath38$System.Text.Encodings.Web.dll" target="build\analyzers\dotnet\roslyn3.8\cs\System.Text.Encodings.Web.dll" />
<file src="$BaseOutputPath38$System.Numerics.Vectors.dll" target="build\analyzers\dotnet\roslyn3.8\cs\System.Numerics.Vectors.dll" />
<file src="$BaseOutputPath38$System.Threading.Tasks.Extensions.dll" target="build\analyzers\dotnet\roslyn3.8\cs\System.Threading.Tasks.Extensions.dll" />
<file src="$BaseOutputPath38$System.Memory.dll" target="build\analyzers\dotnet\roslyn3.8\cs\System.Memory.dll" />
<file src="$BaseOutputPath38$System.Buffers.dll" target="build\analyzers\dotnet\roslyn3.8\cs\System.Buffers.dll" />
<file src="$BaseOutputPath38$System.Runtime.CompilerServices.Unsafe.dll" target="build\analyzers\dotnet\roslyn3.8\cs\System.Runtime.CompilerServices.Unsafe.dll" />

<!-- Roslyn 4.0 -->
<file src="$BaseOutputPath40$Microsoft.Windows.SDK.Win32Docs.dll" target="build\analyzers\dotnet\roslyn4.0\cs\Microsoft.Windows.SDK.Win32Docs.dll" />
<file src="$BaseOutputPath40$Microsoft.Windows.CsWin32.Roslyn40.dll" target="build\analyzers\dotnet\roslyn4.0\cs\Microsoft.Windows.CsWin32.dll" />
<file src="$BaseOutputPath40$MessagePack.dll" target="build\analyzers\dotnet\roslyn4.0\cs\MessagePack.dll" />
<file src="$BaseOutputPath40$MessagePack.Annotations.dll" target="build\analyzers\dotnet\roslyn4.0\cs\MessagePack.Annotations.dll" />
<file src="$BaseOutputPath40$Microsoft.Bcl.AsyncInterfaces.dll" target="build\analyzers\dotnet\roslyn4.0\cs\Microsoft.Bcl.AsyncInterfaces.dll" />
<file src="$BaseOutputPath40$System.Text.Json.dll" target="build\analyzers\dotnet\roslyn4.0\cs\System.Text.Json.dll" />
<file src="$BaseOutputPath40$System.Text.Encodings.Web.dll" target="build\analyzers\dotnet\roslyn4.0\cs\System.Text.Encodings.Web.dll" />
<file src="$BaseOutputPath40$System.Numerics.Vectors.dll" target="build\analyzers\dotnet\roslyn4.0\cs\System.Numerics.Vectors.dll" />
<file src="$BaseOutputPath40$System.Threading.Tasks.Extensions.dll" target="build\analyzers\dotnet\roslyn4.0\cs\System.Threading.Tasks.Extensions.dll" />
<file src="$BaseOutputPath40$System.Memory.dll" target="build\analyzers\dotnet\roslyn4.0\cs\System.Memory.dll" />
<file src="$BaseOutputPath40$System.Buffers.dll" target="build\analyzers\dotnet\roslyn4.0\cs\System.Buffers.dll" />
<file src="$BaseOutputPath40$System.Runtime.CompilerServices.Unsafe.dll" target="build\analyzers\dotnet\roslyn4.0\cs\System.Runtime.CompilerServices.Unsafe.dll" />

<!-- Common files -->
<file src="readme.txt" target="readme.txt" />
<file src="..\..\README.md" target="README.md" />
<file src="..\..\NOTICE.txt" target="NOTICE.txt" />
<file src="build\**" target="build\" />
<file src="tools\**" target="tools\" />
</files>
</package>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Target Name="_CsWin32GatherAnalyzers">
<ItemGroup>
<_CsWin32Analyzer Include="@(Analyzer)" Condition="'%(Analyzer.NuGetPackageId)' == 'Microsoft.Windows.CsWin32'" />
</ItemGroup>
</Target>

<Target Name="_CsWin32AnalyzerMultiTargeting"
Condition="'$(SupportsRoslynComponentVersioning)' != 'true'"
AfterTargets="ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets"
DependsOnTargets="_CsWin32GatherAnalyzers">

<ItemGroup>
<!-- Remove our analyzers targeting roslyn 4+ -->
<Analyzer Remove="@(_CsWin32Analyzer)"
Condition="$([System.String]::Copy('%(_CsWin32Analyzer.Identity)').IndexOf('roslyn3')) &lt; 0"/>
</ItemGroup>
</Target>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\$(MSBuildThisFileName)$(MSBuildThisFileExtension)" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\$(MSBuildThisFileName)$(MSBuildThisFileExtension)" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public class Generator : IDisposable

private readonly GeneratorOptions options;
private readonly CSharpCompilation? compilation;
private readonly CSharpParseOptions? parseOptions;
private readonly LanguageVersion? languageVersion;
private readonly bool canUseSpan;
private readonly bool canCallCreateSpan;
private readonly bool getDelegateForFunctionPointerGenericExists;
Expand All @@ -313,8 +313,8 @@ public class Generator : IDisposable
/// <param name="docs">The API docs to include in the generated code.</param>
/// <param name="options">Options that influence the result of generation.</param>
/// <param name="compilation">The compilation that the generated code will be added to.</param>
/// <param name="parseOptions">The parse options that will be used for the generated code.</param>
public Generator(string metadataLibraryPath, Docs? docs, GeneratorOptions options, CSharpCompilation? compilation = null, CSharpParseOptions? parseOptions = null)
/// <param name="languageVersion">The language version that will be used for the generated code.</param>
public Generator(string metadataLibraryPath, Docs? docs, GeneratorOptions options, CSharpCompilation? compilation = null, LanguageVersion? languageVersion = null)
{
this.InputAssemblyName = Path.GetFileNameWithoutExtension(metadataLibraryPath);
this.MetadataIndex = MetadataIndex.Get(metadataLibraryPath, compilation?.Options.Platform);
Expand All @@ -323,7 +323,7 @@ public Generator(string metadataLibraryPath, Docs? docs, GeneratorOptions option
this.options = options;
this.options.Validate();
this.compilation = compilation;
this.parseOptions = parseOptions;
this.languageVersion = languageVersion;
this.volatileCode = new(this.committedCode);

this.canUseSpan = this.compilation?.GetTypeByMetadataName(typeof(Span<>).FullName) is not null;
Expand Down Expand Up @@ -390,7 +390,7 @@ private enum FriendlyOverloadOf

internal MetadataReader Reader => this.MetadataIndex.Reader;

internal LanguageVersion LanguageVersion => this.parseOptions?.LanguageVersion ?? LanguageVersion.CSharp9;
internal LanguageVersion LanguageVersion => this.languageVersion ?? LanguageVersion.CSharp9;

private bool WideCharOnly => this.options.WideCharOnly;

Expand Down
Loading