Compare commits

...

5 Commits

Author SHA1 Message Date
David Hall 907f21467e Fixed build for VssApi 2023-11-22 17:52:26 -07:00
David Hall be8c3ee6e8 Added SelfContained tag to project for Net8.0 2023-11-22 17:51:59 -07:00
David Hall 9d1d4db128 Fixed bugs in IShellFolder test 2023-11-22 17:50:49 -07:00
David Hall c84774927b Updated handle template 2023-11-22 17:50:14 -07:00
David Hall 2c6d71933b Separated SourceLInk and Package details into separate config files for solution 2023-11-22 17:49:48 -07:00
13 changed files with 52 additions and 62 deletions

View File

@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace Vanara.Properties {
namespace Vanara.PInvoke.Properties {
using System;
@ -19,7 +19,7 @@ namespace Vanara.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
@ -39,7 +39,7 @@ namespace Vanara.Properties {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Vanara.Properties.Resources", typeof(Resources).Assembly);
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Vanara.PInvoke.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;

View File

@ -1,14 +1,9 @@
<Project>
<PropertyGroup>
<Version>4.0.0-beta</Version>
<TargetFrameworks>net45;net48;net6.0;net7.0;netstandard2.0;netcoreapp3.1</TargetFrameworks>
<Configurations>Debug;Release</Configurations>
<Platforms>AnyCPU;x64;x86</Platforms>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)Vanara.snk</AssemblyOriginatorKeyFile>
<Authors>David Hall</Authors>
<Company>GitHub Community</Company>
<Copyright>Copyright © 2017-2023</Copyright>
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
@ -17,13 +12,6 @@
<LangVersion>latest</LangVersion>
<NeutralLanguage>en-US</NeutralLanguage>
<Nullable>enable</Nullable>
<PackageIcon>Vanara64x64.png</PackageIcon>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/dahall/vanara</PackageProjectUrl>
<Product>Vanara</Product>
<RepositoryType>Git</RepositoryType>
<RepositoryUrl>https://github.com/dahall/vanara</RepositoryUrl>
<RootNamespace>Vanara.PInvoke</RootNamespace>
<SignAssembly>true</SignAssembly>
<NoWarn>$(NoWarn);NETSDK1138;SYSLIB0003;SYSLIB0004;SYSLIB0011;IL2026;IL2050;IL2075;IL2067;IL2070;IL2072;IL2077;IL2080;IL2087;IL2090;CS0618;CA1401;CA2101;SYSLIB1054;</NoWarn>
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
@ -31,26 +19,10 @@
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<!-- BEGIN: Source Link configuration. -->
<PropertyGroup>
<IncludeSymbols>true</IncludeSymbols>
<EmbedAllSources>true</EmbedAllSources>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<CIBuild Condition="'$(CIBUILD)' == ''">false</CIBuild>
<ContinuousIntegrationBuild>$(CIBUILD)</ContinuousIntegrationBuild>
<DeterministicSourcePaths>$(CIBUILD)</DeterministicSourcePaths>
</PropertyGroup>
<PropertyGroup>
<MSBuildWarningsAsMessages>$(MSBuildWarningsAsMessages);NETSDK1105;NETSDK1138</MSBuildWarningsAsMessages>
</PropertyGroup>
<ItemGroup>
<PackageReference Condition="!$(MSBuildProjectDirectory.Contains('UnitTests'))" Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<SourceRoot Include="$(MSBuildThisFileDirectory)/" />
</ItemGroup>
<!-- END: Source Link configuration. -->
<Import Project="Package.targets" />
<Import Condition="('$(MSBuildProjectExtension)'=='.csproj' Or '$(MSBuildProjectExtension)'=='.vbproj') And !$(MSBuildProjectDirectory.Contains('UnitTests'))" Project="$(MSBuildThisFileDirectory)SourceLink.targets"/>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)docs\icons\Vanara64x64.png" Pack="true" PackagePath="\" />
<Compile Include="$(MSBuildThisFileDirectory)AsmDef.cs" Link="AsmDef.cs" Condition="'$(MSBuildProjectExtension)' == '.csproj'"/>
<Compile Include="$(MSBuildThisFileDirectory)AsmDef.cs" Link="AsmDef.cs" Condition="'$(MSBuildProjectExtension)'=='.csproj'"/>
</ItemGroup>
</Project>

View File

@ -203,11 +203,6 @@ public readonly struct HBRUSH : IGraphicsObjectHandle
/// <returns>The result of the conversion.</returns>
public static implicit operator HBRUSH(HGDIOBJ h) => new((IntPtr)h);
/// <summary>Performs an implicit conversion from <see cref="SystemColorIndex"/> to <see cref="HBRUSH"/>.</summary>
/// <param name="i">The color index.</param>
/// <returns>The result of the conversion.</returns>
public static implicit operator HBRUSH(SystemColorIndex i) => new((IntPtr)i);
/// <summary>Implements the operator ! which returns <see langword="true"/> if the handle is invalid.</summary>
/// <param name="hMem">The <see cref="HBRUSH"/> instance.</param>
/// <returns>The result of the operator.</returns>
@ -2124,7 +2119,7 @@ public readonly struct HWINSTA : IKernelHandle
/// <summary>Provides a handle to a window or dialog.</summary>
[StructLayout(LayoutKind.Sequential), DebuggerDisplay("{handle}")]
public struct HWND : IUserHandle
public readonly struct HWND : IUserHandle
{
private readonly IntPtr handle;

View File

@ -54,16 +54,14 @@
{ "HPROCESS", ("HPROCESS", "Process", "h.Handle" ) },
}; #>
using Microsoft.Win32.SafeHandles;
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace Vanara.PInvoke;
<# foreach (var (name, inheritance, summaryText) in classes) { #>
/// <summary><#= summaryText #></summary>
[StructLayout(LayoutKind.Sequential), DebuggerDisplay("{handle}")]
public struct <#= name #> : <#= inheritance #>
public readonly struct <#= name #> : <#= inheritance #>
{
private readonly IntPtr handle;

View File

@ -132,12 +132,6 @@
<Link>
<AdditionalDependencies>vssapi.lib</AdditionalDependencies>
</Link>
<!--<CustomBuildStep>
<Command>C:\Temp\Nuget.exe pack $(MSBuildThisFileDirectory)VssApi.nuspec -Symbols -SymbolPackageFormat snupkg -OutputDirectory bin\$(Configuration)</Command>
<Outputs>bin\$(Configuration)\$(AssemblyName).$(Version).nupkg</Outputs>
<Inputs>$(MSBuildThisFileDirectory)VssApi.nuspec</Inputs>
<TreatOutputAsContent>false</TreatOutputAsContent>
</CustomBuildStep>-->
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
@ -152,12 +146,6 @@
<Link>
<AdditionalDependencies>vssapi.lib</AdditionalDependencies>
</Link>
<!--<CustomBuildStep>
<Command>C:\Temp\Nuget.exe pack $(MSBuildThisFileDirectory)VssApi.nuspec -Symbols -SymbolPackageFormat snupkg -OutputDirectory bin\$(Configuration)</Command>
<Outputs>bin\$(Configuration)\$(AssemblyName).$(Version).nupkg</Outputs>
<Inputs>$(MSBuildThisFileDirectory)VssApi.nuspec</Inputs>
<TreatOutputAsContent>false</TreatOutputAsContent>
</CustomBuildStep>-->
</ItemDefinitionGroup>
<ItemGroup>
<PackageReference Include="NuGet.Build.Tasks.Pack" Version="6.7.0">
@ -203,7 +191,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="VssApi.nuspec" />
<None Include="Vanara.PInvoke.VssApi.nuspec" />
</ItemGroup>
<!--<ItemGroup>
<None Include="..\VssApiMgd\bin\Debug\net6.0\Vanara.PInvoke.VssApiMgd.dll" />

View File

@ -73,6 +73,6 @@
<None Include="$(MSBuildThisFileDirectory)docs\icons\Vanara64x64.png">
<Filter>Resource Files</Filter>
</None>
<None Include="VssApi.nuspec" />
<None Include="Vanara.PInvoke.VssApi.nuspec" />
</ItemGroup>
</Project>

16
Package.targets Normal file
View File

@ -0,0 +1,16 @@
<Project>
<PropertyGroup Label="VanaraPackage">
<Version>4.0.0-beta</Version>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)Vanara.snk</AssemblyOriginatorKeyFile>
<Authors>David Hall</Authors>
<Company>GitHub Community</Company>
<Copyright>Copyright © 2017-2023</Copyright>
<PackageIcon>Vanara64x64.png</PackageIcon>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/dahall/vanara</PackageProjectUrl>
<Product>Vanara</Product>
<RepositoryType>Git</RepositoryType>
<RepositoryUrl>https://github.com/dahall/vanara</RepositoryUrl>
<RootNamespace>Vanara.PInvoke</RootNamespace>
</PropertyGroup>
</Project>

18
SourceLink.targets Normal file
View File

@ -0,0 +1,18 @@
<Project>
<PropertyGroup>
<IncludeSymbols>true</IncludeSymbols>
<EmbedAllSources>true</EmbedAllSources>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<CIBuild Condition="'$(CIBUILD)' == ''">false</CIBuild>
<ContinuousIntegrationBuild>$(CIBUILD)</ContinuousIntegrationBuild>
<DeterministicSourcePaths>$(CIBUILD)</DeterministicSourcePaths>
</PropertyGroup>
<PropertyGroup>
<MSBuildWarningsAsMessages>$(MSBuildWarningsAsMessages);NETSDK1105;NETSDK1138</MSBuildWarningsAsMessages>
</PropertyGroup>
<ItemGroup Condition="!$(MSBuildProjectDirectory.Contains('UnitTests'))" >
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<SourceRoot Include="$(MSBuildThisFileDirectory)/" />
</ItemGroup>
</Project>

View File

@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>UnitTest.PInvoke.FhSvcCtl</AssemblyName>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition=" !$(TargetFramework.StartsWith('net8')) ">win10-x64</RuntimeIdentifier>
<SelfContained Condition=" $(TargetFramework.StartsWith('net8')) ">true</SelfContained>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\PInvoke\FhSvcCtl\Vanara.PInvoke.FhSvcCtl.csproj" />

View File

@ -35,8 +35,8 @@ public class IShellFolderTests
{
pFolder.Item.GetDefaultSearchGUID(out var defGuid).ThrowIfFailed();
pFolder.Item.EnumSearches(out var exSrc).ThrowIfFailed();
using var pExSrc = ComReleaserFactory.Create(exSrc);
var cenum = new IEnumFromCom<EXTRASEARCH>(exSrc.Next, exSrc.Reset);
using var pExSrc = ComReleaserFactory.Create(exSrc!);
var cenum = new IEnumFromCom<EXTRASEARCH>(exSrc!.Next, exSrc!.Reset);
//TestContext.WriteLine(kf);
foreach (var item in cenum)
TestContext.WriteLine($"{(item.guidSearch == defGuid ? "*" : "")}{item.wszFriendlyName}: {item.wszUrl}");

View File

@ -7,10 +7,10 @@
<ItemGroup>
<Reference Include="Microsoft.VisualBasic">
<HintPath>C:\Program Files\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\6.0.24\ref\net6.0\Microsoft.VisualBasic.dll</HintPath>
</Reference>
</Reference>
<Reference Include="System.Drawing">
<HintPath>C:\Program Files\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\6.0.24\ref\net6.0\System.Drawing.dll</HintPath>
</Reference>
</Reference>
<Reference Include="WindowsBase">
<HintPath>C:\Program Files\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\6.0.24\ref\net6.0\WindowsBase.dll</HintPath>
</Reference>

View File

@ -11,7 +11,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Directory.Build.targets = Directory.Build.targets
LICENSE = LICENSE
NugetPkgReadme.md = NugetPkgReadme.md
Package.targets = Package.targets
README.md = README.md
SourceLink.targets = SourceLink.targets
Vanara.Library.nuspec = Vanara.Library.nuspec
Vanara.snk = Vanara.snk
EndProjectSection