Code:
if $(ConfigurationName) == Release (
cd $(ProjectDir)
nuget spec Entities -f
nuget pack DeusPak.Entities.csproj -Prop Configuration=Release
nuget push DeusPak.Entities.$(version).nupkg $(MYGET_API_KEY) -Source http://www.myget.org/F/lojaali/api/v2/package
)
我刚刚开始使用 NuGet,想知道如何将版本号包含在我的 NuGet 包中。我目前正在将其硬编码到构建后事件中,这显然不是我想要继续做的事情。有人可以帮忙吗?
这是我当前的构建后活动:
if $(ConfigurationName) == Release (
cd $(ProjectDir)
nuget spec Dev-f
nuget pack Dev.csproj -Prop Configuration=Release
nuget push Dev.1.0.0.0.nupkg $(MYGET_API_KEY) -Source http://www.myget.org/F/api/v2/package
)
Update:
好的,我已经成功地使用正确的自动递增版本号构建了 DLL:
if $(ConfigurationName) == Release (
cd $(ProjectDir)
nuget spec Dev -f
nuget pack Dev.csproj -Prop Configuration=Release
nuget push Dev.$(version).nupkg $(MYGET_API_KEY) -Source http://www.myget.org/F/api/v2/package
)
但这个版本没有显示在我的 MyGet 软件包列表中。我如何让它显示在那里以便可以下载?或者只能通过单击“添加包”手动完成?
只是稍微扩展了 Carlos J López 提供的解决方案,我使用 AfterBuild 脚本实际调用 NuGet 并提供版本参数。
就我而言,我还在构建后事件中添加了“cd $(ProjectDir)”,该事件实际上发生在 AfterBuild 脚本之前。
Cheers,
<Target Name="AfterBuild" Condition="'$(Configuration)' == 'Release'">
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
<Output TaskParameter="Assemblies" ItemName="AssemblyVersion" />
</GetAssemblyIdentity>
<Exec Command="$(SolutionDir)\.nuget\nuget pack $(ProjectName).nuspec -Version %(AssemblyVersion.Version)" />
<Message Text="$(SolutionDir)\.nuget\nuget pack $(ProjectName).nuspec -Version %(AssemblyVersion.Version)" Importance="high" />
</Target>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)