Unable to deploy to a local server folder asp.net successfully - asp.net

I am new to asp.net
Below is my project file:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="GatherAllFilesToPublish">
</Target>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F5500ADD-969D-45A1-A175-0D60ECE982B2}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SampleWebService</RootNamespace>
<AssemblyName>SampleWebService</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<UseIISExpress>false</UseIISExpress>
<TargetFrameworkProfile />
<Use64BitIISExpress />
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Drawing" />
<Reference Include="System.ServiceModel.Web" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Content Include="WebService.asmx" />
<Content Include="Web.config">
<SubType>Designer</SubType>
</Content>
<Content Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
<SubType>Designer</SubType>
</Content>
<Content Include="Web.Release.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
</ItemGroup>
<ItemGroup>
<Compile Include="WebService.asmx.cs">
<DependentUpon>WebService.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CommonLib\CommonLib.csproj">
<Project>{1B3AF307-D36B-498F-8618-B53688B4FFC6}</Project>
<Name>CommonLib</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
<None Include="Properties\PublishProfiles\FolderProfile1.pubxml" />
<None Include="Properties\PublishProfiles\FolderProfile2.pubxml" />
<None Include="Properties\PublishProfiles\FolderProfile3.pubxml" />
<None Include="Properties\PublishProfiles\FolderProfile4.pubxml" />
<None Include="Properties\PublishProfiles\Profile1.pubxml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>False</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>64867</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>
</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
When i tried to deploy to a local server by folder,the bin/Release/Publish
does not contain anything.
Also tried the Debug mode too,bin/Debug/Publish folder contains nothing.
When i run publish,below is the following output,
1>------ Publish started: Project: SampleWebService, Configuration: Debug Any CPU ------
1>Connecting to D:\Project\Sample\SampleWebService\SampleWebService\bin\Release\publish\...
1>Publishing folder /...
1>Web App was published successfully file:///D:/Project/Sample/SampleService/SampleWebService/bin/Release/publish/
1>
========== Build: 0 succeeded, 0 failed, 2 up-to-date, 0 skipped ==========
========== Publish: 1 succeeded, 0 failed, 0 skipped ==========
The publish log indicates success but no files inside my publish folder.
i am using visual studio 2017 but the project files should be built using 2010
Based on the following lines:
$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
V10.0 means visual studio 2010 ,am i right?
Anyone has any idea what is wrong,do i have to use visual studio 2010 to publish my project instead of the latest 2017 version?

Resolved:
The cause is i put the following lines in the project file to resolve the gatherallfilestopublish issue:
</Target>-->
Found another way to resolve the issue as outlined by below forum:
https://forums.asp.net/t/1838524.aspx?The+target+GatherAllFilesToPublish+does+not+exist
Re: The target GatherAllFilesToPublish does not exist
I fixed the issue by doing following modifications to the Project file. have VS 2012 and the web application was MVC 4
Unload the project and start editing the csproj file.
Added following lines.
10.0
$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
Added following lines.(Note that some of the Import statments may already exisits. In such case you do not need to add them.
Project file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--<Target Name="GatherAllFilesToPublish">
</Target>-->
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F5500ADD-969D-45A1-A175-0D60ECE982B2}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SampleWebService</RootNamespace>
<AssemblyName>SampleWebService</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<UseIISExpress>false</UseIISExpress>
<TargetFrameworkProfile />
<Use64BitIISExpress />
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
</PropertyGroup>
<!--added-->
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<!--added-->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Drawing" />
<Reference Include="System.ServiceModel.Web" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Content Include="WebService.asmx" />
<Content Include="Web.config">
<SubType>Designer</SubType>
</Content>
<Content Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
<SubType>Designer</SubType>
</Content>
<Content Include="Web.Release.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
</ItemGroup>
<ItemGroup>
<Compile Include="WebService.asmx.cs">
<DependentUpon>WebService.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CommonLib\CommonLib.csproj">
<Project>{1B3AF307-D36B-498F-8618-B53688B4FFC6}</Project>
<Name>CommonLib</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
<None Include="Properties\PublishProfiles\FolderProfile1.pubxml" />
<None Include="Properties\PublishProfiles\FolderProfile2.pubxml" />
<None Include="Properties\PublishProfiles\FolderProfile3.pubxml" />
<None Include="Properties\PublishProfiles\FolderProfile4.pubxml" />
<None Include="Properties\PublishProfiles\FolderProfile5.pubxml" />
<None Include="Properties\PublishProfiles\Profile1.pubxml" />
</ItemGroup>
<!-- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />-->
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>False</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>64867</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>
</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Related

