-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Support legacy-style projects #101
Comments
what’s stopping you from moving to the new project format? |
That was one of the first things I tried. It's unsupported for ASPNET projects, and currently won't build (or little else). There is CZEMacLeod's alternative SDK for the project to target, but there's still several caveats to it. |
I've determined a better workaround after the previous one seemed to stop working, and even better it no longer needs replicating the contents of It does require that In <PropertyGroup Condition="'$(TargetFramework)' == '' and '$(TargetFrameworkVersion)' == 'v4.8'">
<TargetFramework>net48</TargetFramework>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net48'">
<PackageReference Include="Polyfill" Version="1.30.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup> And in <PropertyGroup>
<ResolvePackageAssetsTargets Condition="Exists($(ResolvePackageAssets))">true</ResolvePackageAssetsTargets>
</PropertyGroup>
<Target Name="ResolvePackageAssets"
Condition="'$(ResolvePackageAssetsTargets)' != 'true'"
AfterTargets="ResolveReferences">
<Message Importance="normal" Text="ResolvePackageAssets target doesn't exist. Adding a placeholder." />
</Target> I'll see if I can get permission to contribute a PR during my work hours, otherwise I'll try and submit one after hours. |
My 50 cents. I also has a non-sdk style projects in my solution. And it actually does support non-sdk style projects even now but with some workaround. @Sebbs128 @SimonCropp I think proper fix should use msbuild property UsingMicrosoftNETSdk to detect non-sdk style projects and not try to introduce fake TargetFramework property, it is not relevant in non-sdk style projects. <Target Name="ResolvePackageAssets" Condition=" '$(UsingMicrosoftNETSdk)' == '' " AfterTargets="ResolveReferences">
<PropertyGroup>
<DefineConstants>$(DefineConstants);NETFRAMEWORK</DefineConstants>
</PropertyGroup>
</Target> |
sorry. i dont think i have capacity to maintain support for legacy projects |
Is the feature request related to a problem
When the package is installed in an legacy-style project (that is, the project file format used prior to the current SDK-style; such as ASP.NET MVC5 projects), building that project fails because the
ResolvePackageAssets
target does not exist for MSBuild.[ETA]ASP.NET projects unfortunately can't be migrated to SDK-style at this time.
ResolvePackageAssets
is aTarget
used withinPolyfill.targets
, but only exists in the dotnet SDK.Describe the solution
I can currently work around this by adding a placeholder for
ResolvePackageAssets
if the target isn't already defined, and setting up some of the preprocessor constants that SDK-style projects set but are lacking in legacy style projects. In my work-around they're placed inDirectory.Build.props
andDirectory.Build.targets
, however for a solution in the Polyfill package itself these should be able to go inPolyfill.props
andPolyfill.targets
.In legacy style projects, add
NETFRAMEWORK
; to<DefineConstants>
(or add<DefineConstants>NETFRAMEWORK</DefineConstants>
if the element didn't already exist).Add to
Directory.Build.props
(work-around;Polyfill.props
for potential PR)Add to
Directory.Build.targets
(work-around;Polyfill.targets
for potential PR)Describe alternatives considered
The
buildMultitargeting
asset type was introduced in NuGet 4.0 to allow framework-specific build logic, however I don't think it's capable of distinguishing SDK-style from old-style projects.I also looked at getting
ResolvePackageAssets
referenceable for building a legacy-style project, but getting a reference to the.targets
file is a bit of a maze (and I wasn't yet able to find an MSBuild property that might allow referring to a dotnet SDK directory).Additional context
[ETA] Context for not being able to switch ASP.NET projects to SDK-style (yet?)
dotnet/project-system#2670
The text was updated successfully, but these errors were encountered: