Skip to content

Commit

Permalink
Csharp version (microsoft#635)
Browse files Browse the repository at this point in the history
* Switch .NET Standard and .NET Core projects to using AssemblyInfo and VersionInfo.
* Generate the VersionInfo file curing the CMake configure step.
  • Loading branch information
Derek M authored Aug 12, 2019
1 parent 1649dc3 commit f64b89b
Show file tree
Hide file tree
Showing 19 changed files with 153 additions and 20 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ else()

endif()

# Generate .NET Version file.
configure_file(VersionInfo.cs.in ${CMAKE_CURRENT_SOURCE_DIR}/src/csharp/VersionInfo.cs)

set(TARGET_ARCH ${CMAKE_SYSTEM_PROCESSOR})

# CMake doesn't set the target processor correctly for MSVC
Expand Down
15 changes: 11 additions & 4 deletions src/csharp/VersionInfo.cs → VersionInfo.cs.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif

[assembly: AssemblyProduct("@K4A_PRODUCTNAME@")]
[assembly: AssemblyCompany("@K4A_COMPANYNAME@")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyTrademark("")]

[assembly: CLSCompliant(true)]

// This is the shared assembly version file for all of our assemblies.
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("@K4A_VERSION_MAJOR@.@K4A_VERSION_MINOR@.@[email protected]")]
[assembly: AssemblyFileVersion("@VERSION_STR@.@K4A_VERSION_REVISION@")]
[assembly: AssemblyInformationalVersion("@VERSION_STR@.@K4A_VERSION_REVISION@")]
4 changes: 2 additions & 2 deletions src/csharp/.gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## Ignore CMake generated files that enable the CSharp solution to find and interact with the CMake built files.

/k4a.*.props

/StubGenerator.*.json
/StubGenerator.*.xml

/VersionInfo.cs

## Ignore the generated documentation file
/SDK/Microsoft.Azure.Kinect.Sensor.xml
1 change: 0 additions & 1 deletion src/csharp/Examples/WPF/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Azure.Kinect.Sensor.Examples.WPFViewer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyProduct("Microsoft.Azure.Kinect.Sensor.Examples.WPFViewer")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
Expand Down
1 change: 0 additions & 1 deletion src/csharp/Examples/WinForms/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Azure.Kinect.Sensor.Examples.WinForms")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyProduct("Microsoft.Azure.Kinect.Sensor.Examples.WinForms")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
Expand Down
1 change: 0 additions & 1 deletion src/csharp/Extensions/WPF/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Azure.Kinect.Sensor.WPF")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyProduct("Microsoft.Azure.Kinect.Sensor.WPF")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
Expand Down
1 change: 0 additions & 1 deletion src/csharp/Extensions/WinForms/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Azure.Kinect.Sensor.WinForms")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyProduct("Microsoft.Azure.Kinect.Sensor.WinForms")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
Expand Down
2 changes: 2 additions & 0 deletions src/csharp/K4a.sln
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Files", "Solution Files", "{118BF8E1-C662-4852-955F-22DC68BB95CC}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
AzureKinectSensorSDK.ruleset = AzureKinectSensorSDK.ruleset
k4a.props = k4a.props
Microsoft.Azure.Kinect.Sensor.snk = Microsoft.Azure.Kinect.Sensor.snk
stylecop.json = stylecop.json
VersionInfo.cs = VersionInfo.cs
Expand Down
10 changes: 4 additions & 6 deletions src/csharp/SDK/Microsoft.Azure.Kinect.Sensor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DocumentationFile>$(OutputPath)Microsoft.Azure.Kinect.Sensor.xml</DocumentationFile>
<Description>Microsoft Azure Kinect Sensor SDK</Description>
<Company>Microsoft</Company>
<Copyright>Copyright (c) Microsoft Corporation. All rights reserved.</Copyright>
<PackageLicenseExpression>Licensed under the MIT License.</PackageLicenseExpression>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\Microsoft.Azure.Kinect.Sensor.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
Expand All @@ -28,6 +22,10 @@
<Link>stylecop.json</Link>
</AdditionalFiles>
</ItemGroup>

<ItemGroup>
<Compile Include="..\VersionInfo.cs" Link="Properties\VersionInfo.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.4">
Expand Down
18 changes: 16 additions & 2 deletions src/csharp/SDK/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
// Licensed under the MIT License.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
using System.Runtime.InteropServices;

[assembly: CLSCompliant(true)]
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Azure.Kinect.Sensor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("28E47B37-B205-4353-92B1-1345C47CD710")]
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
</AdditionalFiles>
</ItemGroup>

<ItemGroup>
<Compile Include="..\..\VersionInfo.cs" Link="Properties\VersionInfo.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.4">
<PrivateAssets>all</PrivateAssets>
Expand Down
23 changes: 23 additions & 0 deletions src/csharp/Tests/FunctionalTests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// </copyright>
//------------------------------------------------------------------------------
using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Azure.Kinect.Sensor.FunctionalTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ebf80b3b-83a1-4369-954b-922d8ee5e9cc")]
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
</AdditionalFiles>
</ItemGroup>

<ItemGroup>
<Compile Include="..\..\VersionInfo.cs" Link="Properties\VersionInfo.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.4">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// </copyright>
//------------------------------------------------------------------------------
using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Azure.Kinect.Sensor.Test.StubGenerator.UnitTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("151f9524-9cf0-419d-81b7-cf2d52f90ee5")]
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
</AdditionalFiles>
</ItemGroup>

<ItemGroup>
<Compile Include="..\..\VersionInfo.cs" Link="Properties\VersionInfo.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.4">
<PrivateAssets>all</PrivateAssets>
Expand Down
23 changes: 23 additions & 0 deletions src/csharp/Tests/StubGenerator/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// </copyright>
//------------------------------------------------------------------------------
using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Azure.Kinect.Sensor.Test.StubGenerator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("44795fa0-9b17-40fb-8c8b-f77d754970c8")]
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
</AdditionalFiles>
</ItemGroup>

<ItemGroup>
<Compile Include="..\..\VersionInfo.cs" Link="Properties\VersionInfo.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.4">
<PrivateAssets>all</PrivateAssets>
Expand Down
23 changes: 23 additions & 0 deletions src/csharp/Tests/UnitTests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// </copyright>
//------------------------------------------------------------------------------
using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Azure.Kinect.Sensor.UnitTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9a8ec674-aad4-486b-b747-d53989bc8f89")]
9 changes: 7 additions & 2 deletions src/csharp/k4a.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@
<BaseIntermediateOutputPath>$(K4aBinaryDirectory)\obj\</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)\$(Configuration)\$(Platform)\$(AssemblyName)\</IntermediateOutputPath>-->
</PropertyGroup>

<PropertyGroup Condition="'$(BaseOutputPath)' == ''">
<!-- This should happen if we failed to find the Azure Kinect properties file for the given platform.
This will also happen if the platform is AnyCPU and the output path wasn't included. -->
This will also happen if the platform is AnyCPU and the output path wasn't included. -->
<BaseOutputPath>$(MSBuildThisFileDirectory)\Build\$(Configuration)\$(Platform)\</BaseOutputPath>
</PropertyGroup>

<PropertyGroup>
<!-- Prevent .NET Core and .NET Standard projects from generating assembly info from the project.-->
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
</Project>

0 comments on commit f64b89b

Please sign in to comment.