Wix project error in TFS build - tfs

I am building a solution that contains a Wix v3.6 project on Team Foundation Server (TFS 2010). The solution also contains some other class library projects. The TFS build is unsuccessful with the following error:
light.exe : error LGHT0103: The system cannot find the file 'Path\assembly.dll' with type ''.
I have checked that the file (assembly.dll) in question and it does exists at the given path. The file in question is actually the output of another project in the solution. Apart from this file there are other files that are successfully found by wix project in the same path location.
Can somebody tell me why is this happening?

The possible reason could be due to file path 'Path\assembly.dll' will be larger in characters as light.exe support max 255 (or 155 char not sure) characters only.
You can change compressed to no as compressed=no in . This will create some folders with dependent file along with installer in output path.
If possible try to give shorter name to buildoutput and dropfolders that you are using at build server with compressed="yes"

Related

Visual Studio for Mac - AppResource.Designer.cs Not Getting Regenerated

Visual Studio for Mac Community 7.7.4 (build 1)
I went info one of my .NETStandard 2.0 projects and added a string MyLabelTitle to its AppResources.resx file.
I reference this string in my code like so:
AppResource.MyLabelTitle
This will build successfully and that is great.
However, lots of online forums, documentations, Xamarin forums, StackOverflow questions that I have seen state that AppResource.Designer.cs file will regenerate itself when you rebuild your project. Some suggest ignoring it in git as well.
To test that, I reverted back my changes (I am using git) from AppResource.Designer.cs so the end result is that:
AppResource.Designer.cs does not have my changes while
AppResource.resx file has my change in it.
Based on my understanding, rebuilding the project will pick up my change from AppResource.resx file and add it to AppResource.Designer.cs file.
However, building my iOS or Android project will now fail to build because it is referencing one of strings I added in AppResource.resx file.
This string is still present in AppResource.resx file but it wasn't regenerated inside AppResource.Designer.cs and as a result my project is unable to reference that string.
UNSUCCESSFUL ATTEMPT TO SOLVE
I thought that if I comment out the line of code referencing AppResource.MyLabelTitle, I should be able to build successfully and it did build successfully, but the string MyLabelTitle still was not picked from AppResource.resx file and re-generated inside AppResource.Designer.cs file. As a result, I cannot reference that string anymore in my code.
How to resolve this issue?
I suspect you also posted this problem on the Visual Studio for Mac community forum but will answer it here in case anybody looks here instead.
Visual Studio for Mac does not re-generate the associated .cs files for .resx files when building. It will re-generate the .cs file when the .resx file is saved in the text editor.
One problem here is that the .resx file needs to have unsaved changes otherwise the .cs file will not be re-generated.
Android projects will re-generate their Resources.designer.cs file on building. This .cs file is generated based on the contents of the various .axml files in the project not any .resx files.
There is an addin you can install which might help here. It provides a way to run all custom tools for the solution or project manually or when a build is run.
https://github.com/mrward/monodevelop-run-custom-tool
https://addins.monodevelop.com/Project/Index/380

Adding references search folder for MSBuild from Visual Studio Build definition UI

I am working on configuring a XAML build definition for a .net solution (of another company) stored in TFS2015.
The solution uses Dll references from a software X, installed on the developers computers, but not present in the Build server. (FTS and Build servers are shared among many clients).
I have option to add the required Dlls in a folder along with the source code, but I do not have option to modify the .csproj files.
In the Build definition, I tried to add the following in the MSBuild arguments field :
/p:AdditionalLibPaths=$/[long tfs path here]/CommonDlls
/p:AdditionalLibPaths=$(SourceDir)/CommonDlls
but it is not working.
Ideally, I would like to specify a relative folder from the root of the source code.
(a static path might work but only for one build server and agent, which is not the objective of shared build).
Any ideas on how I can define this parameter ?
There is also option to add a prebuild script path. I can store a script file along with source code. Any pointers for how to write such script file ?
You do not really need a script.
There are two things to make this work.
The first step is making sure that the DLLs are downloaded to the Agent working folder, the simplest way is have the $/[long tfs path here]/CommonDlls mapped in the Build Workspace; this is specified in the Source Settings tab of the Build Definition. Be careful to use the $(SourceDir) token in the mapping (see here).
The second point is to use a proper reference to the downloaded folder: use the TF_BUILD_SOURCESDIRECTORY variable (see here for full list).
So, if you added a mapping like
$/[long tfs path here]/CommonDlls -> $(SourceDir)\CommonDlls
use $(TF_BUILD_SOURCESDIRECTORY)\CommonDlls.
It took me almost 20 trials to get the right one, it all started with how long it took that warning to consider all other directories, I could've ignored it but here's the warning first
C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): Warning MSB3245: Could not resolve this reference. Could not locate the assembly "nameOfDllFile". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
and this is the argument that got it working
/p:ReferencePath="$(build.sourcesdirectory)\Binaries"
where Binaries is the equivalent to CommonDlls from the question, and it is all because of the vague documentation and differences between versions of MSBuild, mine is 14.0 (VS2015).

Wix in TFSBuild: SourceCodeControlRoot