migration .Net Framework 4.8 to .Net Core 6 - Could not load file or assembly 'System.IdentityModel, Version=4.0.0.0

I just migrated My project from the .net framework 4.8 to the .Net core 6
My Projects have a lot of dependencies like Owin, IdentityServer3, and ...
Finally, my solution builds successfully now, but when I start that I ran to this error :
Could not load file or assembly 'System.IdentityModel, Version=4.0.0.0...
Assuming that I can't migrate the identityServer3 and as a result, I can't update any of the Owin packages, (the Owin(s) version should be less than 4), is there a chance to embed the System.IdentityModel into the .Net 6 web projects?
the csproj file :
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BrockAllen.MembershipReboot" Version="9.0.0" />
<PackageReference Include="BrockAllen.MembershipReboot.Ef" Version="9.0.0" />
<PackageReference Include="EasyNetQ" Version="6.3.1" />
<PackageReference Include="EasyNetQ.DI.Ninject" Version="6.3.1" />
<PackageReference Include="EntityFramework" Version="6.4.4" />
<PackageReference Include="FluentValidation" Version="10.3.6" />
<PackageReference Include="IdentityModel" Version="1.9.2" />
<PackageReference Include="IdentityServer3" Version="2.6.3" />
<PackageReference Include="IdentityServer3.AccessTokenValidation" Version="2.14.0" />
<PackageReference Include="loggly-csharp" Version="4.6.1.76" />
<PackageReference Include="loggly-csharp-config" Version="4.6.1.76" />
<PackageReference Include="Microsoft.AspNet.Cors" Version="5.2.7" />
<PackageReference Include="Microsoft.AspNet.SignalR.Core" Version="2.4.2" />
<PackageReference Include="Microsoft.AspNet.SignalR.SystemWeb" Version="2.4.2" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
<PackageReference Include="Microsoft.AspNetCore.Owin" Version="6.0.1" />
<PackageReference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" Version="3.6.0" />
<PackageReference Include="Microsoft.IdentityModel.Protocol.Extensions" Version="1.0.2.206221351" />
<PackageReference Include="Microsoft.Net.Compilers" Version="4.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Owin" Version="3.1.0" />
<PackageReference Include="Microsoft.Owin.Cors" Version="3.1.0" />
<PackageReference Include="Microsoft.Owin.Host.HttpListener" Version="3.1.0" />
<PackageReference Include="Microsoft.Owin.Host.SystemWeb" Version="3.1.0" />
<PackageReference Include="Microsoft.Owin.Hosting" Version="3.1.0" />
<PackageReference Include="Microsoft.Owin.Security" Version="3.1.0" />
<PackageReference Include="Microsoft.Owin.Security.Jwt" Version="3.1.0" />
<PackageReference Include="Microsoft.Owin.Security.OAuth" Version="3.1.0" />
<PackageReference Include="Microsoft.QualityTools.Testing.Fakes" Version="16.11.230815" />
<PackageReference Include="Microsoft.Web.Infrastructure" Version="1.0.0" />
<PackageReference Include="Nancy" Version="2.0.0" />
<PackageReference Include="Nancy.Bootstrappers.Ninject" Version="1.4.1" />
<PackageReference Include="Nancy.MSOwinSecurity" Version="2.0.0" />
<PackageReference Include="Nancy.Owin" Version="2.0.0" />
<PackageReference Include="Nancy.Validation.FluentValidation" Version="2.0.0" />
<PackageReference Include="NEventStore" Version="9.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Ninject" Version="3.3.4" />
<PackageReference Include="Ninject.Extensions.ChildKernel" Version="3.3.0" />
<PackageReference Include="Owin" Version="1.0.0" />
<PackageReference Include="OwinHost" Version="3.1.0" />
<PackageReference Include="RabbitMQ.Client" Version="6.2.2" />
<PackageReference Include="RavenDB.Client" Version="5.3.1" />
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Loggly" Version="5.4.0" />
<PackageReference Include="Serilog.Sinks.PeriodicBatching" Version="2.3.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="4.0.2.206221351" />
<PackageReference Include="Thinktecture.IdentityModel.Owin.ScopeValidation" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.IdentityModel" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net" />
<Reference Include="System.Runtime.Caching" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
</Project>

