Hi.
I have a .netstandard Model layer that referenced from Xamarin.forms
I set Xamarin.Forms package in Model layer => PrivateAssets="All"
My .netstandard Data layer referenced from Model layer.
When I run this command in PowerShell :
dotnet ef --startup-project ../Eela.Web/ migrations add v1
I have this error :
C:\Users*.nuget\packages\xamarin.forms\2.3.4.231\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets(40,3): error MSB4062: The "Xamarin.Forms.Build.Tasks.FixedCreateCSharpManifestResourceName" task could not be loaded from the assembly C:\Users*.nuget\packages\xamarin.forms\2.3.4.231\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Build.Tasks.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the
declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [.....\Eela.Model.csproj]
Even I'm using :
<PackageTargetFallback>$(PackageTargetFallback);portable-win+net45+wp8+win81+wpa8</PackageTargetFallback>
in Data layer but the problem is persisted,
Is there any way to resolve this problem ?
What does your *.csproj file look like?
Also, have you tried installing the Microsoft.EntityFrameworkCore.Tools package and using the Add-Migration PMC command?
@bricelam
Data layer :
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Globals">
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netstandard1.6</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Eela.Model\Eela.Model.csproj" />
</ItemGroup>
</Project>
I solved it by removing Xamarin.Forms dependency,
In fact I wanted the Command.cs class in Xamarin.Forms ,and I got the Command.cs source and copy paste it t to my code and I used it.
No i didn't use Add-Migration. I will test it . thanks any way.
Oh good. I'm glad you were able to solve it. It looks like the Xamarin.Forms package uses some MSBuild tasks that are incompatible with the dotnet command.
You could probably work around it by updating the reference to look like this:
<PackageReferecne Include="Xamarin.Forms" Version="2.3.4.231">
<ExcludeAssets>build</ExcludeAssets>
</PackageReference>
@bricelam Thanks . I will test it ...
does Add-Migration use MSBuild ?
Not directly; it uses the Visual Studio APIs instead.
@bricelam
<PackageReferecne Include="Xamarin.Forms" Version="2.3.4.231">
<ExcludeAssets>build</ExcludeAssets>
</PackageReference>
It worked like a charm ... Thank you ...
@bricelam We have a proverb in Persian that says : "Nosh daro bad az marge Sohrab"
It means : eating drug to someone after his death .
But it will help me in future work probably.
Most helpful comment
@bricelam We have a proverb in Persian that says : "Nosh daro bad az marge Sohrab"
It means : eating drug to someone after his death .
But it will help me in future work probably.