dotnet / dotnet/project-system
VS not setting TargetFramework for cross compile, unclear why
- Dominant language
- C#
- Stars
- 1k
- Forks
- 415
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to build a custom project type. Inheriting from Microsoft.NET.Sdk.
I have a project using my custom project type. In a .msbuildproj file. It has a plural TargetFrameworks. Visual Studio on load is invoking a few DesignTime targets. Except it's not setting TargetFramework for these invocations. Instead, it sets nothing, and so it's considered a crosstarget build, and all the CompileDesignTime targets don't work there.
Loading up a standard csproj, I can see that VS sets the TargetFramework (singular) global property before invocation of the DesignTime targets. Hence everything works.
For the life of me I cannot find out why VS makes this decision. It appears that VS simply "knows" that it's dealing with a CrossTarget project, and invokes the design time targets multiple times, once per TFM. But for my project type, it doesn't "know" this, and so just goes on.
I've tried everything I can think of. Renaming my project to .csproj. Carefully tracing down all the properties. It appears VS is making this decision, based on some knowledge it has.... but I cannot figure out how!
Is this documented anywhere?
Contributor guide
Assessment
This issue has not been assessed yet.