Add Plugin DLL in MVC 4 Website after publish

牧云@^-^@ 提交于 2019-12-25 09:34:10

问题


I need to use external DLL not referenced in my main project. I've made some tests and it's working but now, I need to do it automatically.

So, in my "Post Build" event of my main web project, I put this :

Call c:\mybat.bat  $(SolutionDir) $(TargetName) $(Configuration)

And in c:\mybat.bat, I've this :

set solution=%~1
set target=%~2
set configuration=%~3

set appli=Project1
rem : MSBuild...
cd "%solution%%appli%" && "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MsBuild.exe" "%solution%%appli%\%appli%.csproj" /p:Configuration=%configuration%  /p:Platform="AnyCPU"

rem copy DLL generate by build
xcopy /Y /R "%solution%%appli%\bin\%appli%.dll" "%solution%%target%\bin\%appli%.dll*"
rem copy views...
xcopy /Y /R /S "%solution%%appli%\Views\*.*" "%solution%%target%\Views\"

And it's did the trick.

But, when I publish my website, the DLL 'Project1.dll' is not in my 'website\bin' folder. Only in my Bin project solution.

How can I add my *.dll and my view folder in the publish files ?


回答1:


You have to include those files into your project, as publish copies only files which the msbuild process is aware of (i.e. which have been part of the project itself).

Another option might be to have the msbuild target file updated (by including custom/enhaned targets in your project file).

https://stackoverflow.com/a/1403360/2298807 contains a list of articles which might be used as a starting point for this.



来源:https://stackoverflow.com/questions/27552789/add-plugin-dll-in-mvc-4-website-after-publish

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!