dotnet / dotnet/project-system

Cannot set TFM through DTE

Open
#1,997 0 comments 0 reactions 0 assignees View on GitHub
Parity-Legacy-API Parity-Legacy-Feature Triage-Investigate
Dominant language
C#
Stars
1k
Forks
415
PR merge metrics
No merged PRs in 30d

Description

In previous version of the project system you could set the TFM for a project directly on a DTE project object like so:
```C#
project.Properties.Item("TargetFrameworkMoniker").Value = ".NETFramework,Version=v4.6.2";
```

If you attempt this in the new project system today you will get an error:
```C#
project.Properties.Item("TargetFrameworkMoniker").Value = ".NETStandard,Version=v1.5";
```
```
System.InvalidOperationException : Can't set the value of a read-only property.
```

We should either make this scenario work or throw an error stating that setting the TFM is not supported instead of a generic exception.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.