System.Web.Helpers不被由Visual Studio 2012发布的 [英] System.Web.Helpers not being published by Visual Studio 2012

查看:133
本文介绍了System.Web.Helpers不被由Visual Studio 2012发布的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我完全被这个难住了。我已经通过谷歌堆栈溢出,发现这些想法没有为我工作,我不知道为什么。

I'm totally stumped by this one. The ideas that I've found through google stack overflow don't work for me and I've no idea why.

我们最近升级了项目到Visual Studio 2012和MVC 4 .NET 4.5,现在它将无法正常发布。

We recently upgraded the project to Visual Studio 2012 and MVC 4 with .NET 4.5 and now it won't publish properly.

我们有刚刚在Visual Studio 2012年项目发布,而不升级到MVC4或.NET4.5,而且似乎工作另一个分支,所以我猜它不是一个Visual Studio的问题。只是一些与MVC 4是建立在我们的项目的方式。 MVC 3是通过直接从我们已经在源控件创建(但任何项目外)一个lib文件夹中引用的DLL补充说。 MVC 4通过添加的NuGet

We have another branch that just has the project publishing in Visual Studio 2012 without the upgrade to MVC4 or .NET4.5 and that seems to work, so I'm guessing it isn't a Visual Studio issue. Just something with the way that MVC 4 is set up in our project. MVC 3 was added by referencing the DLLs directly from a lib folder we had created in the source control (but outside of any projects). MVC 4 is added via NuGet.

问题是System.Web.Helpers(其中包括)不会出现在已发布应用程序的bin目录。这意味着,当它被放置在测试服务器上作为缺少DLL它不会运行

The issue is that System.Web.Helpers (amongst others) don't appear in the bin directory of the published application. This means that when it is put on the test server it won't run as the DLL is missing.


  • 我已经设置复制本地为TRUE(实际上,它已经是的,但我转身,如果关闭并重新)。我读的地方,如果文件在GAC存在,它不会不管此设置是什么,它​​不会复制。不过,我检查了,这是不是在GAC中。

  • 我保证,在MVC应用程序引用已被指着的NuGet包文件夹的版本的文件。 (这不是原来的,但我手动编辑的csproj文件,要做到这一点去掉,并readding的包的NuGet没有帮助)

  • 我添加了一个生成后事件来复制相关的文件(不影响发布,虽然他们是在项目的bin目录下)

  • 我试图把一个 _bin_deployableAssemblies 文件夹的地方,按的菲尔哈克的博客,但似乎这个<一个href=\"http://stackoverflow.com/questions/12389368/using-bin-deployableassemblies-with-visual-studio-2012\">doesn't在Visual Studio 2012的工作。

  • 我试图修改的csproj文件(这只是一个MSBuild文件)相关文件复制我,<一个href=\"http://stackoverflow.com/questions/12520115/msbuild-targets-and-visual-studio-2012-issues/12579589#12579589\">as按照该SO回答。但什么都原因,不希望任何工作。

  • I've set Copy Local to be TRUE (actually, it already was, but I turned if off and on again). I also read somewhere that if the file exists in the GAC it won't matter what this setting is, it won't copy. However, I've checked and it isn't in the GAC.
  • I've ensured that the reference in the MVC application was pointing to the version of the file in the NuGet packages folder. (It wasn't originally, but I've manually edited the csproj file to do that as removing and readding the NuGet package didn't help)
  • I've added a post-build event to copy the relevant files (which doesn't affect the publish, although they are in the project's bin directory)
  • I've attempted to put a _bin_deployableAssemblies folder in place, as per Phil Haack's blog, but it seems this doesn't work in Visual Studio 2012.
  • I've tried modifying the csproj file (which is just an MSBuild file) to copy the relevant files for me, as per this SO answer. But for what ever reason that doesn't want to work either.

我已经用完了的东西我可以试试。好吧,我可以随时手动复制文件如一些SO答案建议在其他地方,但失败的目的。

I've run out of things I can try. Well, I can always copy the file manually as some SO answers have suggested elsewhere, but that defeats the purpose.

任何想法?

更新

在要点的东西我试过不为我工作增加了更多的东西上面。

Added more things in the bullet points above for things I've tried that don't work for me.

推荐答案

我已经找到了答案。这是一个黑客位,因为我不能得到的MSBuild copy命令的工作,所以我使用exec命令来获得XCOPY做复制我。

I've found an answer. It is a bit of a hack because I couldn't get the MSBuild copy command to work, so I used the Exec command to get xcopy to do the copying for me.

首先我添加了一个名为 _bin_PublishAssemblies 文件夹到项目,并摆在那里,我需要发布构建过程是不拿起已经装配。

First of all I added a folder called _bin_PublishAssemblies to the project and put in there the assemblies that I need to publish that the build process is not picking up already.

然后我说对的csproj文件的末尾以下内容:

Then I added the following towards the end of the csproj file:

  <Target Name="AfterBuild">
    <Message Text="Build | Copying assemblies to output folder ($(OutputPath))" Importance="high" />
    <Exec Command="ECHO Going to copy from '$(ProjectDir)\_bin_PublishAssemblies'" />
    <Exec Command="xcopy $(ProjectDir)\_bin_PublishAssemblies\* $(OutputPath) /Y" />
  </Target>
  <Target Name="CopyBinFiles" AfterTargets="CopyAllFilesToSingleFolderForPackage" BeforeTargets="MSDeployPublish">
    <Message Text="Deploy | Copying assemblies to output folder ($(_PackageTempDir)\bin\)" Importance="high" />
    <Exec Command="ECHO Going to copy from '$(ProjectDir)\_bin_PublishAssemblies'" />
    <Exec Command="xcopy $(ProjectDir)\_bin_PublishAssemblies\* $(_PackageTempDir)\bin\ /Y" />
  </Target>

这篇关于System.Web.Helpers不被由Visual Studio 2012发布的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