更新:
似乎也将dotnet build -v d
设置为详细时,就会(显然)揭示有关此过程的更多细节
原始:
引用:https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets
我正在使用dotnet build
,我的csproj如下:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageOutputPath>..\packages\</PackageOutputPath>
<AssemblyVersion>0.1.0</AssemblyVersion>
</PropertyGroup>
<Target Name="CopyPackage" AfterTargets="Pack">
<Copy
SourceFiles="$(OutputPath)..\$(PackageId).$(PackageVersion).nupkg"
DestinationFolder="%USERPROFILE%\.nuget\packages"
/>
</Target>
<Target Name="AfterPackMessage" AfterTargets="Pack">
<Message Text="Copied $(OutputPath)..\$(PackageId).$(PackageVersion).nupkg TO %USERPROFILE%\.nuget\packages" />
</Target>
</Project>
我只看到此输出
C:\code\MySolution.net\MyProject.Core (feature-mediator-http)
λ dotnet build
Microsoft (R) Build Engine version 15.8.169+g1ccb72aefa for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 70.34 ms for C:\code\MySolution.net\MyProject.Core\MyProject.Core.csproj.
MyProject.Core -> C:\code\MySolution.net\MyProject.Core\bin\Debug\netstandard2.0\MyProject.Core.dll
Successfully created package 'C:\code\MySolution.net\packages\MyProject.Core.1.0.0.nupkg'.
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:03.68
这里有两个问题:
1)那些Target
似乎没有执行
2)AssemblyVersion
似乎没有得到应用
dotnet pack
或nuget pack
似乎没什么作用