# .csproj SDK style: target multiple frameworks with a single project

> Today, I wanted to make sure that the dll targets multiple versions of the framework. But before the SDSDK style SD cspro project, you had to make a cspro file per…

- Author: Jérôme Giacomini
- Language: en
- Canonical URL: [.csproj SDK style: target multiple frameworks with a single project](https://jeromegiacomini.net/articles/2018/09/11/csproj-sdk-style-target-multiple-frameworks-with-a-single-project)
- Published: 2018-09-11
- Last modified: 2026-09-05
- Topics: .NET, C#

Today, I wanted to make sure that the dll targets multiple versions of the framework.

But before the SDSDK style SD cspro project, you had to make a cspro file per target framework which was long and tedious.

Now with the new csproj format we have a new property called **TargetFrameworks** which allows us to generate our dll in different dll formats with a single csproj.

If I want my dll to be compiled into .NET Standard 2.0 and I also want to support .NET Standard 1.3, I just need to replace the following line:

```xml

<TargetFramework>netstandard1.3</TargetFramework>

```


By:

```xml

<TargetFrameworks>netstandard1.3;netstandard2.0</TargetFrameworks>

```


The output directory now has two directories:

![](https://jeromegiacomini.net/Blog/wp-content/uploads/2018/09/output.png)

**Note: You can find the list of values accepted by the TargetFrameworks node here**

## Add a NuGet package for a specific version

In my case, if I target standard .NET 1.3 I want to add a reference to the NuGet of **System.Xml.XmlSerializer** because the XmlSerialization class only arrived in .NET Standard 2.0.

**Add the NuGet package only when’Netstandard 1.3 is targeted:**

To be able to add a NuGet package only when I'm in .NET Standard 1.3 I'm going to check that the variable **TargetFramework** is equal to **netstandard1.3**.

```xml

<ItemGroup Condition=" $(TargetFramework) =='netstandard1.3')">
    <PackageReference Include="System.Xml.XmlSerializer" Version=" 4.3.0/>
</ItemGroup/>

```


The solution explorer allows us to check at a glance that our configuration is well taken into account. **System.Xml.XmlSerializer** is only added for configuration **netstandard1.3**.

![](https://jeromegiacomini.net/Blog/wp-content/uploads/2018/09/csprojsdkStyle.png)

Happy coding.
