从MSBuild中的AssemblyInfo访问版本
我正试图通过VisualStudio构建过程创建/推送nuget包,如前所述 构建包很简单:从MSBuild中的AssemblyInfo访问版本,msbuild,nuget-package,assemblyinfo,Msbuild,Nuget Package,Assemblyinfo,我正试图通过VisualStudio构建过程创建/推送nuget包,如前所述 构建包很简单: <Exec WorkingDirectory="$(ProjectDir)" Command="$(NuGetApp) pack $(ProjectFile) -OutputDirectory $(Deploy) -Verbose -Prop Configuration=Release"/> 我在$(Deploy)文件夹中看到了.nupkg文件 但是为了能够推送它,我需要$(Assem
<Exec WorkingDirectory="$(ProjectDir)" Command="$(NuGetApp) pack $(ProjectFile) -OutputDirectory $(Deploy) -Verbose -Prop Configuration=Release"/>
我在$(Deploy)文件夹中看到了.nupkg文件
但是为了能够推送它,我需要$(AssemblyVersion)将其用于:
<Exec Command="$(NuGetApp) push $(ProjectName)$(AssemblyVersion) -s $(NugetServer) $(NugetKey)" />
我尝试XMLRead获取该值,但NugetSpecFile中的值是“$version$”而不是AssemblyInfo.cs中的版本
<XmlRead XPath="/package/metadata/version" XmlFileName="$(NuSpecFile)">
<Output TaskParameter="Value" PropertyName="AssemblyVersion" />
</XmlRead>
如何访问版本以便在“nuget push”中使用它?我将这样做:
<PropertyGroup>
<MyAssemblies>somedll\the.dll</MyAssemblies>
</PropertyGroup>
<Target Name="RetrieveIdentities">
<GetAssemblyIdentity
AssemblyFiles="$(MyAssemblies)">
<Output
TaskParameter="Assemblies"
ItemName="MyAssemblyIdentities"/>
</GetAssemblyIdentity>
<Message Text="Files: %(MyAssemblyIdentities.Version)"/>
</Target>
somedll\the.dll
从此处更改: