Build SharpView EXE from Linux
noraj opened this issue · 1 comments
noraj commented
Context
One may not want to install a Windows VM + install Visual Studio just to build a tool. So I tried to build SharpView exe with Mono, MSBuild, .NET SDk, and NuGet on Linux.
Prerequisites
On ArchLinux:
$ pacman -S mono-msbuild dotnet-sdk nuget
$ pikaur -S mono-git
Version
- mono 6.13.0
- msbuild 16.10.1.xamarinxplat.2021.05.26.14.00
- dotnet sdk 6.0.0.sdk100
- nuget 5.10.0
Build steps
$ git clone https://github.com/tevora-threat/SharpView.git
$ cd SharpView
$ nuget restore
$ msbuild SharpView.sln
Microsoft (R) Build Engine version 16.10.1 for Mono
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
Build started 12/22/2021 5:42:03 PM.
Project "/tmp/SharpView/SharpView.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
Project "/tmp/SharpView/SharpView.sln" (1) is building "/tmp/SharpView/SharpView/SharpView.csproj" (2) on node 1 (default targets).
PrepareForBuild:
Creating directory "bin/Debug/".
Creating directory "obj/Debug/".
ResolveAssemblyReferences:
Primary reference "System.DirectoryServices.AccountManagement".
/usr/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(2218,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.DirectoryServices.AccountManagement". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/tmp/SharpView/SharpView/SharpView.csproj]
For SearchPath "{TargetFrameworkDirectory}".
Considered "/usr/lib/mono/xbuild-frameworks/.NETFramework/v4.5.2/System.DirectoryServices.AccountManagement.winmd", but it didn't exist.
Considered "/usr/lib/mono/xbuild-frameworks/.NETFramework/v4.5.2/System.DirectoryServices.AccountManagement.dll", but it didn't exist.
Considered "/usr/lib/mono/xbuild-frameworks/.NETFramework/v4.5.2/System.DirectoryServices.AccountManagement.exe", but it didn't exist.
Considered "/usr/lib/mono/4.5.2-api/System.DirectoryServices.AccountManagement.winmd", but it didn't exist.
Considered "/usr/lib/mono/4.5.2-api/System.DirectoryServices.AccountManagement.dll", but it didn't exist.
Considered "/usr/lib/mono/4.5.2-api/System.DirectoryServices.AccountManagement.exe", but it didn't exist.
Considered "/usr/lib/mono/4.5.2-api/Facades/System.DirectoryServices.AccountManagement.winmd", but it didn't exist.
Considered "/usr/lib/mono/4.5.2-api/Facades/System.DirectoryServices.AccountManagement.dll", but it didn't exist.
Considered "/usr/lib/mono/4.5.2-api/Facades/System.DirectoryServices.AccountManagement.exe", but it didn't exist.
Considered "/usr/lib/mono/4.5.2-api/Facades/System.DirectoryServices.AccountManagement.winmd", but it didn't exist.
Considered "/usr/lib/mono/4.5.2-api/Facades/System.DirectoryServices.AccountManagement.dll", but it didn't exist.
Considered "/usr/lib/mono/4.5.2-api/Facades/System.DirectoryServices.AccountManagement.exe", but it didn't exist.
For SearchPath "{GAC}".
Considered "System.DirectoryServices.AccountManagement", which was not found in the GAC.
For SearchPath "{RawFileName}".
Considered treating "System.DirectoryServices.AccountManagement" as a file name, but it didn't exist.
For SearchPath "bin/Debug/".
Considered "bin/Debug/System.DirectoryServices.AccountManagement.winmd", but it didn't exist.
Considered "bin/Debug/System.DirectoryServices.AccountManagement.dll", but it didn't exist.
Considered "bin/Debug/System.DirectoryServices.AccountManagement.exe", but it didn't exist.
GenerateBindingRedirects:
No suggested binding redirects from ResolveAssemblyReferences.
/usr/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(2842,5): warning MSB3084: Task attempted to find "AxImp.exe" in two locations. 1) Under the "/usr/lib/mono/4.5/" processor specific directory which is generated based on SdkToolsPath 2) The x86 specific directory under "/usr/lib/mono/4.5/" which is specified by the SDKToolsPath property. You may be able to solve the problem by doing one of the following: 1) Set the "SDKToolsPath" property to the location of the Microsoft Windows SDK. [/tmp/SharpView/SharpView/SharpView.csproj]
/usr/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(2842,5): error MSB3086: Task could not find "AxImp.exe" using the SdkToolsPath "/usr/lib/mono/4.5/" or the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\NETFXSDK\4.8\WinSDK-NetFx40Tools-x86". Make sure the SdkToolsPath is set and the tool exists in the correct processor specific location under the SdkToolsPath and that the Microsoft Windows SDK is installed [/tmp/SharpView/SharpView/SharpView.csproj]
Done Building Project "/tmp/SharpView/SharpView/SharpView.csproj" (default targets) -- FAILED.
Done Building Project "/tmp/SharpView/SharpView.sln" (default targets) -- FAILED.
Build FAILED.
"/tmp/SharpView/SharpView.sln" (default target) (1) ->
"/tmp/SharpView/SharpView/SharpView.csproj" (default target) (2) ->
(ResolveAssemblyReferences target) ->
/usr/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(2218,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.DirectoryServices.AccountManagement". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/tmp/SharpView/SharpView/SharpView.csproj]
"/tmp/SharpView/SharpView.sln" (default target) (1) ->
"/tmp/SharpView/SharpView/SharpView.csproj" (default target) (2) ->
(ResolveComReferences target) ->
/usr/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(2842,5): warning MSB3084: Task attempted to find "AxImp.exe" in two locations. 1) Under the "/usr/lib/mono/4.5/" processor specific directory which is generated based on SdkToolsPath 2) The x86 specific directory under "/usr/lib/mono/4.5/" which is specified by the SDKToolsPath property. You may be able to solve the problem by doing one of the following: 1) Set the "SDKToolsPath" property to the location of the Microsoft Windows SDK. [/tmp/SharpView/SharpView/SharpView.csproj]
"/tmp/SharpView/SharpView.sln" (default target) (1) ->
"/tmp/SharpView/SharpView/SharpView.csproj" (default target) (2) ->
(ResolveComReferences target) ->
/usr/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(2842,5): error MSB3086: Task could not find "AxImp.exe" using the SdkToolsPath "/usr/lib/mono/4.5/" or the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\NETFXSDK\4.8\WinSDK-NetFx40Tools-x86". Make sure the SdkToolsPath is set and the tool exists in the correct processor specific location under the SdkToolsPath and that the Microsoft Windows SDK is installed [/tmp/SharpView/SharpView/SharpView.csproj]
2 Warning(s)
1 Error(s)
Time Elapsed 00:00:01.26
Question
How to build SharpView exe from Linux?
noraj commented
Seems related to https://bugs.archlinux.org/task/71007 Updated to mono 6.13.0