The following condition:
<ItemGroup>
<FilteredReferences Include="#(SomeList)" Condition="$([System.String]::new('%(SomeList.SomeItem)').Contains('SearchTerm'))" />
</ItemGroup>
This does not work on MAC OSX. But works on WINDOWS. I just found out that it doesnt resolve the following term:
%(SomeList.SomeItem)
When I use a String instead - it works. So just for testing replace it with 'SearchTerm' - then the condition is working.
What is wrong here?
I solved the problem by switching from the standard used xbuild to msbuild in the build settings.
Related
I have a new .Net application where I have made a WIX installer for. The WIX installer is a copy paste from other solutions where it is working without problems. It makes use of heat to automatically harvest the files needed. However, now I have run into a problem where it doesn't work for the current project. In the proj file where the heatdirectory is described, there is the following condition
Condition="'%(ProjectReference.ContentProject)'=='True'"
This condition works in the other solutions, however now it means that heat is not run when build.
I have googled, but I haven't been able to find out what ProjectReference.ContentProject means ?
Can anybody enlighten me, what it means and why it might not work in this solution ?
Thank you.
ContentProject only means something if you include it in your ProjectReference. See an example here.
<ItemGroup>
<ProjectReference Include="..\MyWCF.WcfService\MyWCF.WcfService.csproj">
<Name>MyWCF.WcfService</Name>
<Project>{8e528b38-2826-4793-a66d-f6ff181e1139}</Project>
<Private>True</Private>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
<ContentProject>True</ContentProject>
<DoNotHarvest>True</DoNotHarvest>
<PackageThisProject>True</PackageThisProject>
</ProjectReference>
</ItemGroup>
Is there a way to disable Fody Costura? I need to perform some troubleshooting and I want to know that Fody Costura is not part of the problem. I would prefer to disable it instead of removing the nuget which would be one solution.
Removing <Costura/> from the Fody configuration gives the following error since I do not use any other weavers:
Fody: No configured weavers. It is possible you have not installed a weaver or have installed a fody weaver nuget into a project type that does not support install.ps1. You may need to add that weaver to FodyWeavers.xml manually. eg. <Weavers><WeaverName/></Weavers>. see https://github.com/Fody/Fody/wiki/SampleUsage
Yes you can comment out or remove the <Costura /> line from FodyWeavers.xml
AFAIK, there is no way to turn off Costura but you can exclude all of your references manually:
<Costura>
<ExcludeAssemblies>
Foo
Bar
</ExcludeAssemblies>
</Costura>
Notice it doesn't include .dll/.exe extension (it's Foo instead of Foo.dll)
Also, if you are embedding native / unmanaged dll, make sure you switched Build Action of those libraries to None
For more information:
https://github.com/Fody/Costura#excludeassemblies
open the .csproj file, search for "fody", then remove all the tags that include it. such as
<Error Condition="!Exists('..\packages\Fody.1.29.4\build\dotnet\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.29.4\build\dotnet\Fody.targets'))" />
</Target>
<Import Project="..\packages\Fody.1.29.4\build\dotnet\Fody.targets" Condition="Exists('..\packages\Fody.1.29.4\build\dotnet\Fody.targets')" />
those are after this tag
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
https://github.com/Fody/Costura/issues/143#issuecomment-378612705
<DisableFody Condition="'$(Configuration)' == 'Debug'">true</DisableFody>
I know this is an older thread, but I found success also with including an empty IncludeAssemlies section in FodyWeavers.xml. Costura then includes none.
<IncludeAssemblies>
</IncludeAssemblies>
We use MSBuild on our CI server to compile our WebApp, however the build omits the JavaScript files built by TypeScript from the output of the build.
I would expect the output to contain the JavaScript and not the Typescript, however neither are in the output at the expected locations.
How can I include the JavaScript files without having to have them all in my solution? The TypeScript team seems to think this is bad, but I would rather not have duplicates of all the files in my solution either.
The problem was due to using MSBuild instead of the "Publish" on the build server it seems. I added an AfterBuild target to content include all of the JS files to the build output.
<Target Name="AfterBuild">
<ItemGroup>
<Content Include="**\*.js" />
</ItemGroup>
</Target>
Although this is not ideal, it allows the js files not to show in the solution when using visual studio and the files end up in the build output.
I tried many solutions from the web including the <Content Include="**\*.js" />, but nothing worked. I'm using MSBuild on my local dev box and typescript is installed and targets available in C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\TypeScript.
It turns out my "old" MSBuild runner for web app csproj files is obsolete. I was doing this:
MSBuild.exe my.csproj /Target:ResolveReferences;_CopyWebApplication /property:WebProjectOutputDir=myfolder;OutDir=myfolder\bin;Configuration=Debug
but thanks to this post I need to use UseWPP_CopyWebApplication instead of the legacy _CopyWebApplication:
MSBuild.exe /t:Rebuild "/p:WebProjectOutputDir=myfolder;OutDir=myfolder\bin;Configuration=Debug;UseWPP_CopyWebApplication=True;PipelineDependsOnBuild=False" my.csproj
Now without any editing of the csproj file, all my TypeScript is included!
TypeScript is probably not installed on your build server. To install it, copy your TypeScript folder from c:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\ to the same folder on your build server (where v12 is the version of your Visual Studio).
The Visual Studio version on your build server can be different however. In my situation, the version on my development machine is v12, while the build server uses v11. I found that out by adding the following to the [WebProjectName].csproj file:
<Target Name="PrintVisualStudioInfo">
<Message Text="VisualStudioVersion: '$(VisualStudioVersion)'" Importance="High" />
</Target>
<PropertyGroup>
<CompileDependsOn>
PrintVisualStudioInfo;
$(CompileDependsOn)
</CompileDependsOn>
</PropertyGroup>
Be sure you put it after the last <Import /> element. Now when you look at the output of your build on the build server, you should see 'VisualStudioVersion: xx' somewhere.
Copy the TypeScript folder to the correct version folder on the build server.
Just adding in case it helps people.
We had this issue recently and it was fixed by adding
/p:VisualStudioVersion=12.0 to the BAT file :
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe FullBuild.proj /p:VisualStudioVersion=12.0 /t:createRelease /p:ReleaseNumber=5.22.0
I have created a custom .proj file that builds my web site project's solution. It seems to all work correctly and it produces an output. However, when I put it on the server, I got an error about "/Default.aspx is not precompiled and cannot be requested". After some digging I discovered that indeed the precompiled aspx files were not precompiling. In the output from msbuild, I found a call to aspnet_compiler:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /WebApplication -p WebApplication\ -f -fixednames Output_PublishedWebsites\WebApplication\
When I run this command directly, it generates everything just fine.
How can I get my msbuild wrapper to perform this correctly?
My msbuild task looks like this:
<MSBuild Projects="$(SolutionFile)"
Properties="OutDir=$(OutputRoot);
Configuration=$(AspNetConfiguration)"
Targets="Build" />
I solved this by using the <AspNetCompiler /> task.
Heads up: I'm a total MSDeploy noob. In fact, this is my first attempt at creating a msbuild script and I'm only recently started looking into msdeploy.
Now that that's out of the way, I'm writing a build script to compile and package my ASP.Net webforms application. The script can compile the solution, however, I'm getting the following error when attempting to package:
Microsoft.Web.Deployment.DeploymentException: The library 'Microsoft.Data.Tools.Schema.DbSqlPackage, Version=10.3.0.0, ...' could not be loaded.
I've searched the web but I can't seem to find any instances of this issue (specific to the missing DbSqlPackage.dll). I assume this has something to do with the ability to package and deploy databases referenced in the solution.
I am using MSDeploy V3 and MSBuild v4.0.30319. The Package target of the .build file is as follows:
<Target Name="Package" DependsOnTargets="Compile">
<PropertyGroup>
<PackageDir>%(PackageFile.RootDir)%(PackageFile.Directory)</PackageDir>
<Source>%(Website.FullPath)</Source>
<Destination>%(PackageFile.FullPath)</Destination>
</PropertyGroup>
<MakeDir Directories="$(PackageDir)" />
<Exec Command='"#(MsDeploy)" -verb:sync -source:iisApp="$(Source)" -dest:package="$(Destination)"' />
I am not trying to include any databases and I would be happy if there is a switch that I can set to bypass the error all together. However, if anyone knows how to FIX and not just avoid the issue, that would be preferred.
Thanks in advance.
Vinney
I tried to repair the installation of MS Web Deploy but no dice. Except, my filter terms "web deploy" turned up another item in my installed programs: "Web Deploy dbSqlPackage Provider" (or something along those lines... it's late). The build/package completes after removing this program.
It only took me half a day to find this solution... oh well!