织梦CMS - 轻松建站从此开始!

欧博ABG-会员注册-官网网址

NuGet without cache in VS 2017

时间:2025-07-28 00:06来源: 作者:admin 点击: 8 次
I've tried clearing the local cache as a pre-build event in a project, but that takes place AFTER the nuget restore, so I have to rebuild twice fo

I've tried clearing the local cache as a pre-build event in a project, but that takes place AFTER the nuget restore, so I have to rebuild twice for that solution to work.

Maybe you can try using a "after-build" target to clean the cache?

I mean in a scenario where you have projects from A to G, project A consumes a package called NugetOne. We built the project A and the NugetOne will be added to cache.(C:\Users\xxx\.nuget\packages).

Now we're working in project B which also will consume NugetOne, we want to delete the cache before the restore when building the project in VS. But according to the comments above, this approach failed.

So maybe we can add a target which runs after build to clean the cache. And we can add the target to project A or project B to get similar result:

If we add it to A: After building A successfully, the cache has been cleaned, then when building B, we have no need to worry about the impact of the cache.

If we add it to B: It works like the pre-build-event you use,have to rebuild twice to make it work.

Not sure if it's what you want, but if you want a development environment in which development won't be affected by cache from other projects.You can consider using a .

My content of Directory.Build.props(Add it to /repos folder, it will impact all your solutions under it, Add it to solution and it will impact all projects in this solution):

<Project> <Target AfterTargets="build"> <Message Importance="High" Text="Clean the cache..."/> <xxx //Do your clean cache action here! /> </Target> </Project>

Hope it helps in some aspects.

(责任编辑:)
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:
发布者资料
查看详细资料 发送留言 加为好友 用户等级: 注册时间:2025-08-01 05:08 最后登录:2025-08-01 05:08
栏目列表
推荐内容