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

Import language targets conditional on proj file extension #1051

Open
srivatsn opened this issue Mar 28, 2017 · 6 comments
Open

Import language targets conditional on proj file extension #1051

srivatsn opened this issue Mar 28, 2017 · 6 comments
Milestone

Comments

@srivatsn
Copy link
Contributor

From @dazinator on March 26, 2017 16:25

This is in the SDK targets:

  </Import>

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.targets
============================================================================================================================================
-->
  <PropertyGroup Condition="'$(LanguageTargets)' == ''" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <LanguageTargets Condition="'$(MSBuildProjectExtension)' == '.csproj'">$(MSBuildToolsPath)\Microsoft.CSharp.targets</LanguageTargets>
    <LanguageTargets Condition="'$(MSBuildProjectExtension)' == '.vbproj'">$(MSBuildToolsPath)\Microsoft.VisualBasic.targets</LanguageTargets>
    <!-- If LanguageTargets isn't otherwise set, then just import the common targets.  This should allow the restore target to run,
         which could bring in NuGet packages that set the LanguageTargets to something else.  This means support for different
         languages could either be supplied via an SDK or via a NuGet package. -->
    <LanguageTargets Condition="'$(LanguageTargets)' == ''">$(MSBuildToolsPath)\Microsoft.Common.CurrentVersion.targets</LanguageTargets>
  </PropertyGroup>

Shouldn't the language targets be imported based on a capability( i.e CSharp), not project file extension?

I currently have to manually import the csharp targets into my custom project (.dnnproj), when using the new proj file format.. event though I declare CSharp capability.

Copied from original issue: microsoft/VSProjectSystem#219

@srivatsn
Copy link
Contributor Author

From @dazinator on March 26, 2017 22:54

Ok so this also seems to be the reason why Roslyn compilation can't find assemblies referenced via PackageReference - which I raised in #218

Declaring the following LanguageTargets property, in my custom project system props file, seems to fix everything, and I no need to directly import the csharp targets anymore in my project system

  <PropertyGroup>
 <LanguageTargets>$(MSBuildToolsPath)\Microsoft.CSharp.targets</LanguageTargets>  
  </PropertyGroup>

@borgdylan
Copy link

The capability gets added based on the extension as well, so this will not work.

@dazinator
Copy link

dazinator commented Mar 30, 2017

Yes it will work..
The capability is inferred based on extension (Csproj / Vbproj etc) which works fine for those projects. For custom project types though, i.e with a different extension (e.g dnnproj) they declare their own capabilities.. They would include any relevent language capabilities in their own targets - i.e csharp.

@dazinator
Copy link

Honestly dont see the point of a csharp language capability if it cant be used to infer the language.

@livarcocc livarcocc added this to the Unknown milestone Jan 29, 2018
mmitche pushed a commit to mmitche/sdk that referenced this issue Jun 5, 2020
…anges

Removing the packageicon references from repo
Copy link
Contributor

Due to lack of recent activity, this issue has been labeled as 'stale'. It will be closed if no further activity occurs within 30 more days. Any new comment will remove the label.

@github-actions github-actions bot added the stale label Apr 25, 2024
@dazinator
Copy link

I no longer develop custom project types. However I think this should be active until someone can confirm if anything has already been or will be done:

Honestly dont see the point of a csharp language capability if it cant be used to infer the language.

@github-actions github-actions bot removed the stale label May 1, 2024
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

4 participants