gpt4 book ai didi

xamarin - 如何以编程方式检索 Visual Studio for Mac 的版本信息?

转载 作者:行者123 更新时间:2023-12-05 01:41:32 24 4
gpt4 key购买 nike

我想在 Xamarin 应用程序的构建作业期间检索 Visual Studio for Mac 的版本信息。目标是将它们作为调试信息包含在二进制文件中。有没有办法以编程方式或使用 msbuild 的命令语句获取 Visual Studio、Xamarin.iOS 和 Xamarin.Android 的版本号?

手动可以获取以下信息:Visual Studio > 关于 Visual Studio > 显示详细信息 > 复制信息 [按钮]

=== Visual Studio Community 2017 for Mac ===

Version 7.6.11 (build 9)
Installation UUID: f7e73512-ad50-4119-a682-e2cf05031ad6
Runtime:
Mono 5.12.0.309 (2018-02/39d89a335c8) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 4.4.1.178 (master / eeaeb7e6)

Package version: 512000309

=== NuGet ===

Version: 4.3.1.4445

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
2.1.2
2.1.1
2.0.5
2.0.4
SDK: /usr/local/share/dotnet/sdk/2.1.302/Sdks
SDK Versions:
2.1.302
2.1.301
2.1.4
2.1.3
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.12.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.6.3
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Xamarin.Android ===

Version: 9.0.0.20 (Visual Studio Community)
Android SDK: /Users/christopher/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
4.0.3 (API level 15)
4.1 (API level 16)
4.2 (API level 17)
4.4 (API level 19)
5.0 (API level 21)
5.1 (API level 22)
6.0 (API level 23)
7.0 (API level 24)
7.1 (API level 25)
8.0 (API level 26)
8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 28.0.1
SDK Build Tools Version: 27.0.3

Java SDK: /usr
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Apple Developer Tools ===

Xcode 10.1 (14460.46)
Build 10B61

=== Xamarin.Mac ===

Version: 5.0.0.0 (Visual Studio Community)
Hash: b40230c0
Branch:
Build date: 2018-09-27 11:41:37-0400

=== Xamarin.iOS ===

Version: 12.2.1.10 (Visual Studio Community)
Hash: f2a05edd
Branch: d15-9
Build date: 2018-10-31 18:55:57-0400

=== Xamarin Inspector ===

Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 706110009
Git revision: d7cd66f5e3acd3d46ba0b94a0c935378f828bde0
Build date: 2018-10-31 17:17:12+00
Build branch: release-7.6
Xamarin extensions: bc9b985bfcb480b04a208a6d4045adc443a07857

=== Operating System ===

Mac OS X 10.13.6
Darwin 17.7.0 Darwin Kernel Version 17.7.0
Thu Jun 21 22:53:14 PDT 2018
root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64

最佳答案

这是我的一个 Global.cs 的简化版本,其中包含在构建期间获得的版本信息:

全局模板

namespace SomeVersionInfo
{
public static class Globals
{
public const string VS4MVersion = "SushiVS4MVersion";
public const string XiOSVersion = "SushiXiOSVersion";
public const string XDroidVersion = "SushiXDroidVersion";
}
}

macOS Bash 文件

VS4MVersion=`/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' /Applications/Visual\ Studio\ \(Preview\).app/Contents/Info.plist`
XDroidVersion=$(< /Library/Frameworks/Xamarin.Android.framework/Versions/Current/version)
XiOSVersion=$(< /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/Version)

sed -e 's/SushiVS4MVersion/'"$VS4MVersion"'/g' Global.template > Global.cs
sed -i '' -e "s/SushiXiOSVersion/$XiOSVersion/g" Global.cs
sed -i '' -e "s/SushiXDroidVersion/$XDroidVersion/g" Global.cs

结果:

namespace SomeVersionInfo
{
public static class Globals
{
public const string VS4MVersion = "8.0.0.869";
public const string XDroidVersion = "9.1.5";
public const string XiOSVersion = "12.2.1.13";
}
}

关于xamarin - 如何以编程方式检索 Visual Studio for Mac 的版本信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54288683/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com