vs-csharp-support.rst 1.6 KB

12345678910111213141516171819202122232425262728293031323334
  1. vs-native-csharp-support
  2. ------------------------
  3. * The :ref:`Visual Studio Generators` for VS 2010 and above
  4. learned to support the C# language. C# assemblies and
  5. programs can be added just like common C++ targets using
  6. the :command:`add_library` and :command:`add_executable`
  7. commands. Referencing between several C# targets in the same
  8. source tree is done by :command:`target_link_libraries` like
  9. for C++. Referencing to system or 3rd party assemblies is
  10. done by the target properties :prop_tgt:`VS_DOTNET_REFERENCE_<refname>`
  11. and :prop_tgt:`VS_DOTNET_REFERENCES`.
  12. * C# as a language can be enabled using :command:`enable_language`
  13. or :command:`project` with ``CSharp``. It is not enabled by
  14. default.
  15. * Flag variables, target properties and other configuration
  16. that specifically targets C# contains ``CSharp`` as a part of
  17. their names.
  18. * More finetuning of C# targets can be done using target and source
  19. file properties. Specifically the Visual Studio related target
  20. properties (``VS_*``) are worth a look (for setting toolset
  21. versions, root namespaces, assembly icons, ...).
  22. * **Auto-"linking"** in .csproj files: In C#/.NET development with
  23. Visual Studio there is a number of visual editors used which
  24. generate code. Both the generated files and the ones edited
  25. with the UI are connected in the ``.csproj`` file using
  26. ``<DependentUpon>`` tags. If CMake finds within a C# project
  27. any source file with extension ``.Designer.cs`` or ``.xaml.cs``,
  28. it checks sibling files with extension ``.xaml``, ``.settings``,
  29. ``.resx`` or ``.cs`` and establishes the dependency connection.