Team City build error file not found - msbuild

I'm having an issue with a Team City build. I added a web.config transform to my publish profile however the publish process can't seem to find the file.
The file Web.Stage.config does exist on the build server in C:\TeamCity\buildAgent\work\12d03f61c6f6df2f. Team City seems to not have added a backslash at the end of the directory path before appending the file name.
The error in full is listed below. Any help is appreciated.
Build errors
[15:08:47]website.publishproj.teamcity: Build target: MSDeployPublish (32s)
[15:09:03][website.publishproj.teamcity] CopyAllFilesToSingleFolderForMsdeploy (16s)
[15:09:04][CopyAllFilesToSingleFolderForMsdeploy] CopyPipelineFiles (15s)
[15:09:19][CopyPipelineFiles] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets(2709, 5): Copying file C:\TeamCity\buildAgent\work\12d03f61c6f6df2fWeb.CRIStage.config to binobj\Debug\Package\PackageTmp\Web.CRIStage.config failed. Could not find file 'C:\TeamCity\buildAgent\work\12d03f61c6f6df2fWeb.Stage.config'.
[15:09:20][website.publishproj.teamcity] Project website.publishproj.teamcity failed.

As a work around you can give 'Artifacts Path' in your 'General Settings' tab of Build Configuration as \Web.Stage.config by adding a slash before the file name. So that it will take the file path properly as C:\TeamCity\buildAgent\work\12d03f61c6f6df2f\Web.Stage.config.

Related

How to to define bamboo artifact so its NOT published in syb folder

The artifact definition and the file structure in the bitbucket repository is as below.
The build when run creates application-dev.properties & safeguard-dev.properties under classes folder. When i click them it takes me to classes folder inside which the property files are present. But i want them to be published directly like the jar. So that when I click the file it should download. But if i give full path it errors out. Please help me how to define this?
error 19-Dec-2022 16:34:57 Failing as no matching files has been found and empty artifacts are not allowed.
error 19-Dec-2022 16:34:57 Unable to publish artifact [application-dev.properties]:
error 19-Dec-2022 16:34:57 The artifact is required, build will now fail.
Bamboo won't put the artifacts in a subfolder if the "Location" points to exactly where the files are. I.e. don't use the "**" wildcard in the "Copy pattern". I'd say try even to have a separate artifact per properties file.
Your location is pointing to "workdir/src", but you need "target/classes". Get rid of the $bamboo.build.working.directory: that's not the maven build dir and you don't need it altogether (because current work dir is already set to your project dir). If I get the paths right, this should work:
Name: application-dev.properties
Location: target/classes
Copy pattern: application-dev.properties

Why is my key file's relative path changed from ..\ to *Undefined* when building with MSBuild?

In my solution folder, there is a folder called Tools which is not included in the solution itself (because the "Show All Files" function of VS's Solution Explorer doesn't display it to include in the project). Inside is an SNK file for signing assemblies. Another programmer has signed a project with that file. When I pulled the project from Git, its "Signing" property showed the path as ..\..\..\Tools\key.snk.
Building the solution with VS is fine, but if I use MSBuild there will be an error that read:
CSC : error CS7027: Error signing output with public key from file
'*Undefined*Tools\key.snk' -- File not found.
[C:\Source\src\Client\Share\QED\QED.csproj]
I have tried re-signing the project myself with the file. The file path changed to key.snk, the SNK file was copied into the project, but the error stayed the same.
I'm using MSBuild 17 with VS2022.

Move Jenkins jobs give error during jobs execution "File or Folder no found"

If I move a job in Jenkins (From Review), from the default directory to a Folder I have created, i get an error:
File or folder not found
I have some Selenium tests that use a file to read mock data. If I run the job from the default directory is everything ok, but if i move the job inside another folder, then i get the message that the file or folder not found.
I see that the name of the folder will be added to the path of the file. This is the reason why the file cannont be found.
Is there any configuration to resolve this issue.
I found the problem myself.
The name of the subfolder in Jenkins must not include spaces:
incorrect: "Sub Foler Name"
correct: "Sub-Folder-Name"

Jenkins Error: fatal error C1083: Cannot open include file: 'xyz.h': No such file or directory

Can any one please tell me how to resolve this kind of error?
This header file placed in different folder and project.sln file present in some other folder. but both folders are present at same master folder like :
Project_Data(main folder)
1. Source_code (project.sln present here)
2. Supported_Files(xyz.h file present here)
and in jenkins i give the svn location of master folder.
Firstly thank you for your response to my question. Now i got the solution of above error.
In this case we can change the location of missing file(i.e which is not found by jenkins while exection) to folder where .sln file placed.We can do this process manually or we can write execution script to automate this process.
Thanks :)

How do I access an XML file that is included in the project?

I have added an XML file (File.xml) into a project (I can see it in the Solution Explorer), it resides at the root directory level of the project i.e. the same level as the VB program (.vb), the bin directory and the References directory etc..
I try accessing it using XmlDocument.Load("File.xml") ... but it doesn't find it. I get
A first chance exception of type 'System.IO.FileNotFoundException' occurred in System.Xml.dll
Any idea where the file is or how I 'address' it?
Thanks for any help
Oliver
Is the file copied to the output directory? Click on the file, look at the properties in the VS editor, and set the "Build Action" to Content and "Copy to Output Directory" to either "Copy always" or "Copy if newer" (depending on what you need).
In the Publish property go to
Application Files --> Look for the XML file: If the publish status = Data File, then the File will be copied to the Application DATA folder.
If you want the xml to be inside the programs directory change the publish status to: Include. This will do the trick.
Try this:
XmlDocument.LoadXml(System.IO.Path.GetFullPath(Application.StartupPath & "\File.xml"))
It's worth a shot I guess. My question: is it possible to edit a file that's placed in the project?