| 912 | } |
| 913 | |
| 914 | void cmVisualStudio10TargetGenerator::WriteSdkStyleProjectFile( |
| 915 | cmGeneratedFileStream& BuildFileStream) |
| 916 | { |
| 917 | if (this->ProjectType != VsProjectType::csproj || |
| 918 | !this->GeneratorTarget->IsDotNetSdkTarget()) { |
| 919 | std::string message = |
| 920 | cmStrCat("The target \"", this->GeneratorTarget->GetName(), |
| 921 | "\" is not eligible for .Net SDK style project."); |
| 922 | this->Makefile->IssueMessage(MessageType::INTERNAL_ERROR, message); |
| 923 | return; |
| 924 | } |
| 925 | |
| 926 | Elem e0(BuildFileStream, "Project"); |
| 927 | e0.Attribute("Sdk", *this->GeneratorTarget->GetProperty("DOTNET_SDK")); |
| 928 | |
| 929 | { |
| 930 | Elem e1(e0, "PropertyGroup"); |
| 931 | this->WriteCommonPropertyGroupGlobals(e1); |
| 932 | |
| 933 | e1.Element("Configurations", cmJoinStrings(this->Configurations, ";", "")); |
| 934 | |
| 935 | e1.Element("EnableDefaultItems", "false"); |
| 936 | // Disable the project upgrade prompt that is displayed the first time a |
| 937 | // project using an older toolset version is opened in a newer version |
| 938 | // of the IDE. |
| 939 | e1.Element("VCProjectUpgraderObjectName", "NoUpgrade"); |
| 940 | e1.Element("ManagedAssembly", "true"); |
| 941 | |
| 942 | cmValue targetFramework = |
| 943 | this->GeneratorTarget->GetProperty("DOTNET_TARGET_FRAMEWORK"); |
| 944 | if (targetFramework) { |
| 945 | if (targetFramework->find(';') != std::string::npos) { |
| 946 | e1.Element("TargetFrameworks", *targetFramework); |
| 947 | } else { |
| 948 | e1.Element("TargetFramework", *targetFramework); |
| 949 | e1.Element("AppendTargetFrameworkToOutputPath", "false"); |
| 950 | } |
| 951 | } else { |
| 952 | e1.Element("TargetFramework", "net5.0"); |
| 953 | e1.Element("AppendTargetFrameworkToOutputPath", "false"); |
| 954 | } |
| 955 | |
| 956 | std::string outputType; |
| 957 | switch (this->GeneratorTarget->GetType()) { |
| 958 | case cmStateEnums::OBJECT_LIBRARY: |
| 959 | case cmStateEnums::STATIC_LIBRARY: |
| 960 | case cmStateEnums::MODULE_LIBRARY: |
| 961 | this->Makefile->IssueMessage( |
| 962 | MessageType::FATAL_ERROR, |
| 963 | cmStrCat("Target \"", this->GeneratorTarget->GetName(), |
| 964 | "\" is of a type not supported for managed binaries.")); |
| 965 | return; |
| 966 | case cmStateEnums::SHARED_LIBRARY: |
| 967 | outputType = "Library"; |
| 968 | break; |
| 969 | case cmStateEnums::EXECUTABLE: { |
| 970 | auto const win32 = |
| 971 | this->GeneratorTarget->GetSafeProperty("WIN32_EXECUTABLE"); |
no test coverage detected