Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow SDK style project OutputType to be None/Shared #8075

Open
bgyu opened this issue Jun 10, 2024 · 1 comment
Open

Allow SDK style project OutputType to be None/Shared #8075

bgyu opened this issue Jun 10, 2024 · 1 comment

Comments

@bgyu
Copy link

bgyu commented Jun 10, 2024

Is your feature request related to a problem? Please describe.

I have two (or more) C# projects with SDK style. I want to share code between them, but I don't want to create a shared library, because they may target at different frameworks, for example, one is targeting at .net framework 4.8, the other is targeting at .net 6.0. I don't want to create two more shared assemblies targeting at different frameworks to increase the complexity. I just want to share some source code. The most important, I don't need to change the access modifier (visiblity) of class or its members, for example, I don't need to change internal class to public so that it can be accessed by other projects. The source code in the shared project should behave like they are part of referenced project.

I can use existing shared project (for c#), but it's not with SDK style. I have to manually add shared sources and their folder structures. I just want it works like SDK-style project, including all source code structures automatically, no explicit <Compile Include="xxx.cs" />.

In one word, I want a C# SDK style project which is only used for project reference (should work for both Windows and Linux), and it doesn't generate any output itself.

Describe the solution you'd like.

A new SDK style project OutputType, allows no output. For example, OutputType can be None, which generates no output. The purpose of this project is just used for project reference (sharing between projects). Can be something like this:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>None</OutputType>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

</Project>
@bgyu bgyu changed the title Add an SDK style shared project template Add an SDK style shared project template/Allow SDK style project OutputType to be None Jun 10, 2024
@bgyu bgyu changed the title Add an SDK style shared project template/Allow SDK style project OutputType to be None Allow SDK style project OutputType to be None Jun 10, 2024
@bgyu bgyu changed the title Allow SDK style project OutputType to be None Allow SDK style project OutputType to be None/Shared Jun 10, 2024
@rdvanbuuren-gasunie
Copy link

You can just create one shared code library that targets multiple frameworks at once:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>netstandard1.4;net40;net45</TargetFrameworks>
  </PropertyGroup>
</Project>

Example from: https://learn.microsoft.com/en-us/dotnet/standard/frameworks#how-to-specify-a-target-framework

This will create multiple dll libraries from the same shared code which can then be referenced by a specific framework

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants