【发布时间】:2016-07-15 18:01:48
【问题描述】:
将 Newtonsoft.Json 升级到 9.0.0 版本并将 ReactJS.Net 包升级到 2.5.0 后,TransformBabel.proj 停止工作:
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="TransformBabel">
<!-- ReactJS.NET - Transpile JavaScript via Babel -->
<UsingTask AssemblyFile="$(OutputPath)\React.MSBuild.dll" TaskName="TransformBabel" />
<Target Name="TransformBabel">
<TransformBabel SourceDir="$(MSBuildProjectDirectory)" />
</Target>
</Project>
返回以下内容:
TransformBabel.proj(6, 3): error MSB4018: The "TransformBabel" task failed unexpectedly.
[Exec] TransformBabel.proj(6, 3): error MSB4018: React.TinyIoC.TinyIoCResolutionException: Unable to resolve type: React.IReactSiteConfiguration ---> System.TypeInitializationException: The type initializer for 'React.ReactSiteConfiguration' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
似乎无法加载Newtonsoft 6.0.0.0 版本。 web.config 有一个程序集重定向:
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
但我不确定,因为它正在启动一个新的 msbuild 进程,如果它被忽略。我想提示 msbuild 程序集的位置,但直到现在都没有成功。
【问题讨论】:
-
$(OutputPath)上是否存在 Newtonsoft.Json.dll? -
@KMoraz 是的,但不是 6.0.0.0 版本。
-
这就是错误的解释。从源而不是项目输出路径使用 React.MSBuild.dll。见usage
-
@KMoraz 的来源是指 nuget 包文件夹?
-
是的,或者它存在于输出路径之外的任何其他位置。
标签: msbuild reactjs.net