Microsoft.NET.Sdk.Web missing Web menu (ASP.NET)

I try to convert old ASP.NET MVC 5 (349C5851-65DF-11DA-9384-00065B846F21) projects to new format with Microsoft.NET.Sdk.Web.
One main difference is the missing Web menu under Project > Properties. How could I configure these settings in the new format?
Old ASP.NET Project:
New Microsoft.NET.Sdk.Web Project:
File Content of Microsoft.NET.Sdk.Web Project (vbproj)
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<Deterministic>false</Deterministic>
<TargetFramework>net48</TargetFramework>
<OutputPath>$(SolutionDir)bin\ptc\$(Configuration)\</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OptionStrict>On</OptionStrict>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<OutputType>Library</OutputType>
<UseIISExpress>true</UseIISExpress>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.7" />
</ItemGroup>
</Project>

NopCommerce Plugins built within custom plugin

I am using Nopcommerce 4.2 and trying to create a custom Plugin.
At runtime I get the error:
System.Exception: 'A plugin with 'DiscountRequirement.MustBeAssignedToCustomerRole' system name is already defined
When I go to Nop.Web/Plugins, I can see all the plugins that have been built - including mine. When I look in my custom plugin, I can see a folder folder called Plugins, this contains all the other plugins that have been built.
I have looked at my csproj and compared it against nop default plugins and cannot work out why mine builds all the plugins again.
to be clear the structure that is being created is:
Nop.Web
Plugins/
--DiscountRules.CustomerRoles
--ExchangeRate.EcbExchange
--...Other plugins...
--My.Plugin/
----App_Data
----Areas
----Plugins/
-----DiscountRules.CustomerRoles
-----ExchangeRate.EcbExchange
-----...Other plugins...
my project file
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<OutputPath>..\..\Presentation\Nop.Web\Plugins\Widgets.MostViewedProducts</OutputPath>
<OutDir>$(OutputPath)</OutDir>
<EnableDefaultContentItems>false</EnableDefaultContentItems>
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Domain\**" />
<Content Remove="Domain\**" />
<EmbeddedResource Remove="Domain\**" />
<None Remove="Domain\**" />
</ItemGroup>
<ItemGroup>
<None Remove="logo.jpg" />
<None Remove="plugin.json" />
</ItemGroup>
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup>
<Content Include="logo.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Update="Areas\Admin\Views\BuilderProductAttribute\Create.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
<Content Update="Areas\Admin\Views\BuilderProductAttribute\Edit.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
<Content Update="Areas\Admin\Views\BuilderProductAttribute\List.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Areas\Admin\Views\BuilderProductAttribute\_CreateOrUpdate.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
<Content Update="Areas\Admin\Views\BuilderProduct\Create.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Areas\Admin\Views\BuilderProduct\Edit.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
<Content Update="Areas\Admin\Views\BuilderProduct\List.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Areas\Admin\Views\BuilderProduct\ProductAttributeCatalogCreatePopup.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
<Content Update="Areas\Admin\Views\BuilderProduct\ProductAttributeMappingCreate.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
<Content Update="Areas\Admin\Views\BuilderProduct\ProductAttributeMappingEdit.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
<Content Update="Areas\Admin\Views\BuilderProduct\_CreateOrUpdate.Attributes.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
<Content Update="Areas\Admin\Views\BuilderProduct\_CreateOrUpdate.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Areas\Admin\Views\BuilderProduct\_CreateOrUpdate.Info.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
<Content Update="Areas\Admin\Views\BuilderProduct\_CreateOrUpdate.SEO.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
<Content Update="Areas\Admin\Views\BuilderProduct\_CreateOrUpdateProductAttributeMapping.Catalog.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
<Content Update="Areas\Admin\Views\BuilderProduct\_CreateOrUpdateProductAttributeMapping.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
<Content Update="Areas\Admin\Views\BuilderProduct\_CreateOrUpdateProductAttributeMapping.Info.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
<Content Update="Areas\Admin\Views\ProductBuilder\Configure.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
<Content Update="Areas\Admin\Views\_ViewImports.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Views\BuilderProduct\AttributeMappingProduct.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Views\BuilderProduct\Details.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Views\BuilderProduct\ProductDetails.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Views\BuilderProduct\_CatalogSelectors.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Views\BuilderProduct\_ProductBox.ProductBuilder.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Views\_ViewImports.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
</ItemGroup>
<ItemGroup>
<Folder Include="Areas\Admin\Controllers\" />
<Folder Include="Areas\Admin\Extensions\" />
<Folder Include="Areas\Admin\Factories\" />
<Folder Include="Areas\Admin\Infrastructure\" />
<Folder Include="Areas\Admin\Models\" />
<Folder Include="Areas\Admin\Views\" />
<Folder Include="Controllers\" />
<Folder Include="Extensions\" />
<Folder Include="Factories\" />
<Folder Include="Models\" />
</ItemGroup>
<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" />
</ItemGroup>
<ItemGroup>
<None Update="Views\Shared\Components\Default.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Views\_ViewImports.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</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>
</Project>
EDIT
Plugin.json
{
"InstalledPluginNames": [
"Widgets.GoogleAnalytics",
"Widgets.NivoSlider",
"ExternalAuth.Facebook",
"Misc.Cards",
"Payments.PayPalSmartPaymentButtons",
"Payments.PayPalStandard",
"Catalog.SkipToProduct"
],
"PluginNamesToUninstall": [],
"PluginNamesToDelete": [
"DiscountRequirement.MustBeAssignedToCustomerRole",
"CurrencyExchange.ECB",
"Misc.SendinBlue",
"Payments.CheckMoneyOrder",
"Payments.Manual",
"Payments.Qualpay",
"Payments.Square",
"Pickup.PickupInStore",
"Shipping.FixedByWeightByTotal",
"Shipping.UPS",
"Tax.Avalara",
"Tax.FixedOrByCountryStateZip"
],
"PluginNamesToInstall": []
}
the problem might be a reference, because when you add the reference DiscountRequirement.MustBeAssignedToCustomerRole to another plugin you need to put in the property Copylocal = false.
There are a few places that are having the error. Can't give an answer without checking such as plugin.json, dependencyregister.cs, plugin.cs,etc..
But when you familiar with it you can find your own way to speed up
your developments.
tip: This is the easiest way if you are still getting any issue with your plugin.
Just take a copy of small original plugin such as 'Nop.Plugin.Payments.Qualpay,Square,SendinBlue' and rename then edit .proj file set output folder.
remove all the unnecessary classes, files, and folders except 'DependencyRegistrar.cs,RouteProvider.cs,plugin.json,StartUpPlugin.cs'
change the namespaces of remaining files and remove unnecessary codes.
In plugin.json "SupportedVersions": [ "4.20" ] is a must value
build and clear all the errors.
It should appear on 'Configuration > Local Configuration'
tip: This is the my project building best practice when I'm getting references errors
Clean the solution
go to ~/API/Presentation/Nop.Web/Plugins folder and remove all the build folders.
Right-click on 'Libraries' folder and build it.
Right-click on 'Presentation' folder and build it.
Right-click on 'Plugins' folder and build it.
Good luck..!!
you can refer below as a template
plugin.json ("SupportedVersions": [ "4.20" ] is a must value) otherwise plugin service won't pick your plugin
{
"Group": "Plugin group name",
"FriendlyName": "Elastic Search",
"SystemName": "Custom.Plugin.ElasticSearch",
"Version": "1.56",
"SupportedVersions": [ "4.20" ],
"Author": "Isanka Thalagala",
"DisplayOrder": 27,
"FileName": "Custom.Plugin.ElasticSearch.dll",
"Description": "This plugin provice ilastic search"
}
DependencyRegistrar.cs class
public class DependencyRegistrar : IDependencyRegistrar
{
/// <summary>
/// Register services and interfaces
/// </summary>
/// <param name="builder">Container builder</param>
/// <param name="typeFinder">Type finder</param>
/// <param name="config">Config</param>
public virtual void Register(ContainerBuilder builder, ITypeFinder typeFinder, NopConfig config)
{
//register service manager
builder.RegisterType<SearchFilterService>().As<ISearchFilterService>().InstancePerLifetimeScope();
builder.RegisterType<ElasticSearchService>().As<IElasticSearchService>().InstancePerLifetimeScope();
}
/// <summary>
/// Gets order of this dependency registrar implementation
/// </summary>
public int Order => 1;
}
ElasticSearchPlugin.cs
public class ElasticSearchPlugin : BasePlugin
{
#region Ctor
public ElasticSearchPlugin()
{
}
#endregion
#region Methods
/// <summary>
/// Install the plugin
/// </summary>
public override void Install()
{
base.Install();
}
/// <summary>
/// Uninstall the plugin
/// </summary>
public override void Uninstall()
{
base.Uninstall();
}
#endregion
/// <summary>
/// Gets a value indicating whether to hide this plugin on the widget list page in the admin area
/// </summary>
public bool HideInWidgetList => true;
}
Please clear your bin and delete all of the plugin under this "Nop.Web -> Plugins" folder once. This works for me.
Thanks

