Reputation: 3802
Having installed VS2013 RC and previously the preview, MS seem to have created a situation where the integration of blend causes an old version of newtonsoft.json to end up high up in the search path during build. Causing this type of error
The type 'Newtonsoft.Json.Linq.JObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'Newtonsoft.Json, Version=3.5.0.2, Culture=neutral, PublicKeyToken=null'.
I've been renaming :
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Blend\Newtonsoft.Json.dll
which works, as does nuking these reg keys:
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\Expression Blend MWD.Extensibility]
@="C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Blend\\"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\Expression Blend MWD.Interaction]
@="C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Blend\\"
However there must be a better way? Surely dependencies not in the gac shouldn't be being found in the VS binary directories over our own target output ones?
Upvotes: 5
Views: 1954
Reputation: 423
I had simelar problem with VS2013, Professional release version.
VS looks in the blend directory for json dll when considering references even though HintPath is specified.
Workaround could be to delete or renamne the Json dll in the blend directory, i'm not a intensive user of blend, but process monitor detect no usage of Json dll while blend is loading... and when no json dll is available in the blend directory the refrence work as expected, at least in my case..
Upvotes: 1
Reputation: 3802
The problem seems local to a slightly esoteric build process at my current employer, where the referenced libraries are stored in the build output folder (via maven). This has very low precedence in the search process hence the problem in the question.
Solution, don't put your references in the output folder. Its not just this is screws up!
Upvotes: 0
Reputation: 41718
Use NuGet to install Newtonsoft.Json. This will cause something like the following to be added to your project file:
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
The HintPath
will take precedence over the other search paths.
Upvotes: 2