dimonovdd / MSBuild.CompactJsonResources

Compact Json data by removing whitespaces before building

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compatibility issue with Visual Studio

ruby3141 opened this issue · comments

commented

Summery

  • The MSBuild on Visual Studio, which runs on .NET Framework, cannot load .NET Standard 2.1 targetted library.
  • To fix this issue, this library should target .NET Standard 2.0 or below.

Explanation

Using this library on Visual Studio produces following error;

MSB4062: The "MSBuild.CompactJsonResources.CompactJsonTask" task could not be loaded from the assembly C:\Users\{User Name}\.nuget\packages\msbuild.compactjsonresources\1.0.2\buildTransitive\MSBuild.CompactJsonResources.dll. Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

From https://learn.microsoft.com/en-us/visualstudio/msbuild/tutorial-custom-task-code-generation?view=vs-2022,

if you want to share code between .NET Framework and any other .NET implementation, such as .NET Core, your library should target .NET Standard 2.0, and you want to run inside Visual Studio, which runs on the .NET Framework. .NET Framework doesn't support .NET Standard 2.1.