Blazor Core Hosted - all Components in Razor Class Library Project are being printed as HTML on the page

I haven't been able to find the keywords for a similar issue, so I'm posting a new one.
The project was working fine and suddenly the issue described below happened. I was only editing some Razor files from the Razor Class Library, so I was unable to trace it back to any code modification I made.
The Issue:
I have the following project structure:
The Client, Server and Shared are projects that were initially created by the Blazor Template in the NET Core 3.0. DesktopClient is a similar Blazor project with ElectronNET and the issue is also happening on the component over there.The SharedLibrary project is the project where the components common to all projects are placed and where the root of the issue is apparently coming from.
The SharedLibrary is referenced on the Client project so I can access the components in the Client project.
What happened is that suddenly the components from the Razor Class Library stopped being "compiled" and all "#" are being printed as Raw HTML like the button for the "Counter 2":
[]
Notice as how there are 3 buttons on the image. The first one is in the base Razor page and is being compiled correctly. Second one is from the SharedLibrary project and is not being compiled apparently as the "#" tag is not being replaced. And the third button is from a Component in the Client project(same project as the base Razor page) and is also working correctly.
So the issue is that the SharedLibrary Razor files are not being "compiled".
What I've tried:
Remove and add reference from project;
Clean and rebuild solution;
Update packages;
Checked .csproj to see if I could find anything wrong/missing (not experienced on this file, so might have missed something).
Created a new Blazor Core Hosted project and added a Razor Class Library with the same setup as this demo. It worked fine, so the problem in on this project. Dependencies and ".csproj" files seem very similar.
The code:
.csproj for Client project:
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputType>Exe</OutputType>
<LangVersion>8.0</LangVersion>
<Nullable>enable</Nullable>
<RazorLangVersion>3.0</RazorLangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Blazor.Extensions.SignalR" Version="0.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview9.19465.2" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview9.19465.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.0.0-preview9.19465.2" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.0.0-preview9.19465.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\SharedLibrary\SharedLibrary.csproj" />
<ProjectReference Include="..\Shared\ServerAPI.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<Content Include="..\..\SharedLibrary\Content\styles\font\**\*.*">
<Link>wwwroot\styles\font\%(RecursiveDir)%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\SharedLibrary\Content\images\system\*.*">
<Link>wwwroot\images\system\%(RecursiveDir)%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\SharedLibrary\Content\images\social\brands\*.*">
<Link>wwwroot\images\social\brands\%(RecursiveDir)%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Compile Remove="bin\**" />
<Content Remove="bin\**" />
<EmbeddedResource Remove="bin\**" />
<None Remove="bin\**" />
<Content Remove="compilerconfig.json" />
</ItemGroup>
<ItemGroup>
<_ContentIncludedByDefault Remove="compilerconfig.json" />
<_ContentIncludedByDefault Remove="wwwroot\styles\main.css" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
<Folder Include="Services\" />
<Folder Include="wwwroot\images\system\" />
<Folder Include="wwwroot\scripts\" />
</ItemGroup>
<ItemGroup>
<None Include="compilerconfig.json" />
</ItemGroup>
<ItemGroup>
<Content Update="wwwroot\styles\main.css">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Target Name="CopyLinkedContentFiles" BeforeTargets="Build">
<Copy SourceFiles="%(Content.Identity)" DestinationFiles="%(Content.Link)" SkipUnchangedFiles="true" OverwriteReadOnlyFiles="true" Condition="'%(Content.Link)' != ''" />
</Target>
</Project>
.csproj for SharedLibrary
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputType>Library</OutputType>
<IsPackable>true</IsPackable>
<BlazorLinkOnBuild>false</BlazorLinkOnBuild>
<LangVersion>8.0</LangVersion>
<Nullable>enable</Nullable>
<RazorLangVersion>3.0</RazorLangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Blazor.Extensions.SignalR" Version="0.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview9.19465.2" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview9.19465.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="3.0.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Content\images\social\brands\" />
<Folder Include="Core\Login\" />
<Folder Include="Core\Login\OAuth2\" />
<Folder Include="Services\" />
</ItemGroup>
<ItemGroup>
<Compile Update="Resources\Languages\en-US.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>en-US.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources\Languages\en-US.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>en-US.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>
Index.razor
#page "/"
#using ServerAPI.Client.Components
#using SharedLibrary.Components.User
<h1>Counter</h1>
<p>Current count: #currentCount</p>
<button class="btn btn-primary" #onclick="IncrementCount">Click me</button>
#code {
int currentCount = 0;
void IncrementCount()
{
currentCount++;
}
}
<SocialWithFormLoginComponent />
<Counter />
SocialWithFormLoginComponent.razor in SharedLibrary project
<h1>Counter 2</h1>
<p>Current count 2: #currentCount2</p>
<button class="btn btn-primary" #onclick="IncrementCount2">Click me 2</button>
#code {
int currentCount2 = 0;
void IncrementCount2()
{
currentCount2++;
StateHasChanged();
Console.WriteLine("Hello world!");
}
}
Counter.razor in Client project
<h1>Counter 3</h1>
<p>Current count 3: #currentCount3</p>
<button class="btn btn-primary" #onclick="IncrementCount3">Click me 3</button>
#code {
int currentCount3 = 0;
void IncrementCount3()
{
currentCount3++;
StateHasChanged();
Console.WriteLine("Hello world!");
}
}
Final comments
As you can see the code is very simple for my troubleshooting, however the project is not, so re-creating would be a lot of work.
Any suggestions I might try? I'm really confused here.
Thanks in advance!
Update with solution:
Turns out, as #dani hererra posted, I was missing "_Imports.razor" in the folder on my components from the attached Razor Class library like so:
Check Microsoft.AspNetCore.Components.Web is listed on _Imports.razor:
#using System.Net.Http
#using Microsoft.AspNetCore.Authorization
#using Microsoft.AspNetCore.Components.Authorization
#using Microsoft.AspNetCore.Components.Forms
#using Microsoft.AspNetCore.Components.Routing
#using Microsoft.AspNetCore.Components.Web //<-----
#using Microsoft.JSInterop
#using _your_namespace_
#using _your_namespace_.Shared

