14

I tried copying the source code from the internet directly and I couldn't build/debug the whole file because of the error found below.

Please Help

Error occurred while restoring NuGet packages: System.ArgumentException: The path is not                         of a legal form. at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength,Boolean expandShortPaths)
at System.IO.Path.GetDirectoryName(String path)
at NuGet.VisualStudio.VsUtility.GetNuGetSolutionFolder(Solution solution)
at NuGet.VsEvents.PackageRestorer.UsingOldPackageRestore(Solution solution)
at NuGet.VsEvents.PackageRestorer.BuildEvents_OnBuildBegin(vsBuildScope Scope,   vsBuildAction Action).


1>------ Build started: Project: LaserRange, Configuration: Debug Win32 ------
1>C:\Program Files   (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(369,5): error MSB8031: Building an MFC project for a non-Unicode character set is deprecated. You must change the project property to Unicode or download an additional library. See http://go.microsoft.com/fwlink/p/?LinkId=286820 for more information.

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========}

user3236892
  • 163
  • 1
  • 1
  • 4
  • 3
    The end of it is telling you the exact problem: "Building an MFC project for a non-Unicode character set is deprecated. You must change the project property to Unicode or download an additional library. See http://go.microsoft.com/fwlink/p/?LinkId=286820 for more information." – Jerry Coffin Jan 26 '14 at 06:31
  • Configuration problem. – rockinfresh Jan 26 '14 at 10:58

4 Answers4

21

Question : Where do I "change the project property to Unicode"?

Answer :

For C++,

Right Click the project, and select properties, ( or Alt-Enter ) Property Pages should open

Under Configuration Properties

General

[-]Project Defaults

  **Character Set** : Use Multi-Byte Character Set

- Change to -

  **Character Set** : Use Unicode Character Set

Pain in the butt to find it.

Joe B
  • 692
  • 8
  • 18
19

right click your solution, go to properties and set the project properties to use Unicode instead.

rockinfresh
  • 2,068
  • 4
  • 28
  • 46
  • 3
    how *exactly* is this done? sounds simple enough but i don't see this option when i right click the solution and goto properties in visual studio 2013 – user391339 Feb 21 '15 at 05:19
  • 4
    general->project default->character set. However, I think the working solution is install add-on as mentioned by @thoma, especially when you are using code from existing projects. – mrmoment Mar 09 '15 at 13:16
  • For VS2013, right click the Project, not the Solution. The answer here says to right click the Solution... maybe that works in some other versions of VS. – Marty Jun 20 '18 at 13:57
14

you need to install MFC MBCS DLL Add-on As mentioned in your error. See the below link http://msdn.microsoft.com/library/dn251007.aspx

thoma
  • 181
  • 1
  • 7
  • 2
    This is much more failproof than the marked solution. If you rely on a Multi-Byte dependency it will get ugly as soon as you change your dependency to Unicode. At least when you are leafing the overlapping character space. – terman Jul 16 '15 at 06:51
1

I encountered the same issue while building solution in Visual Studio and it got resolved when installed below components:

  • MFC for C++
  • Common tools for C++
  • Windows 8.1 SDK and universal CRT SDK
Pooja S
  • 11
  • 2