询问者
web1项目用nuget打包,引用到web2项目,views等文件没有复制到web2项目目录下,调试提示找不到视图

问题
-
如题,Web1项目打包成nupkg,引用到web2项目,项目中会自动添加Views等文件,但是这些文件存储在.nuget/包目录下,没有放在项目目录,调试时会提示找不到视图文件。
该问题应怎样处理?~~~~~
- 已移动 Wendy ZangMicrosoft contingent staff 2017年3月27日 8:19
全部回复
-
Hi,
感谢你在MSDN论坛发帖。
因为你的问题涉及到VS的一般使用问题,我将把这个帖子移到vs一般讨论论坛.
Best Regards,
Hart
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
-
Hi,
这是因为在dotnetcore的项目中,NuGet的包不适用于文件共享。NuGet项目组并没有打算在dotnetcore的项目中去支持这个功能。如果你想要实现文件共享, 你可以将文件嵌入到程序集中或使用Bower。你可以从下面的链接中参考更多详细的信息。
https://github.com/NuGet/Home/issues/2262
Best Regards,
Leo
MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
- 已编辑 Leo Liu-MSFTMicrosoft contingent staff 2017年3月28日 5:00
-
Hi,
感谢你的回复.
>>>1.新版本的nuget会解决此问题;
在我提供的链接中,NuGet 项目组暂时还没有支持这个功能的打算。据我所知,最新版本的NuGet还没有支持,你可以关注NuGet后续版本的更新。
>>>2.通过脚本实现拷贝;
我们可以通过Visual Studio 中的Per-build event来实现文件拷贝,在Per-build event Command Line中添加下面的copy命令就可以实现把nuget包里的文件复制到项目目录下
xcopy.exe "$(.NuGetPackagePath)\SubFolder\*.cshtml" "$(ProjectDir)Views\SubFolder" /y /s
Best Regards,
Leo
MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
- 已编辑 Leo Liu-MSFTMicrosoft contingent staff 2017年3月31日 6:19
- 已建议为答案 Jack Zhai-MSFTMicrosoft contingent staff, Moderator 2017年4月3日 7:08