novotnyllc / MSBuildSdkExtras

Extra properties for MSBuild SDK projects
MIT License
346 stars 43 forks source link

Need to rebuild project every time #240

Closed nakulLukan closed 4 years ago

nakulLukan commented 4 years ago

I have a cross-platform project for a Xamarin Form plugin. Everything is working fine. But the only issue is I need to update my project after every change I make in the code. Am I missing anything? Please see my project file.

<Project Sdk="MSBuild.Sdk.Extras/2.0.54">

  <PropertyGroup>
    <TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">netstandard1.0;netstandard2.0;MonoAndroid90</TargetFrameworks>
    <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard1.0;netstandard2.0;MonoAndroid90</TargetFrameworks>
    <Product>$(AssemblyName) ($(TargetFramework))</Product>
    <LangVersion>latest</LangVersion>
    <AssemblyVersion>1.0.0.0</AssemblyVersion>
    <AssemblyFileVersion>1.0.0.0</AssemblyFileVersion>
    <Version>1.0.0.0</Version>
    <PackageVersion>1.0.0.0</PackageVersion>
    <PackOnBuild>true</PackOnBuild>
    <NeutralLanguage>en</NeutralLanguage>
    <LangVersion>default</LangVersion>
    <DefineConstants>$(DefineConstants);</DefineConstants>
    <UseFullSemVerForNuGet>false</UseFullSemVerForNuGet>
    <EnableDefaultCompileItems>false</EnableDefaultCompileItems>

  </PropertyGroup>

  <PropertyGroup Condition=" '$(Configuration)'=='Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <GenerateDocumentationFile>false</GenerateDocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)'=='Release' ">
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
    <GenerateDocumentationFile>true</GenerateDocumentationFile>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="**\*.shared.cs" />
  </ItemGroup>
  <ItemGroup Condition=" $(TargetFramework.StartsWith('netstandard')) ">
  </ItemGroup>
  <ItemGroup Condition=" $(TargetFramework.StartsWith('MonoAndroid')) ">
    <Compile Include="**\*.android.cs" />
  </ItemGroup>
  <ItemGroup Condition="'$(TargetFramework)' == 'MonoAndroid90'">
    <PackageReference Include="Xamarin.Android.Support.Compat">
      <Version>28.0.0.3</Version>
    </PackageReference>
    <Folder Include="Android" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Xamarin.Forms" Version="4.3.0.908675" />
  </ItemGroup>
  <ItemGroup Condition="$(TargetFramework.StartsWith('MonoAndroid'))">
    <Reference Include="Mono.Android">
      <HintPath>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v9.0\Mono.Android.dll</HintPath>
    </Reference>
    <Reference Include="Xamarin.Forms.Platform.Android">
      <HintPath>C:\Microsoft\Xamarin\NuGet\xamarin.forms\4.3.0.908675\lib\MonoAndroid90\Xamarin.Forms.Platform.Android.dll</HintPath>
    </Reference>
  </ItemGroup>
</Project>
nakulLukan commented 4 years ago

Issue solved by setting the Build Action to Embedded resource for all class files.