I am working with the new plugin of Nopcommerce 4.20. The plugin is almost completed but I need to make the plugin ready for distribution. But there are unnecessary folders created inside Nop.Web/Plugins/.
I made the Nop.Web and Nop.Web.Framework to "copy local=false" which are under Projects and deleted the plugin and build it again. But still, I am getting the unnecessary folders with two characters.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<Copyright>SOME_COPYRIGHT</Copyright>
<Company>YOUR_COMPANY</Company>
<Authors>SOME_AUTHORS</Authors>
<PackageLicenseUrl>PACKAGE_LICENSE_URL</PackageLicenseUrl>
<PackageProjectUrl>PACKAGE_PROJECT_URL</PackageProjectUrl>
<RepositoryUrl>REPOSITORY_URL</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<OutputPath>..\..\Presentation\Nop.Web\Plugins\Discount.ProductMix
</OutputPath>
<OutDir>$(OutputPath)</OutDir>
<!--Set this parameter to true to get the dlls copied from the NuGet
cache to the output of your project. You need to set this parameter to
true if your plugin has a nuget package to ensure that the dlls copied
from the NuGet cache to the output of your project-->
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
<None Remove="logo.jpeg" />
<None Remove="plugin.json" />
<None Remove="Views\Configure.cshtml" />
<None Remove="Views\DiscountProductAddPopup.cshtml" />
<None Remove="Views\_ViewImports.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="logo.jpeg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Views\DiscountProductAddPopup.cshtml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Views\Configure.cshtml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Views\_ViewImports.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Presentation\Nop.Web.Framework\Nop.Web.Framework.csproj">
<Private>false</Private>
</ProjectReference>
<ProjectReference Include="..\..\Presentation\Nop.Web\Nop.Web.csproj">
<Private>false</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Update="Controllers\DiscountProductMixController.cs">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Compile>
<Compile Update="Data\DiscountOfferMixMap.cs">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Compile>
<Compile Update="Data\DiscountProductMixObjectContext.cs">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Compile>
<Compile Update="DiscountProductMixConfiguration.cs">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Compile>
<Compile Update="Domain\DiscountOffers.cs">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Compile>
<Compile Update="Infrastructure\DependencyRegistrar.cs">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Compile>
<Compile Update="Infrastructure\PluginDBStartup.cs">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Compile>
<Compile Update="Models\ConfigurationModel.cs">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Compile>
</ItemGroup>
<!-- This target execute after "Build" target -->
<Target Name="NopTarget" AfterTargets="Build">
<!-- Delete unnecessary libraries from plugins path -->
<MSBuild Projects="#(ClearPluginAssemblies)" Properties="PluginPath=$(MSBuildProjectDirectory)\$(OutDir)" Targets="NopClear" />
</Target>
All things are perfect if you are not installing any Nuget Packages then please make false
<CopyLocalLockFileAssemblies>False</CopyLocalLockFileAssemblies>
and another thing
Add replace these lines
<ItemGroup>
<ProjectReference
Include="..\..\Presentation\Nop.Web.Framework\Nop.Web.Framework.csproj"/>
<ProjectReference Include="..\..\Presentation\Nop.Web\Nop.Web.csproj" />
<ClearPluginAssemblies Include="$(MSBuildProjectDirectory)\..\..\Build\ClearPluginAssemblies.proj" />
Try these changes can help you.
I also had a problem with unnecessary folders being created. This turned out to be caused by the .Net Core 3.0 SDK, which apparently builds plugins in a different way than the version 2.x SDK's did. To check for this, you can run dotnet --version from the command line from within your nopcommerce project folder. The version should not be higher than 2.x.
The fix was to just tell dotnet to use a specific SDK version for building the project. This was just a matter of adding a global.json file in my nopcommerce project folder containing these lines:
{
"sdk": {
"version": "2.2.402"
}
}
Running dotnet --version again now gives the output 2.2.402.
Related
I am new to Targeting multiplatforms . I have found several sources and based on them I am doing everything correctly. However once I use android device .netstandard class gets called. When iOS everything works fine.
I have tried different version of monoandroid but still the same.
<TargetFrameworks>netstandard2.0;xamarinios10;monoandroid90;</TargetFrameworks>
<ItemGroup>
<Compile Remove="**\*.netstandard.cs" />
<Compile Remove="**\*.android.cs" />
<Compile Remove="**\*.ios.cs" />
<Compile Remove="**\*.windows.cs" />
<Compile Remove="**\*.shared.cs" />
<Compile Remove="**\*.shared.*.cs" />
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('monoandroid')) ">
<Compile Include="**\*.android.cs" />
<AndroidResource Include="Resources\xml\*.xml" />
<AndroidAsset Include="Assets\**\*" />
</ItemGroup>
Have defined multitarget project:
<Project Sdk="MSBuild.Sdk.Extras/2.0.54">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;xamarinios10;monoandroid9.0;</TargetFrameworks>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.6.0.800" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3" />
<Compile Include="**\Shared\*.cs" />
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('xamarinios')) ">
<Compile Include="**\iOS\*.cs" />
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('monoandroid')) ">
<Compile Include="**\Android\*.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Shared\MyView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
</Project>
So, when i make my custom component only in code all compile and works well, but i would like to develop some custom controls using XAML.
But i got error of ambiguous call to method InitializeComponent() in MyView object.
How to make correct conditional configuration in .csproj for compiler to understand *.xaml and *.xaml.cs files ?
Adding these properties to common ItemGroup solved the problem:
<None Remove="**\Shared\*.xaml" />
<Compile Include="**\Shared\*.xaml.cs" DependentUpon="%(Filename)" />
<EmbeddedResource Include="**\Shared\*.xaml" Generator="MSBuild:UpdateDesignTimeXaml" />
I am trying to use https://platform.uno/ to build some tools. The WASM (WebAssembly)-Project from uno-platform template will not start due to FileNotFoundExceptions regarding some base Microsoft libs.
I created a new uno-platform APP from uno template. I have updated all NuGet packages to latest version. When I start the wasm web-project I get the following exceptions (at bootstrap i guess):
followed by:
followed by:
Here you can see the Exception class comes from the namespace that was not found in picture 1. It's very strange to me and I don't know whats up anymore.
I guess this is an issue with prerequisites or wrong versions in dependencies somewhere. Does anybody know whats up?
Here is the csproj of the WASM project:
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netstandard2.0</TargetFramework>
<WasmHead>true</WasmHead>
<DefineConstants>$(DefineConstants);__WASM__</DefineConstants>
<NoWarn>NU1701</NoWarn>
<StartupObject>Macs3.Calculations.TestTool.Wasm.Program</StartupObject>
<MonoRuntimeDebuggerEnabled>true</MonoRuntimeDebuggerEnabled>
</PropertyGroup>
<ItemGroup>
<Content Include="..\Macs3.Calculations.TestTool.UWP\Assets\*.png" Link="Assets\%(FileName)%(Extension)" />
<Content Include="Fonts\winjs-symbols.woff2" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="WasmCSS\Fonts.css" />
<EmbeddedResource Include="WasmScripts\AppManifest.js" />
</ItemGroup>
<ItemGroup>
<LinkerDescriptor Include="LinkerConfig.xml" />
</ItemGroup>
<ItemGroup>
<!--
This item group is required by the project templace because of the
new SDK-Style project, otherwise some files are not aded automatically.
You can safely remove this ItemGroup completely.
-->
<Compile Remove="Program.cs" />
<Compile Include="Program.cs" />
<Content Include="LinkerConfig.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Uno.UI" Version="1.46.0-dev.2039" />
<PackageReference Include="Uno.Wasm.Bootstrap" Version="1.0.0-dev.298" />
</ItemGroup>
<Import Project="..\Macs3.Calculations.TestTool.Shared\Macs3.Calculations.TestTool.Shared.projitems" Label="Shared" Condition="Exists('..\Macs3.Calculations.TestTool.Shared\Macs3.Calculations.TestTool.Shared.projitems')" />
</Project>
I am trying to publish a dotnet core 2.0.0 (release version) project from command line.
I am getting an error as below.
EXEC(1,1): error CS8301: Invalid name for a preprocessing symbol; '' is not a valid identifier [C:\Work\FloAppGit\FloAppStpl\FloMa
nufacturer\FloManufacturer.fsproj]
C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.mvc.razor.viewcompilation\2.0.0\build\netstandard2.0\Microsof
t.AspNetCore.Mvc.Razor.ViewCompilation.targets(60,5): error MSB3073: The command ""C:\Program Files\dotnet\dotnet.exe" exec --runt
imeconfig "C:\Work\FloAppGit\FloAppStpl\FloManufacturer\bin\Debug\netcoreapp2.0\FloManufacturer.runtimeconfig.json" --depsfile "C:
\Work\FloAppGit\FloAppStpl\FloManufacturer\bin\Debug\netcoreapp2.0\FloManufacturer.deps.json" "C:\Program Files\dotnet\sdk\NuGetFa
llbackFolder\microsoft.aspnetcore.mvc.razor.viewcompilation\2.0.0\build\netstandard2.0\Microsoft.AspNetCore.Mvc.Razor.ViewCompilat
ion.dll" #"obj\Debug\netcoreapp2.0\microsoft.aspnetcore.mvc.razor.viewcompilation.rsp"" exited with code 1. [C:\Work\FloAppGit\Flo
AppStpl\FloManufacturer\FloManufacturer.fsproj]
My project file is as follows.
<Project Sdk="FSharp.NET.Sdk;Microsoft.NET.Sdk.Web">
<PropertyGroup>
<EnableDefaultCompileItems>False</EnableDefaultCompileItems>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RuntimeFrameworkVersion>2.0.0</RuntimeFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<Compile Include="Controllers/*.fs" />
<Compile Include="FloLogger.fs" />
<Compile Include="Restful.fs"/>
<Compile Include="AppSettingsHelper.fs" />
<Compile Include="DataRecords/BusinessRecords.fs"/>
<Compile Include="DAL/ManufacturerDAL.fs"/>
<Compile Include="DAL/ItemManufacturerDAL.fs"/>
<Compile Include="BAL/ItemManufacturerBAL.fs"/>
<Compile Include="BAL/ManufacturerBAL.fs"/>
<Compile Include="Manufacturer.fs" />
<Compile Include="ItemManufacturer.fs" />
<Compile Include="Startup.fs" />
<Compile Include="Program.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FSharp.Core" Version="4.1.*" />
<PackageReference Include="FSharp.NET.Sdk" Version="1.0.*" PrivateAssets="All" />
<PackageReference Include="log4net" Version="2.0.8" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="RavenDB.Client" Version="4.0.0-beta-40016" />
<PackageReference Include="Polly" Version="5.1.0" />
<PackageReference Include="Suave" Version="2.0.3.0" />
<PackageReference Include="Suave.AspNetCore" Version="0.3.0" />
<PackageReference Include="Suave.DotLiquid" Version="2.0.3" />
<PackageReference Include="xunit" Version="2.2.0" />
</ItemGroup>
Please help me resolve this issue as I am stuck.
I was able to resolve the issue by commenting these lines in the project file.
<PackageReference Include="FSharp.Core" Version="4.1.*" />
<PackageReference Include="FSharp.NET.Sdk" Version="1.0.*" PrivateAssets="All" />
Also I had to change the header of the project file like this.
<Project Sdk="Microsoft.NET.Sdk.Web">
Delete the obj and bin folders. Do a dotnet clean then dotnet restore.
I was able to publish the code successfully for dotnet core 2.0.0 release version.
I have an NLog.config file that I want transformed before publishing my site. Similar to how web.config is transformed. How do I accomplish this? I couldn't find any solid resources on how to do this.
I tried adding a transform to the csproj
<Target Name="BeforeBuild" Condition="exists('NLog.$(Configuration).config')">
<Message Text="Tranforming NLog..."/>
<TransformXml Source="NLog.config" Transform="NLog.$(Configuration).config" Destination="$(OutputPath)\NLog.config" />
</Target>
Also added the NLog to csproj:
<Content Include="NLog.config">
<SubType>Designer</SubType>
</Content>
<None Include="NLog.aws-prod.config">
<DependentUpon>NLog.config</DependentUpon>
</None>
<None Include="NLog.aws-test.config">
<DependentUpon>NLog.config</DependentUpon>
</None>
but this doesn't copy the transformed NLog.config to the package directory (or when deploying to AWS). The original NLog.config is copied and a copy in the /bin directory as well.
SlowCheetah seems to do what I want. I've tried it and I've made changes to my csproj to add:
<TransformOnBuild>true</TransformOnBuild>
and
<IsTransformFile>True</IsTransformFile>
so the final change looks like this:
<Content Include="NLog.config">
<TransformOnBuild>true</TransformOnBuild>
<SubType>Designer</SubType>
</Content>
<None Include="NLog.aws-prod.config">
<DependentUpon>NLog.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
<SubType>Designer</SubType>
</None>
<None Include="NLog.aws-test.config">
<DependentUpon>NLog.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
</None>
That's it and NLog.config is transformed!! This target below wasn't needed:
<Target Name="BeforeBuild" Condition="exists('NLog.$(Configuration).config')">
<Message Text="Tranforming NLog..."/>
<TransformXml Source="NLog.config" Transform="NLog.$(Configuration).config" Destination="$(OutputPath)\NLog.config" />
</Target>