简体   繁体   中英

How can I change a C# .net framework project to a .net core 3.0 project? [on hold]

I am developing a game in UE4 and I'm using the USharp plugin so that I can program in C#. The USharp compiler automatically made a.sln project for me but it made it in the .net Framework, I have no capabilities WHATSOEVER to download any .net Frameworks, but I am, however, able to download .net cores. So going back to my main question, how can I change the projects.csproj be compatible with .net core instead of .net framework? https://gist.github.com/rubiksmaster02/f4c9fcb9c9922fd20d2d58b14f31abc1 this is the contents of the.csproj that USharp automatically created. I changed it to https://gist.github.com/rubiksmaster02/b4cb302a049100bc078b07c2942d43ca but it says invalid configuration.

You need to switch to the new SDK project style to use net core rather than net framework. Most of the stuff that has been auto-generated in your project file is default stuff, so just start with a rough default SDK project file and expand from there.
Eg:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>Exe</OutputType>     
        <TargetFramework>netcoreapp3.0</TargetFramework>
   </PropertyGroup>
</Project>

This assumes that your project is an app that you'd like to build with net core 3.0. Obviously you'll need to fine-tune it to what you're planning.
If your project is just a code library that is called by other libraries or apps then get rid of the output type property and change Target framework to specify "netstandard2.1" rather than "netcoreapp3.0".
Note: SDK project files have no need for explicit file inclusion. They just find all the files with the correct extensions (eg *.cs) in the associated folders and sub-folders.

You'll probably get one or two small build errors and you just need to fix them up to match whatever was previously auto-generated.

Alternative option: Try this link for quick project migration.

I found this link and it works https://github.com/hvanbakel/CsprojToVs2017

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM