I created a solution containing a website (not WebApp) with VS Express 2013. I use a web.Release.config file for the publish process. That worked well with VS 2013.
Now that I changed to VS 2019 Community, web.Debug.config was used for the web.config transformation though the publish was done for "Release". I suppose that is because in the configuration manager only "Debug" is possible for any configuration.
In another thread I found that I had to change website.publishproj from Debug to Release:
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
Now, web.Release.config is used for the transformation:
"web.config" wurde mithilfe von "C:\Users\<project path>\Web.Release.config" in "C:\Users\<some temporary path>\obj\Release\TransformWebConfig\transformed\web.config" transformiert.
This file actually has the changes applied that are needed for Release.
However, in the destination directory web.config does not contain these changes. It seems to be the original web.config without transformation.
What must I do to make Publish copy the transformed web.config?
This is my .pubxml file:
<?xml version="1.0" encoding="utf-8"?>
<!--
Auto generated comment...
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<PublishProvider>FileSystem</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>C:\Inetpub\vhosts\<website name>.com\httpdocs</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
</PropertyGroup>
and here is website.publishproj:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.30319</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{45ff7195-6038-4b17-91ce-611a467ac837}</ProjectGuid>
<SourceWebPhysicalPath>$(MSBuildThisFileDirectory)</SourceWebPhysicalPath>
<SourceWebVirtualPath>/(Source Path Name)</SourceWebVirtualPath>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<SourceWebProject>http://localhost:56406</SourceWebProject>
<SourceWebMetabasePath>/IISExpress/7.5/LM/W3SVC/2/ROOT</SourceWebMetabasePath>
</PropertyGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<!-- for VS2010 we need to use 10.5 but for VS2012+ we should use VisualStudioVersion -->
<WebPublishTargetsVersion Condition=" '$(WebPublishTargetsVersion)' =='' and '$(VisualStudioVersion)' == 10.0 ">10.5</WebPublishTargetsVersion>
<WebPublishTargetsVersion Condition=" '$(WebPublishTargetsVersion)'=='' ">$(VisualStudioVersion)</WebPublishTargetsVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(WebPublishTargetsVersion)</VSToolsPath>
<_WebPublishTargetsPath Condition=" '$(_WebPublishTargetsPath)'=='' ">$(VSToolsPath)</_WebPublishTargetsPath>
<AssemblyFileVersion Condition="'$(AssemblyFileVersion)' == ''">1.0.0.0</AssemblyFileVersion>
<AssemblyVersion Condition="'$(AssemblyVersion)' == ''">1.0.0.0</AssemblyVersion>
</PropertyGroup>
<ItemGroup>
<AssemblyAttributes Include="AssemblyFileVersion">
<Value>$(AssemblyFileVersion)</Value>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyVersion">
<Value>$(AssemblyVersion)</Value>
</AssemblyAttributes>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Accessories\Lib\Runtime\BaseLib\BaseLib.csproj">
<Project>{8A827F3E-CA83-4765-988D-937B0B608201}</Project>
<Name>BaseLib</Name>
</ProjectReference>
<ProjectReference Include="..\Accessories\Lib\Runtime\Config\Config.csproj">
<Project>{1B78D777-B4F8-4CEA-9A4F-554807D1E5BF}</Project>
<Name>Config</Name>
</ProjectReference>
<ProjectReference Include="..\Accessories\Lib\Runtime\GardenLib\GardenLib.csproj">
<Project>{30B09928-B911-4803-982F-519C4CDB8860}</Project>
<Name>GardenLib</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(_WebPublishTargetsPath)\Web\Microsoft.WebSite.Publishing.targets" />
</Project>
After I got some more problems publishing my website, I switched back to VS2013 Express where my publish process works well as it did before.
Maybe it's a bug in Visual Studio?
Related
How to specify output path only for single target framework in new SDK csproj project style.
My project file has this PropertyGroup:
<PropertyGroup>
<OutputType>WinExe</OutputType>
<UseWPF>true</UseWPF>
</PropertyGroup>
I tried to add something like this above this group but didn't worked:
<Choose>
<When Condition=" '$(MyMsbuildParam)' == 'False' ">
<PropertyGroup>
<TargetFrameworks>net5.0-windows10.0.18362.0;net472</TargetFrameworks>
</PropertyGroup>
</When>
<When Condition=" '$(MyMsbuildParam)' == 'True' ">
<PropertyGroup>
<TargetFrameworks>net472</TargetFrameworks>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath >..\bin64\$(Configuration)\</OutputPath>
</PropertyGroup>
</When>
</Choose>
This is the error I'm getting:
Error MSB4044 The "ResolvePackageAssets" task was not given a value for the required parameter "TargetFramework".
C:\Program Files\dotnet\sdk\5.0.201\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 241
In my projects Visual Studio gives me recommendations to use C# 8.0 features for Framework 4.6 projects, even though the default is specified on the Microsoft documentations to be 7.3. An example of one of the suggestions:
var i1 = "";
var i2 = "";
i1 = i1 ?? i2; //suggests i1 ??= i2;
If I let VS correct the suggestions the IDE shows me no errors or warnings, but the moment I build I get a compiler error.
I know I can change the langversion in the .csproj file to get it to work, but that's not the point.
Why do I get suggestions and then proceed to get no errors until compilation?
In my memory I used to get suggestions to automatically upgrade the project to the langversion for 7.X features in the past, if I wanted to use features from that version.
Example of one of the .csproj files:
<?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>{00000000-0000-0000-0000-000000000000}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>MyProject</RootNamespace>
<AssemblyName>MyProject</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
//... References & compilation files
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Updating the Microsoft.Net.Compilers NuGet package worked for me.
I updated from 2.10.0 to 3.11.0.
I created a default .Net Core 1.0.1 Class library and changed buildOptions in project.json to include debugType: "Full". I used the integrated VS 2015 Fortify Scan using 16.11 and I get the errors below. How should I scan dotnet core to avoid this problem?
Project 'src\providesFileInPackage\providesFileInPackage.xproj' is not configured to output full debug information. SCA Analysis requires full debug symbols. Would you like to ignore project and continue?
(Project Properties -> Build -> "Advanced" button -> Debug Info -> "Full"
OR
Project Properties -> Compile -> Advanced Options -> Debug Info -> "Full" for VB)
My project json looks like
{
"version": "1.0.0-*",
"dependencies": {
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.6": {
"imports": "dnxcore50"
}
},
"buildOptions": {
"define": [ "DEBUG" ],
"debugType": "full"
}
}
I had the same problem. It's blaming the xproj file and not project.json so I tried to add
<DebugType>full</DebugType>
inside the PropertyGroup but to no avail.
In the end I found a workaround by running Fortify from the command line:
msbuild MyApplicationSca.proj /p:Configuration=Release /t:Rebuild /m
My MyApplicationSca.proj looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MySolution>MyApplication.sln</MySolution>
<Configuration Condition=" $(Configuration) == '' ">Debug</Configuration>
<CommonMSBuildProperties>BuildingSolutionFileName=true</CommonMSBuildProperties>
<RunHPFortify Condition=" '$(RunHPFortify)' == '' ">false</RunHPFortify>
<HPFortifyPath Condition=" '$(HPFortifyPath)' == '' ">$(ProgramW6432)\HP_Fortify\HP_Fortify_SCA_and_Apps_4.40\</HPFortifyPath>
<FortifyMSBuildTasks>$(HPFortifyPath)Core\lib\FortifyMSBuildTasks.dll</FortifyMSBuildTasks>
</PropertyGroup>
<ItemGroup>
<Projects Include="$(MySolution)">
<AdditionalProperties>Platform=Any CPU</AdditionalProperties>
</Projects>
</ItemGroup>
<Target Name="Clean">
<MSBuild Projects="#(Projects)" Targets="Clean" Properties="$(CommonMSBuildProperties)" />
</Target>
<Target Name="Build">
<MSBuild Projects="#(Projects)" Targets="Build" Properties="$(CommonMSBuildProperties)"
StopOnFirstFailure="true" />
</Target>
<Target Name="Rebuild">
<MSBuild Projects="#(Projects)" Targets="Rebuild" Properties="$(CommonMSBuildProperties)"
StopOnFirstFailure="true" />
</Target>
<UsingTask TaskName="Fortify.CleanTask" AssemblyFile="$(FortifyMSBuildTasks)" />
<UsingTask TaskName="Fortify.TranslateTask" AssemblyFile="$(FortifyMSBuildTasks)" />
<UsingTask TaskName="Fortify.ScanTask" AssemblyFile="$(FortifyMSBuildTasks)" />
<Target Name="FortifyBuild" AfterTargets="Build;Rebuild" Condition="$(RunHPFortify)">
<PropertyGroup>
<BuildID>MyApplication</BuildID>
<HPFortifyLogsDir>..\HPFortifyLogs\</HPFortifyLogsDir>
<PackagesDir>$(MSBuildProjectDirectory)\packages\</PackagesDir>
<OutDir>$(MSBuildProjectDirectory)\MyApplication\bin\$(Configuration)\net452\win7-x64\</OutDir>
<SCATargetBinary>$(OutDir)MyApplication.exe</SCATargetBinary>
<FPRFilePath>$(HPFortifyLogsDir)MyApplication.fpr</FPRFilePath>
<SSCUploadToken Condition=" '$(SSCUploadToken)' == '' ">1cfe9977-905c-4da4-bb57-97e3dcc33099</SSCUploadToken>
</PropertyGroup>
<ItemGroup>
<TranslateTaskReferences Include="$(OutDir)" />
</ItemGroup>
<CleanTask BuildID="$(BuildID)" />
<TranslateTask
BuildID="$(BuildID)"
VSVersion="14.0"
JVMSettings="-Xmx1000M"
BinariesFolder="$(SCATargetBinary)"
References="#(TranslateTaskReferences)"
LogFile="$(HPFortifyLogsDir)sca_translate_task.log">
</TranslateTask>
<ScanTask
BuildID="$(BuildID)"
JVMSettings="-Xmx1000M"
LogFile="$(HPFortifyLogsDir)scan_task.log"
Output="$(FPRFilePath)" />
</Target>
</Project>
I am not investigating more than that right now but I hope this brings us a bit closer to the answer.
I have an asp.net mvc 3 project and a separate BusinessLayer project included in the solution. When I'm trying to deploy my site to Azure via local git repository, I'm getting the following error: '<remote_path>\BusinessLayer\BusinessLayer.csproj' is not a deployable project.. No other information is provided in logs. Site perfectly deploys on my local server. So I want to know at least some possible reasons why this error occurs. Thanks in advance.
Here's my .csproj file, if necessary:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{31F2F6FE-10D8-4510-AC61-CBE1962D3940}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BusinessLayer</RootNamespace>
<AssemblyName>BusinessLayer</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</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\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="MongoDB.Bson">
<HintPath>..\..\Libs\MongoDB.Bson.dll</HintPath>
</Reference>
<Reference Include="MongoDB.Driver">
<HintPath>..\..\Libs\MongoDB.Driver.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Battle.cs" />
<Compile Include="BattleManager.cs" />
<Compile Include="BattlePlace.cs" />
<Compile Include="Helpers\ConvertHelper.cs" />
<Compile Include="Helpers\ImageHelper.cs" />
<Compile Include="Message.cs" />
<Compile Include="Picture.cs" />
<Compile Include="Place.cs" />
<Compile Include="PlaceManager.cs" />
<Compile Include="Subject.cs" />
<Compile Include="User.cs" />
<Compile Include="Helpers\DBHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 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>
You may need to tell Azure exactly which project it should deploy, which you can do using a .deployment file at the root of your project. e.g.
[config]
project = WebProject/WebProject.csproj
Please see this page for more information about this.
Sounds like you're trying to deploy the BusinessLayer project and not the Website project. As long as your MVC site project has a reference to BusinessLayer, just deploy the website. BusinessLayer will be included as a reference.
You can't deploy BusinessLayer by itself, as it is a library and not an application.
I want to replace the ProductVersion value at <DefineConstants> node of the following xml. Remaining part of the line has to be preserved.
Example:
<DefineConstants>XXXXX;ProductVersion=20.323.23;YYYYY</DefineConstants>
to
<DefineConstants>XXXXX;ProductVersion=21.58.44;YYYYY</DefineConstants>
I tried the replaceregexp but it changes the remaining contents.
<replaceregexp file="${basedir}\Installer.wixproj"
match="ProductVersion=([0-9].*);(.*)"
replace="ProductVersion=${SpaceVersion};\1"
byline="true"
/>
Could you guide me what i am doing wrong in this.
XML:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.5</ProductVersion>
<ProjectGuid>{6bc0a85b-9c15-41e6-874b-5fe07e5338e6}</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>Installer</OutputName>
<OutputType>Package</OutputType>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug;</DefineConstants>
<WixVariables>
</WixVariables>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>SourceDir=$(SolutionDir)XSSE\;ProductVersion=3.3.1.75;ProductName=XSSE;ToolchinShortcut=XSSEToolchinShortcut;ExtensionDir=XSSE;ManifestFileName=extension.vsixmanifest;PkageDefFileName=XSSE.ToolchainProvider.pkgdef;REGKEY=Software\Microsoft\XSSE;</DefineConstants>
<WixVariables>XYZ=123;</WixVariables>
</PropertyGroup>
<ItemGroup>
<Compile Include="filefragment.wxs" />
<Compile Include="Product.wxs" />
</ItemGroup>
<ItemGroup>
<WixExtension Include="WixUIExtension">
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
<Name>WixUIExtension</Name>
</WixExtension>
</ItemGroup>
<Import Project="$(WixTargetsPath)" />
I think trying to capture the remainder of the line after the product version is unnecessary.
You don't need to worry about that. If your regex leaves the rest of the text alone, you can just replace the ProductVersion only.
I had success with this:
<replaceregexp file="${basedir}\Installer.wixproj"
match="ProductVersion=[0-9]+\.?[0-9]+\.?[0-9]+\.?[0-9]+\.?;"
replace="ProductVersion=${SpaceVersion};"
byline="true"
/>
You need to use \2 instead of \1.
<replaceregexp file="${basedir}\Installer.wixproj"
match="ProductVersion=([0-9].*);(.*)"
replace="ProductVersion=${SpaceVersion};\2"
byline="true"
/>
Standalone test:
<project default="test">
<property name="SpaceVersion" value="a.b.c"/>
<target name="test">
<replaceregexp file="test.xml"
match="ProductVersion=([0-9].*);(.*)"
replace="ProductVersion=${SpaceVersion};\2"
byline="true"
/>
</target>
</project>
Comparison of changed file with original:
$diff test.xml test.xml.0
2c2
< <DefineConstants>XXXXX;ProductVersion=a.b.c;YYYYY</DefineConstants>
---
> <DefineConstants>XXXXX;ProductVersion=20.323.23;YYYYY</DefineConstants>