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

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?

Related

How to loop macrodef in Ant script?

Currently, I am writing an Ant Script that removes the signatures of signed Jar files.
Removing the signature for a single jar file was successful using the script below.
<project name="unsign">
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="ant-lib/ant-contrib-0.6.jar" />
<property name="jarPath" location="C:\Users\Administrator\Desktop\tempDir" />
<property name="resultPath" location="C:\Users\Administrator\Desktop\tempDir-result" />
<target name="unsignJar">
<unsignjar jarFile="${jarPath}/com.google.guava_15.0.0.v201403281430.jar" />
</target>
<macrodef name="unsignjar" description="Unsign a jar file">
<attribute name="jarfile" description="Jar file to unsign " />
<sequential>
<copy toFile="#{jarFile}_MANIFEST.tmp">
<resources>
<zipentry zipfile="#{jarFile}" name="META-INF/MANIFEST.MF" />
</resources>
</copy>
<replaceregexp file="#{jarFile}_MANIFEST.tmp" match="\nName:(.+?)\nSH" replace="SH" flags="gis" byline="false" />
<replaceregexp file="#{jarFile}_MANIFEST.tmp" match="SHA(.*)" replace="" flags="gis" byline="false" />
<jar jarfile="#{jarFile}.tmp" manifest="#{jarFile}_MANIFEST.tmp">
<zipfileset src="#{jarFile}">
<include name="**" />
<exclude name="META-INF/*.SF" />
<exclude name="META-INF/*.DSA" />
<exclude name="META-INF/*.RSA" />
</zipfileset>
</jar>
<!-- Removing the temporary manifest -->
<delete file="#{jarFile}_MANIFEST.tmp" />
<!-- Swapping the original Jar file with the temporary one -->
<move file="#{jarFile}.tmp" tofile="#{jarFile}" overwrite="true" />
</sequential>
</macrodef>
</project>

Unable to create third index in elastic search for logging using NLog in Asp.net core

Hello Everyone,
I am new to the elk stack and trying to do logging using elastic search. I want to create different index for different different services in api. I am able to create two indexes of different services but can not do the same for third index.
Following is my nconfig file
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="false"
internalLogLevel="Trace" internalLogFile="c:\temp1\nlog-internal.log">
<!-- optional, add some variables
https://github.com/nlog/NLog/wiki/Configuration-file#variables
-->
<variable name="myvar" value="myvalue"/>
<extensions>
<add assembly="NLog.Targets.ElasticSearch"/>
<add assembly="NLog.Web.AspNetCore"/>
</extensions>
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<targets>
<!--
add your targets here
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
-->
<target xsi:type="File" name="f" fileName="${basedir}/logs/log.txt"
archiveFileName="${basedir}/logs/archives/log.txt"
archiveAboveSize="5242880"
archiveEvery="Day"
archiveNumbering = "Rolling"
maxArchiveFiles="3"
layout="${longdate} ${uppercase:${level}} ${message}" />
<target xsi:type="BufferingWrapper" name="ElasticSearch"
flushTimeout="5000">
<target xsi:type="ElasticSearch" name="elastic" index="aquaparallelapi"
uri="http://localhost:9200"
layout ="API:aquaparallelapi|${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
</target>
<target xsi:type="BufferingWrapper" name="ElasticSearch"
flushTimeout="5000">
<target xsi:type="ElasticSearch" name="elastic1" index="aquaparallelapiprogress"
uri="http://localhost:9200"
layout ="API:aquaparallelapi|${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
</target>
<target xsi:type="BufferingWrapper" name="ElasticSearch"
flushTimeout="5000">
<target xsi:type="ElasticSearch" name="elastic2" index="aquaparallelapitestcase"
uri="http://localhost:9200"
layout ="API:aquaparallelapi|${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
</target>
<!--
Write events to a file with the date in the filename.
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
-->
</targets>
<rules>
<!-- add your logging rules here -->
<logger enabled="true" name="*" minlevel="Debug" writeTo="f" />
<logger enabled="true" name="*" minlevel="Debug" writeTo="elastic" />
<logger enabled="true" name="AquaParallelAPI.Controllers.ProgressController" minlevel="Debug" writeTo="elastic1" />
<logger enabled="true" name="AquaParallelAPI.Controllers.TestCaseController" minlevel="Debug" writeTo="elastic2" />
</rules>
</nlog>
As you can see above indexes aquaparallelapi and aquaparallelapiprogress is created and gives the desired result but index aquaparallelapitestcase is not created. When I tried to do
http://localhost:9200/aquaparallelapitestcase
then
{"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index [aquaparallelapitestcase]","resource.type":"index_or_alias","resource.id":"aquaparallelapitestcase","index_uuid":"_na_","index":"aquaparallelapitestcase"}],"type":"index_not_found_exception","reason":"no such index [aquaparallelapitestcase]","resource.type":"index_or_alias","resource.id":"aquaparallelapitestcase","index_uuid":"_na_","index":"aquaparallelapitestcase"},"status":404}
Please let me know where I am wrong?

