1

So I'm new to .NET and am working on a command line app. I need to test out passing arguments, which I suppose is impossible to do within Visual Studio. So when I go to OS X terminal and go to project folder and run dotnet run, it throws this error:

error MSB3644: The reference assemblies for .NETFramework,Version=v4.7.2 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks.

Why on earth is it trying to use .NET framework? That is not available on Mac anyway. It should be using .NET core. Somehow it runs in Visual Studio debug mode, but in command line it keeps trying to run it in .NET framework. This needs to be a cross platform command line app so it has to be .NET core. How do I test my app's command line argument input?

4
  • You are probably using a NuGet package which has a .Net Framework dependency. You can search for 4.7.2 in your project files for more info.
    – JoelFan
    Commented Dec 11, 2020 at 18:55
  • @JoelFan I had EPPlus and IronPython installed through NuGet. I deleted them and still have the problem. In packages.config I found <package id="DynamicLanguageRuntime" version="1.3.0" targetFramework="net472" /> <package id="System.ComponentModel.Annotations" version="5.0.0" targetFramework="net472" /> Why is the built in Dynamic Runtime using 4.72 if this is a .NET core app on a Mac that can't even run that? How is the debugger within Visual Studio even working at all? Is it safe to delete those packages since I didn't install them and they seem like they're built in? Commented Dec 11, 2020 at 19:05
  • 1
    A .NET Core project won't use packages.config, so I wonder how exactly you created this project.
    – Lex Li
    Commented Dec 11, 2020 at 20:03
  • @SuperJayRay, can you save your code, then go into a new folder and re-create the solution from scratch? Then copy in your code files as needed (C# files only... don't copy any project, config or sln files from your old copy). Pay close attention to what you're selecting when you create the new solution and projects.
    – JoelFan
    Commented Dec 11, 2020 at 21:50

1 Answer 1

0

Your project has a reference to .NET Framework v4.7 which is incompatible on the OS you are running. You either have to migrate you project which is written in v4.7 to .NET standard Library or .net core class library. Then refer the same from your .net core app and run your app on any environment.

Not the answer you're looking for? Browse other questions tagged or ask your own question.