在Visual Studio 2022中的邮政构建事件中读取汇编版本针对NetStandard2 .0
我在NetStandard 2.0中有一个项目,我使用后构建事件来创建Nuget软件包,并将其自动推向我的feed,这是在用于.netFramework上的。我知道,使用NetStandard和NetCore,我可以自动通过软件包函数创建它们,但这不是一个选项,因为我覆盖了汇编属性以自动增加我的版本号。
无论如何,我找到了一种解决方案,该解决方案在2019年的Visual Studio 2019中,具有.netframework 4.8的运行良好,但是对于Visual Studio 2022的NetStandard来说,此宏不起作用。
<Target Name="PostBuildMacros">
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
<Output TaskParameter="Assemblies" ItemName="Targets" />
</GetAssemblyIdentity>
<ItemGroup>
<VersionNumber Include="@(Targets->'%(Version)')" />
</ItemGroup>
</Target>
有人知道为什么不工作吗?是否有用于Netcore或Netstadard的替代解决方案?
感谢您的评论
PS:版本编号增量正在正常工作,我在构建文件夹中仔细检查。
I have a project in netstandard 2.0 and I use post build events to create a nuget package and to push it automatically to my feed, that was working on .NetFramework. I know that with netstandard and netcore I can create them through the package function automatically but this is not an option because I override the assembly properties to increase automatically my version number.
Anyway I found a solution that in Visual Studio 2019 with .NetFramework 4.8 was working perfectly, nevertheless for Visual Studio 2022 with netStandard this macro does not work.
<Target Name="PostBuildMacros">
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
<Output TaskParameter="Assemblies" ItemName="Targets" />
</GetAssemblyIdentity>
<ItemGroup>
<VersionNumber Include="@(Targets->'%(Version)')" />
</ItemGroup>
</Target>
Does anyone have an idea why is not working? is there an alternative solution used for netcore or netstadard?
I appreciate your comments
PS: The version number increment is working, I double checked in the build folders.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在尝试和错误之后,我发现属性依赖属性=“ postuildmacros”缺少,以下后构建事件解决了我的问题:
避免编译错误替换“ yoursourCename”和“ yourskey”和“ yourkey”,然后用您的存储库数据
After try and error i found that the attribute DependsOnTargets="PostBuildMacros" was missing, the following post build event solved my problem:
to avoid compiling errors replace "YourSourceName" and "YourKey" with your repository data