Microsoft.WebApplication.targets + Disable_CopyWebApplication=True doesn't prevent a csproj from creating a _PublishedWebsites folder

Got a dummy project + a console project which apply xslt transformations so they employ Microsoft.WebApplication.targets in their respective .csproj files like so:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{39560935-7551-4789-9666-4A48AD0FE3C7}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>...</RootNamespace>
<AssemblyName>...</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
**<Disable_CopyWebApplication>True</Disable_CopyWebApplication>**
</PropertyGroup>
[...]
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<UsingTask TaskName="TransformXml" AssemblyFile="$(VSToolsPath)\Web\Microsoft.Web.Publishing.Tasks.dll" />
<Target Name="BeforeBuild">
<Exec Command=".\.nuget\nuget.exe restore .\packages.config -PackagesDirectory .\..\packages" />
<Delete Files="Config\ConnectionStrings\ConnectionStrings.config" />
<Message Text="=====================================================================================================================================================" />
<Message Text="Applying XSLT transformations (Disable_CopyWebApplication='$(Disable_CopyWebApplication)') using 'Microsoft.WebApplication.targets' from:" />
<Message Text="" />
<Message Text="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" />
<Message Text="" />
<TransformXml Source="Config\ConnectionStrings\ConnectionStrings.base.config" Transform="Config\ConnectionStrings\ConnectionStrings.$(Configuration.Replace('dbg#', '').Replace('rls#', '')).config" Destination="Config\ConnectionStrings\ConnectionStrings.config" />
<Message Text="=====================================================================================================================================================" />
</Target>
To generate production builds for said projects in our build server we build them like so:
<MSBuild Projects="$(_solutionFile)"
Targets="$(TargetProject)"
Properties="Platform=$(Platform);OutputPath=$(PublishUrl);Configuration=$(Configuration);"
ToolsVersion="15.0"
/>
As shown above we employ
<Disable_CopyWebApplication>True</Disable_CopyWebApplication>
Still the _PublishedWebsite folder does get created anyways. What could we be missing here?
UPDATE
According to the debugging statements we placed in our .csproj file the "Microsoft.WebApplication.targets" which gets employed during the build is this one:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets"
The internal task which copies the "website" (exe in our case) is this:
<Target Name="_CopyWebApplication"
Condition="!$(Disable_CopyWebApplication) And '$(OutDir)' != '$(OutputPath)'"
DependsOnTargets="$(_CopyWebApplicationDependsOn)">
<CallTarget Condition="'$(OnAfter_CopyWebApplication)' != ''" Targets="$(OnAfter_CopyWebApplication)" RunEachTargetSeparately="true" />
</Target>
This task appears to be working as intended because it turns out that _PublishedWebsite doesn't contain any of the compiled dlls of the exe-project. It contains only the roslyn dlls/exes with the following folder structure:
<Project_Output_Folder>\_PublishedWebsites\<Project.Name.Here>\bin\roslyn
I take it that the inclusion of the nuget packages:
Microsoft.Net.Compilers
and/or
Microsoft.CodeDom.Providers.DotNetCompilerPlatform
is what's causing the problem. The nuget packages being used are these:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.2.0" targetFramework="net471" allowedVersions="[6.2.0]" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.8" targetFramework="net471" allowedVersions="[1.0.8]" />
<package id="Microsoft.Net.Compilers" version="2.6.1" targetFramework="net471" developmentDependency="true" allowedVersions="[2.6.1]" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net471" allowedVersions="[10.0.3]" />
<package id="Oracle.ManagedDataAccess" version="12.2.1100" targetFramework="net471" allowedVersions="[12.2.1100]" />
<package id="Oracle.ManagedDataAccess.EntityFramework" version="12.2.1100" targetFramework="net471" allowedVersions="[12.2.1100]" />
<package id="StructureMap" version="4.6.1" targetFramework="net471" allowedVersions="[4.6.1]" />
<package id="System.Reflection.Emit.Lightweight" version="4.3.0" targetFramework="net471" allowedVersions="[4.3.0]" />
</packages>
So I guess the question boils down to how can one make the Compilers package respect the dont-copy flag we are setting?

Resources