我在https://github.com/PandaWood/Simple-MAPI.NET
有一个项目我一直使用 Build |创建Nuget包 - 总是有效 - 创建一个nuget包。
我在Visual Studio for 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
答案 0 :(得分:2)
问题是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')" />