Unable to set log rotation for the file logging in the nLog config

I am unable to set log rotation in my logs files. The Archive Folder is not created in the logs folder.
Following is some part of nlog.conf file
<targets>
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
archiveFileName="${basedir}/logs/archives/${shortdate}.log"
archiveAboveSize="5242880"
archiveEvery="Day"
archiveNumbering = "Rolling"
maxArchiveFiles="3"
layout="${longdate} ${uppercase:${level}} ${message}" />
<target xsi:type="BufferingWrapper" name="ElasticSearch"
flushTimeout="5000">
<target xsi:type="ElasticSearch" name="elastic" index="aquaparallelapi"
TypeName="null"
BatchAction = "ElasticOpType.Create"
uri="http://localhost:9200"
layout ="API:aquaparallelapi|${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
</target>
<!--
Write events to a file with the date in the filename.
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
-->
</targets>
<rules>
<!-- add your logging rules here -->
<logger enabled="true" name="*" minlevel="Debug" writeTo="f" />
<logger enabled="true" name="*" minlevel="Debug" writeTo="elastic" />
</rules>
I can see my log files. But not able to archive them.
Please let me know , where am I wrong

Exclude target framework from NuGet package

How can i exclude specific target framework from nuspec (NuGet package) generation?
This is my csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net5.0;net5.0-windows</TargetFrameworks>
<IsPackable>true</IsPackable>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net5.0-windows'">
<IsPackable>false</IsPackable>
</PropertyGroup>
</Project>
dotnet pack command generates NuGet package that contains all target frameworks not only netstandard2.0 and net5.0
Generated nuspec:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>ExampleLibrary</id>
<version>1.0.0</version>
<authors>ExampleLibrary</authors>
<description>Package Description</description>
<dependencies>
<group targetFramework="net5.0" />
<group targetFramework="net5.0-windows7.0" />
<group targetFramework=".NETStandard2.0" />
</dependencies>
</metadata>
</package>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net5.0;net5.0-windows7.0</TargetFrameworks>
<IsPackable>true</IsPackable>
<GenerateNuspecDependsOn>$(GenerateNuspecDependsOn);_ExcludeTargetFramework;_ExcludeTargetFrameworkDependency</GenerateNuspecDependsOn>
</PropertyGroup>
<Target Name="_ExcludeTargetFramework" AfterTargets="_GetTargetFrameworksOutput" BeforeTargets="_WalkEachTargetPerFramework">
<ItemGroup>
<_TargetFrameworks Remove="net5.0-windows7.0" />
</ItemGroup>
</Target>
<Target Name="_ExcludeTargetFrameworkDependency" AfterTargets="_WalkEachTargetPerFramework" BeforeTargets="GenerateNuspec">
<ItemGroup>
<_FrameworksWithSuppressedDependencies Include="net5.0-windows7.0" />
</ItemGroup>
</Target>
</Project>
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>ExampleLibrary</id>
<version>1.0.0</version>
<authors>ExampleLibrary</authors>
<description>Package Description</description>
<dependencies>
<group targetFramework="net5.0" />
<group targetFramework=".NETStandard2.0" />
</dependencies>
</metadata>
</package>
Remove all the dependencies (including TargetFramework)
In case you want to remove all dependencies (ie all target frameworks), the above solution won't work. Build will fail with the following error:
error MSB4044: The "ResolvePackageAssets" task was not given a value for the required parameter "TargetFramework".
Easy way
In case you just want to remove all dependencies, you can use the SuppressDependenciesWhenPacking property.
<PropertyGroup>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
</PropertyGroup>
Full control of Nuspec
Otherwise, if you want to have a full control on the content of Nuspec after a first pass of generation, you can use a variation of this:
<?xml version="1.0" encoding="utf-8"?>
<Project>
<UsingTask
TaskName="RemoveDependencies"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll" >
<ParameterGroup>
<Nuspec ParameterType="System.String" Required="true"/>
</ParameterGroup>
<Task>
<Reference Include="System.Xml"/>
<Reference Include="System.Xml.Linq"/>
<Using Namespace="System"/>
<Using Namespace="System.IO"/>
<Using Namespace="System.Xml.Linq"/>
<Code Type="Fragment" Language="cs">
<!-- Modify XML of the NuSpec -->
<![CDATA[
XElement doc = XElement.Load(Nuspec);
var dependenciesElement = doc.Descendants(XName.Get("dependencies", "http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd")).FirstOrDefault();
if (dependenciesElement != null)
{
dependenciesElement.Remove();
}
using (var textWriter = File.CreateText(Nuspec))
{
doc.Save(textWriter);
}]]>
</Code>
</Task>
</UsingTask>
<!-- From https://stackoverflow.com/questions/53762903/how-to-inject-a-custom-dependency-in-an-msbuild-nuget-pack-generated-nuspec -->
<!-- Disable nupkg generation before running pack -->
<Target Name="__DisablePacking" BeforeTargets="GenerateNuspec" Condition="$(NuspecFile) == '' And $(IsPackable) != 'false'">
<PropertyGroup>
<ContinuePackingAfterGeneratingNuspec>false</ContinuePackingAfterGeneratingNuspec>
</PropertyGroup>
</Target>
<!-- Remove .Net Standard 2.0 dependency as it's a native package -->
<!-- Modify the generated nuspec file and rerun the pack target -->
<Target Name="__ExcludeTargetFrameworkDependency" AfterTargets="Pack" Condition="$(NuspecFile) == '' And $(IsPackable) != 'false'">
<!-- Get the nuspec file name -->
<PropertyGroup>
<_NugetPackOutputAsProperty>#(NuGetPackOutput)</_NugetPackOutputAsProperty>
</PropertyGroup>
<ItemGroup>
<_NugetPackOutputAsItem Remove="#(_NugetPackOutputAsItem)"/>
<_NugetPackOutputAsItem Include="$(_NugetPackOutputAsProperty.Split(';'))" />
</ItemGroup>
<PropertyGroup>
<__NuspecFileName>%(_NugetPackOutputAsItem.Identity)</__NuspecFileName>
</PropertyGroup>
<Message Importance="High" Text="Remove Dependencies from $(__NuspecFileName)" />
<RemoveDependencies Nuspec="$(__NuspecFileName)" />
<!-- Invoke the Pack target again with packing enabled -->
<PropertyGroup>
<ContinuePackingAfterGeneratingNuspec>true</ContinuePackingAfterGeneratingNuspec>
</PropertyGroup>
<MsBuild
Projects="$(MSBuildProjectFullPath)"
Targets="Pack"
Properties="NuspecFile=$(__NuspecFileName);NoPackageAnalysis=true">
</MsBuild>
</Target>
</Project>
Notes:
GenerateNuspec target is doing both generation and packing. To disable packing after nuspec generation, we can use the ContinuePackingAfterGeneratingNuspec property.
Pack target is invoked twice (once by the user) and the second time with the system after first pack.
__ExcludeTargetFrameworkDependency rely on the Nuspec File value to be empty to execute on the first pack and to not execute on the second run. It obviously won't work if a Nuspec file is provided for the first run (with NuspecFile property).
Note the usage of And $(IsPackable) != 'false' to avoid invoking the target on test projects.
All NuGet targets like GenerateNuspec are located in C:\Program Files\dotnet\sdk\6.0.308\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets
All NuGet tasks for .NET 6, like PackTask, are located in C:\Program Files\dotnet\sdk\6.0.308\Sdks\NuGet.Build.Tasks.Pack\Desktop\NuGet.Build.Tasks.Pack.dll

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

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>

Resources