错误 MSB4057:目标 "Pack" 在项目中不存在 - Visual Studio for Mac
Error MSB4057: The target "Pack" does not exist in the project - Visual Studio for Mac
我在 https://github.com/PandaWood/Simple-MAPI.NET
有一个项目
我一直使用Build |创建 Nuget 包 - 始终有效 - 创建 nuget 包。
我在 Visual Studio 上为 Mac 构建它(使用 Mono)
截至今天(假设 Visual Studio 中的更新导致了此问题)- 我收到上述错误(目标 "Pack" 不存在”)
我认为这是一个错误,因为我没有更改任何代码或配置,因为它有效。
关于如何让它再次工作有什么建议吗?
在这种情况下,这个错误对我来说毫无意义
=== Visual Studio Enterprise 2017 for Mac ===
Version 7.3.3 (build 12)
Runtime:
Mono 5.4.1.7 (2017-06/e66d9abbb27) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Package version: 504010007
=== NuGet ===
Version: 4.3.1.4445
=== .NET Core ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
2.0.0
1.1.2
1.0.5
SDK: /usr/local/share/dotnet/sdk/2.0.0/Sdks
SDK Versions:
2.0.0
1.0.4
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.4.1/lib/mono/msbuild/15.0/bin/Sdks
=== Xamarin.Mac ===
Version: 4.0.0.216 (Visual Studio Enterprise)
=== Build Information ===
Release ID: 703030012
Git revision: b07492f1e48be596bad92dc4b7a3bc2d128ed0f9
Build date: 2018-01-30 13:15:55-05
Xamarin addins: 7c8f967d67207118dd99a1d0cc9c228045b30c5f
Build lane: monodevelop-lion-d15-5
=== Operating System ===
Mac OS X 10.12.6
Darwin 16.7.0 Darwin Kernel Version 16.7.0
Thu Jan 11 22:59:40 PST 2018
root:xnu-3789.73.8~1/RELEASE_X86_64 x86_64
问题是 NuGet.Build.Packaging.props 和 NuGet.Build.Packaging.targets 的导入在您的项目文件中不正确。导入当前指向 src/Mapi/packages
目录。
<Import Project="packages\NuGet.Build.Packaging.0.1.248\build\NuGet.Build.Packaging.props" Condition="Exists('packages\NuGet.Build.Packaging.0.1.248\build\NuGet.Build.Packaging.props')" />
<Import Project="packages\NuGet.Build.Packaging.0.1.248\build\NuGet.Build.Packaging.targets" Condition="Exists('packages\NuGet.Build.Packaging.0.1.248\build\NuGet.Build.Packaging.targets')" />
您的解决方案位于 GitHub 存储库的根目录下,因此包将在那里恢复,而不是在 Mapi 文件夹中。因此,如下更改路径应该可以解决 Pack 目标不可用的问题:
<Import Project="..\..\packages\NuGet.Build.Packaging.0.1.248\build\NuGet.Build.Packaging.props" Condition="Exists('..\..\packages\NuGet.Build.Packaging.0.1.248\build\NuGet.Build.Packaging.props')" />
<Import Project="..\..\packages\NuGet.Build.Packaging.0.1.248\build\NuGet.Build.Packaging.targets" Condition="Exists('..\..\packages\NuGet.Build.Packaging.0.1.248\build\NuGet.Build.Packaging.targets')" />
我在 https://github.com/PandaWood/Simple-MAPI.NET
有一个项目我一直使用Build |创建 Nuget 包 - 始终有效 - 创建 nuget 包。
我在 Visual Studio 上为 Mac 构建它(使用 Mono)
截至今天(假设 Visual Studio 中的更新导致了此问题)- 我收到上述错误(目标 "Pack" 不存在”)
我认为这是一个错误,因为我没有更改任何代码或配置,因为它有效。
关于如何让它再次工作有什么建议吗? 在这种情况下,这个错误对我来说毫无意义
=== Visual Studio Enterprise 2017 for Mac ===
Version 7.3.3 (build 12)
Runtime:
Mono 5.4.1.7 (2017-06/e66d9abbb27) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Package version: 504010007
=== NuGet ===
Version: 4.3.1.4445
=== .NET Core ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
2.0.0
1.1.2
1.0.5
SDK: /usr/local/share/dotnet/sdk/2.0.0/Sdks
SDK Versions:
2.0.0
1.0.4
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.4.1/lib/mono/msbuild/15.0/bin/Sdks
=== Xamarin.Mac ===
Version: 4.0.0.216 (Visual Studio Enterprise)
=== Build Information ===
Release ID: 703030012
Git revision: b07492f1e48be596bad92dc4b7a3bc2d128ed0f9
Build date: 2018-01-30 13:15:55-05
Xamarin addins: 7c8f967d67207118dd99a1d0cc9c228045b30c5f
Build lane: monodevelop-lion-d15-5
=== Operating System ===
Mac OS X 10.12.6
Darwin 16.7.0 Darwin Kernel Version 16.7.0
Thu Jan 11 22:59:40 PST 2018
root:xnu-3789.73.8~1/RELEASE_X86_64 x86_64
问题是 NuGet.Build.Packaging.props 和 NuGet.Build.Packaging.targets 的导入在您的项目文件中不正确。导入当前指向 src/Mapi/packages
目录。
<Import Project="packages\NuGet.Build.Packaging.0.1.248\build\NuGet.Build.Packaging.props" Condition="Exists('packages\NuGet.Build.Packaging.0.1.248\build\NuGet.Build.Packaging.props')" />
<Import Project="packages\NuGet.Build.Packaging.0.1.248\build\NuGet.Build.Packaging.targets" Condition="Exists('packages\NuGet.Build.Packaging.0.1.248\build\NuGet.Build.Packaging.targets')" />
您的解决方案位于 GitHub 存储库的根目录下,因此包将在那里恢复,而不是在 Mapi 文件夹中。因此,如下更改路径应该可以解决 Pack 目标不可用的问题:
<Import Project="..\..\packages\NuGet.Build.Packaging.0.1.248\build\NuGet.Build.Packaging.props" Condition="Exists('..\..\packages\NuGet.Build.Packaging.0.1.248\build\NuGet.Build.Packaging.props')" />
<Import Project="..\..\packages\NuGet.Build.Packaging.0.1.248\build\NuGet.Build.Packaging.targets" Condition="Exists('..\..\packages\NuGet.Build.Packaging.0.1.248\build\NuGet.Build.Packaging.targets')" />