Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Generated template Package references #4482


User avatar
0
inzone created

Hello,

I am getting started with ASP.NET Zero and generated a new project with the following settings: Project Type: ASP.NET Core MVC & jQuery Project version: 5.0.6 (latest) Framework: .NET Framework 4.6.1

I see the generated csproj files have assembly references like this:

<ItemGroup>
		<Reference Include="System.ComponentModel.DataAnnotations" />
	</ItemGroup>

The same csproj file at the Github repository looks like this: (See <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Core.Shared/MyCompanyName.AbpZeroTemplate.Core.Shared.csproj">https://github.com/aspnetzero/aspnet-ze ... red.csproj</a>)

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
    <Reference Include="System.ComponentModel.DataAnnotations" />
  </ItemGroup>

So for some reason, the template downloader is removing the ItemGroup condition and causing the following build warning:

Severity	Code	Description	Project	File	Line	Suppression State
Warning	MSB3245	Could not resolve this reference. Could not locate the assembly "System.ComponentModel.DataAnnotations". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.	InAccess.Core.Shared	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets	2041

Is this an expected behavior for the template generator or the reference condition for net461 should be preserved?

Also, latest version of metronic recommends building all the dependencies with yarn instead of calling gulp --prod, is yarn also recommended for ASP.NET Boilerplate or I should stick with gulp?

Best regards, Emiliano.


1 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    Try restarting Visual Studio with Administrator privileges: https://github.com/dotnet/core/issues/730#issuecomment-353700213

    If that doesn't work, then try this from an earlier comment: https://github.com/dotnet/core/issues/730#issuecomment-314611284

    In your web project install the "System.ComponentModel.Annotations" "4.3.0" nuget package, which should automatically cause your web.config to update to add the following binding redirect.

    <dependentAssembly>
     <assemblyIdentity name="System.ComponentModel.Annotations" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
    </dependentAssembly>
    

    And also cause System.ComponentModel.Annotations.dll to be copied to your bin folder. Once that happens your web project works.