RickStrahl / GistIntegration-MarkdownMonster-Addin

Markdown Monster addin to create embeddable Gists for Markdown documents, and to load and save documents from Gists.
https://markdownmonster.west-wind.com
18 stars 7 forks source link

Errors building Visual Studio solution due to .NET 4.7.2 upgrade #6

Closed jeremy-jameson closed 4 years ago

jeremy-jameson commented 4 years ago

Markdown Monster was recently upgraded to .NET Framework 4.7.2 -- but the Gist Integration add-in projects are still configured for .NET Framework 4.6.2. Consequently, after cloning the repo and building the solution in Visual Studio, the build fails.

The output contains warnings similar to the following (trimmed for readability):

warning MSB3274: The primary reference "MahApps.Metro" could not be resolved because it was built against the ".NETFramework,Version=v4.7" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.6.2".

Ultimately, the build fails due to the following error:

error MC3074: The tag 'MetroWindow' does not exist in XML namespace 'http://metro.mahapps.com/winfx/xaml/controls'. Line 1 Position 24.

jeremy-jameson commented 4 years ago

Note that after changing the add-in projects to target .NET Framework 4.7.2, a new error occurs when building GistIntegrationAddinTests.csproj:

error CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)

In addition, the following warnings are reported:

  • warning MSB3245: Could not resolve this reference. Could not locate the assembly "Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
  • warning MSB3277: Found conflicts between different versions of "Newtonsoft.Json" that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.

This appears to be due to the fact that GistIntegrationAddin.csproj references the following location:

  <HintPath>$(LocalAppData)\Markdown Monster\Newtonsoft.Json.dll</HintPath>

...but GistIntegrationAddinTests.csproj references the assembly from the NuGet package:

  <HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
RickStrahl commented 4 years ago

This has been addressed with PR #7

FWIW, I removed the nuget package and pointed back to the installed MarkdownMonster dll instead as all the other references do.