I am following the recommendations to integrate Wix with TFS (http://wixtoolset.org/documentation/manual/v3/msbuild/daily_builds.html) (without having to install it on the Build server)
In my WixProj file, I have the line:
$(SourceCodeControlRoot)\wix\3.9\
This has been checked in with all of the prerequisite files - and I can successfully build on my Dev box.
But when I run my build, TFS complains that it can't find my Wix.targets file.
The error states:
*C:\Builds\8\AppName\DailyBuild\Sources\Setup\Case Tracking Setup\Wix Case Tracking.wixproj (73): The imported project "C:\wix\3.9\Wix.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
So I'm obviously using the wrong Reference but I couldn't find any other examples and the only place with SourceCodeControlRoot appears is related to Wix.
Any ideas?
Thanks
The article intends that you define or replace $(SourceCodeControlRoot) such that $(SourceCodeControlRoot) is the folder TFS exports to during the build. In your case, I'm guessing "C:\Builds\8\AppName\DailyBuild\". Of course, you probably don't want to hardcode it. You could pass a property setting to msbuild: /property:SourceCodeControlRoot="$(TF_BUILD_BUILDDIRECTORY)"
It doesn't really matter where you have your binaries (wix\3.9) folder. The end goal is to have $(WixToolPath) point to it. You could define it relative the project file if that's more convenient in your project structure:
<WixToolPath>$(MSBuildProjectDirectory)/../wix/3.9/</WixToolPath>

Where does the VS2012 Publishing Wizard get its file references?

I am having an issue where when I select to publish my MVC project to the file system so I may upload it later via FTP to my Web Host, it fails complaining of missing files.
Believing that it may think these files are required to compile the project, I copy them to the locations that it expects and it resolves the error but produces yet another error about another missing file.
These files incidentally are not required to run my Web Application but were simply files used during the initial test phase of my project. More specifically, picture files.
The next step I took to resolve the issue was to Clean and rebuild the Solution and Project Entirely with all those files it was referencing in the errors removed. The Project builds successfully and runs as expected.
I then attempt to publish to the file system and again it complains of those files as if its getting that information from somewhere other than obvious places within my Project.
I have deleted the object directory content, cleaned and rebuilt; again it references these files that don't exist anywhere within my Solution.
So my question is, Where exactly does the Web Publishing Wizard get the information it uses to copy the required files to the Target Location? I've checked the .pubxml file but there's nothing in there that would provide the information.
For instance, if I'd initially built my site using reference to a .png file then later use a .jpg file. The Wizard seems to be getting the metadata for the initial build somewhere and insists on inclusion of the .png file when it is no longer needed.
I believe I have Upgraded to the latest build and patches for VS2012. I am Currently running version 11.0.50727.1 and using .NET 4.5
I cannot find any relevant information on this problem so it may be a quirk in my Environment so I'm searching for some feedback.
If no answer can be provided, if I could simply know what folders and files are required to deploy an MVC site; I'll perform the deploy manually and trash the Wizard concept. I just thought it would be the most appropriate way to deploy but if its going to be a pain; I don't need it.
This is the Error:
Error : Copying file <relative path>\image.png to obj\Release\Package\PackageTmp\<relative path>\image.png failed.
Could not find file '<relative path>\image.png'.
The new file that replaced the old file is actually image.jpg and its in there. I could alleviate this error by copying the old file back to its initial location, but why should I if its no longer required?

How do I change the build directory that MSBuild uses under Team Foundation Build?

I'm getting the following error when trying to build my app using Team Foundation Build:
C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(1682,9): error MSB3554: Cannot write to the output file "obj\Release\Company.Redacted.BlahBlah.Localization.Subsystems.
Startup_Shutdown_Processing.StartupShutdownProcessingMessages.de.resources". The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
My project builds fine on my development machine as the source is only two folders deep, but TF Build seems to use a really deep directory that is causing it to break. How do I change the folders that are used?
Edit: I checked the .proj file for my build that is stored in source control and found the following:
<!-- BUILD DIRECTORY
This property is included only for backwards compatibility. The build directory used for a build
definition is now stored in the database, as the BuildDirectory property of the definition's
DefaultBuildAgent. For compatibility with V1 clients, keep this property in sync with the value
in the database.
-->
<BuildDirectoryPath>UNKNOWN</BuildDirectoryPath>
If this is stored in the database how do I change it?
Edit: Found the following blog post which may be pointing me torward the solution. Now I just need to figure out how to change the setting in the Build Agent. http://blogs.msdn.com/jpricket/archive/2007/04/30/build-type-builddirectorypath-build-agent-working-directory.aspx
Currently my working directory is "$(Temp)\$(BuildDefinitionPath)" but now I don't know what wildcards are available to specify a different folder.
You need to edit the build working directory of your Build Agent so that the begging path is a little smaller. To edit the build agent, right click on the "Builds" node and select "Manage Build Agents..."
I personally use something like c:\bw\$(BuildDefinitionId). $(BuildDefinitionId) translates into the id of the build definition (hence the name :-) ), which means you get a build path starting with something like c:\bw\36 rather than c:\Documents and Settings\tfsbuild\Local Settings\Temp\BuildDefinitionName
Good luck,
Martin.
you have to checkout the build script file, from the source control explorer, and get your elbows dirty replacing the path.

Resources