Hi folks,
I am trying to generate a Visual Studio C# project with CMake.
This is what I have so far:
|cmake_minimum_required(VERSION 3.10)
project(myProject VERSION 0.1.0LANGUAGES CSharp)
add_library(myLib SHARED src/file1.cs src/file2.cs src/file3.cs)
set_property(TARGET myLib PROPERTY
VS_DOTNET_TARGET_FRAMEWORK_VERSION "netstandard1.4")|
||||I got the framework name from a .csproj file I generated with
Visual Studio that looks like this:
|<ProjectSdk="Microsoft.NET.Sdk"><PropertyGroup><TargetFramework>netstandard1.4</TargetFramework></PropertyGroup></Project>|
This is what I need in order to build the library for .NET Standard 1.4.
However, CMake generates this (among all the other stuff):
|<TargetFrameworkVersion>netstandard1.4</TargetFrameworkVersion> |
||This does not seem to be valid, since Visual Studio complains that
it cannot open the project. I did not find anything in the
CMake documentation to set|<TargetFramework>| instead
of|<TargetFrameworkVersion>|.
I also tried to go along with a "normal" TargetFrameworkVersion, "4.6.1".
If I do this, the generated project will target ".NET Framework 4.6.1" and I
cannot change the target framework to ".NET Standard 1.4" in Visual Studio via
the dropdown, as the option is not available. Visual Studio seems to be unable
to switch a project from .NET Framework to .NET Standard after it has been
created.
Is it possible to generate a project targeting .NET Standard with CMake?
Thanks,
Felix
||
||
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake