Team Build, copy file target issue - tfs

I have this team build target setup to after compile
<Target Name="AfterCompile">
<Copy SourceFiles="$(SolutionRoot)\Development_VS2008\MyCompanyName.SharePoint.12" DestinationFolder="c:\testing"></Copy>
</Target>
I want the folder structure copied from source to destination...
Amazingly I am getting this error
Could not copy the file "C:\TFS\NightlyBuild\Sources\Development_VS2008\MyCompanyName.SharePoint.12\"
to the destination file "c:\testing\", because the destination is a folder instead of a file.
To copy the source file into a folder, consider using the DestinationFolder parameter instead of DestinationFiles.
As you can see I am indeed using the destinationfolder parameter, does anyone know what I am doing wrong?

I think it might be just because SourceFiles is a directory rather than the files you want to copy. Try this:
<Target Name="AfterCompile">
<ItemGroup>
<FilesToCopy Include="$(SolutionRoot)\Development_VS2008\MyCompanyName.SharePoint.12\**\*.*"/>
</ItemGroup>
<Copy SourceFiles="#(FilesToCopy)" DestinationFolder="c:\testing\%(RecursiveDir)"/>
</Target>

This error happened to me not under Team Foundation project, but standalone one, and when I add new .dll file with build action ContentWithTargetPath. I wanted this library to be included in my output directory. Record for this action appears in one of the ItemGroup section in .csproj file like:
<ContentWithTargetPath Include="Resources\Libraries\libName.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</ContentWithTargetPath>
But for some reason this is not enough to ContentWithTargetPath option works fine (I saw the explanation about it somewhere in StackOverflow, but don't remember where). You should manually add TargetPath subsection to ContentWithTargetPath like this:
<ContentWithTargetPath Include="Resources\Libraries\libName.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>libName.dll</TargetPath>
</ContentWithTargetPath>
TargetPath subsection doesn't appear by IntelliSense while editing the .csproj file in Visual Studio, as well as it doesn't appear in libName.dll's properties window, so you should add this subsection by hand. This scenario comes out even in my Visual Studio Community 2017.
PS. You can edit .csproj file while in Visual Studio - unload this project and choose "Edit YourProjectName.csproj" option (right mouse click on unloaded project). Edit and save .csproj file, then reload the project.

You need something such as this:
<CreateItem Include="someFolder\**\*.*">
<Output ItemName="files" TaskParameter="Include" />
</CreateItem>
<Copy SourceFiles="#(files)" DestinationFiles="#(files->'C:\folder\%(relativedir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" />
Or alternatively I've found the easiest way (if you want to be a bit more stringent about what to include/ exclude) is with some custom MSBuild tasks I've written: http://www.aaron-powell.com/blog.aspx?cat=AaronPowell.MSBuild.Tasks
You provide a source directory, a destination direction (support for network shares is provided) and file names/ extensions to exclude.
It's mainly because Team Build makes a real mess (particularly with web apps) when it run and it's not really possible to use the standard MSBuild copy tasks.

We are experiencing a lot of problems with postbuild xcopy commands. And we decided to avoid xcopy commands.
We are now including the files (which we want to copy) into project, and we are setting copy local property to "Copy if newer" and target directory (directory structure must be same in project)
It helps a lot.
Maybe it also fit your situation.

Copy task doesn't support copying directories apparently (as it's based on 'copy'), and xcopy will fails sometimes due to long filenames in source (>256 characters).
I did this (with robocopy):
<Exec WorkingDirectory="$(MSBuildProjectDirectory)"
Command='robocopy $(MSBuildProjectDirectory)\Main $(DropLocation) /S /COPY:DATS /NP /NFL /NDL /v' ContinueOnError="true" />

I had exactly the same message:
Error 103 Could not copy the file "obj\Release\xxxx.dll" to the destination file "bin\Release\xxxx.dll", because the destination is a folder instead of a file. To copy the source file into a folder, consider using the DestinationFolder parameter instead of DestinationFiles. xxxx
It happened (I don´t know why) that I had in the release folder another folder with the same name of the assembly (including extension), so Visual Studio could not create the assembly there. It is not a configuration in the project or solution, so I just deleted the folder (that I don´t know how it was created) and it worked.

Related

Resizetizer One or more invalid file names were detected

I can't get rid of this build error in my .net maui app in Visual Studio for Mac 2022 v17? The build output says:
/usr/local/share/dotnet/packs/Microsoft.Maui.Resizetizer.Sdk/6.0.300-rc.3.5667/targets/Microsoft.Maui.Resizetizer.targets(511,9): error : One or more invalid file names were detected. File names must be lowercase, start and end with a letter character, and contain only alphanumeric characters or underscores:
When I copied the image files into the resource/image folder they did have invalid characters, but I renamed the files to only have valid lowercase alpha numeric letters but still visual studio is just broken. I've cleaned the project, manually deleted bin and obj folders, restarted the solution and visual studio and even booted the whole machine with no success. I've even tried to delete all images but no luck.
There must be some other cache that is still holding invalid references of the error message is simply wrong and is thrown for some other related reason. Any help finding this issues would be greatly appreciated.
Edit
I have now created a new project (MyMauiSolution) and one by one copied the folders from the old solution to see where it would break. After all files are coped into the new project it still works. So now I have 2 solutions with more or less exactly the same files/images, where one is working and the other is not?!
I have even tried diffing the folder structures, but there are no differences?!
myiMac:Projects user_x$ diff -rq BlueWhaleMaui MyMauiSolution
Files BlueWhaleMaui/.DS_Store and MyMauiSolution/.DS_Store differ
Only in BlueWhaleMaui: .git
Only in BlueWhaleMaui: .gitignore
Only in BlueWhaleMaui: BlueWhaleMaui
Only in MyMauiSolution: MyMauiApp
This is likely caused by the existence of a hidden file in the Resources\Images directory created by the Mac operating system when using the Finder to manipulate files in that directory. (.DS_store)
The .DS_store is not visible in Finder even when 'Show All Files' is turned on, so to confirm:
Open the Terminal application
Change to your project's Resources\Images directory
Perform the command 'ls -la' in the Resources\Images directory
Confirm the existence of the '.DS_store' file (or any other 'dot' file)
There are two solutions (one a workaround, really)
Simply use the Terminal application window to delete the file
Edit your project (csproj) file to exclude the .DS_store from resizing
If you delete the file using terminal the issue will return the next time you use Finder to manipulate files in that folder/directory.
Alternatively, open your project (csproj) file and find the section that defines the MauiImage resources in your project. It should look something like this :<MauiImage Include="Resources\Images\* />
Change that from a single wildcard to a list of more specific patterns to include:
<MauiImage Include="Resources\Images\*svg />
<MauiImage Include="Resources\Images\*png />
<MauiImage Include="Resources\Images\*jpg />
This should include only files ending in these image-type file extensions in the resizing process and skipping the .DS_store file.
I had the same problem. As a workaround I deleted 'Images' folder (after backed up), create a new 'Images' folder and restore the images.

Nuget package all sub project in a solution

I have a solution which contains more than one Project. Project structure is as below.
/root
A.sln
A.nuspec
/ProjectB
projectB.csprj
projectB.nuspec
/ProjectC
projectC.csprj
projectC.nuspec
I have a few question.
1- What happens if I run nuget pack A.nuspec in root folder. Is there a way package all Project in a solution.
2- When I send the code TFS, with "NuGet Packager" I can use a regex to packege all sub Project as shown below. Is there a way to use such a regex in local environment.
3- Is it possible to create a nupkg contain both sub Project.
4- Is it possible to create a nupkg contain more than one dll. Can I put all dependency of the Project into nupkg.
1- What happens if I run nuget pack A.nuspec in root folder. Is there a way package all Project in a solution.
I don't believe there is a way to package all project in a solution by using .nupsec. That because the process of creating a package always begins with creating a .nuspec package manifest file that describes your package contents. This manifest drives the creation of the package as well as its usage when installed into a project not solution. And the ID and Version must be unique in the .nupsec, so we could not use the unique ID and Version to specify multiple projects.
2- When I send the code TFS, with "NuGet Packager" I can use a regex to packege all sub Project as shown below. Is there a way to use such a regex in local environment.
The answer is NO. I have test it on my local machine, the wildcard is treated as Illegal characters in the command line.
3- Is it possible to create a nupkg contain both sub Project.
If I understand you correctly, you mean the sub Project is reference project? If yes, the answer is yes. You can use the the option "IncludeReferencedProjects" to include referenced projects either as dependencies or as part of the package. please refer to this document for detail.
4- Is it possible to create a nupkg contain more than one dll. Can I put all dependency of the Project into nupkg.
Of course you can. You can refer to another thread which I have answered for more detail. If you want to put all dependencies of the Project into nupkg, you can use the <dependencies> to include all dependencies in the .nuspec.
<dependencies>
<dependency id="Newtonsoft.Json" version="9.0" />
</dependencies>

.mm .h .c Files from copied phonegap project not shown in Xcode

I have a phonegap project and split the code in global files (that are similar for android and ios) and ios/android specific files. Then I have an ant script where I merge the files into one project again.
The problem is I have a plugin "xzing barcode scanner". The files lay within the projectname/Plugins folder of the IOS project. The files are also merged to the target directory, but in xcode they´re not shown. And when I run the app I get the error that the plugin isn`t known.
This part of the ant scirpt copies the file
<copy todir="${targetdir}/${projectName}.xcodeproj">
<fileset dir="${projectroot}/${projectName}.xcodeproj"/>
</copy>
<copy todir="${targetdir}/${projectName}">
<fileset dir="${projectroot}/${projectName}"/>
</copy>
The contents of the Plugin Folder:
CDVBarcodeScanner.mm
zxing_all_in_one.h
zxing_all_in_one.c
README
All Files are copied to the target directory (targetdir/projectname/Plugins), but somehow not merged into the project in xcode.
Anyone knows how to fix this?
Your files do not seem to be referenced to your XCode project.
I think a simple way you may try would be to copy your files manually like this (I don't know why but this kind of issue was solved for me like this XD...):
Use your Finder to go to your folder Plugin and move the "hidden" files (CDVBarcodeScanner.mm, zxing_all_in_one.h, zxing_all_in_one.c, and README) somewhere else, on your Desktop for instance.
Open XCode and create an empty file for the folder Plugin (--> Through XCode: right click on the folder Plugin, New File...->iOS->Other->Empty) and save the file as CDVBarcodeScanner.mm (for example)
Open the file CDVBarcodeScanner.mm (for example), that you put on your Desktop for example, with a simple text editor and copy the content to your new created file in XCode
Do the same for the remaining files:
zxing_all_in_one.h
zxing_all_in_one.c
README
Hope this solution will work for you. Let me know of your results.

Azure Deployment

I've been able to deploy my application to azure successfully until recently. Before my latest deployment, I added a few .less to the project. When I deployed the project with the added files, they didn't show up in the Contents directory of the remote site, while all other udpates were made.
Any ideas?
Just right click on the .less file and go to its properties. Change the Build Action to Content. Hope this helps.
How did you add the files?
If I understand right, you are working with Visual Studio, and just copied files to your directory.
In some cases, the VS does not recognize such added files. In this case you can:
Got To you Project -> RightClick -> Add Exists Item -> select your files
or
Go to Solution Explorer -> choose Show All Files -> select your files -> Right Click -> Include in Project
Never mind.
Here's the diff in the .csproj file:
- <None Include="Content\less_file1.less" />
- <None Include="Content\less_file2.less" />
+ <Content Include="Content\less_file1.less" />
+ <Content Include="Content\less_file2.less" />
Don't know why adding existing files to the content directory won't make the above change automatically. Am I adding files the wrong way here? Why would it say None instead of Content? I don't think this has happened to me before. I don't want to make such changes manually in the future!
Right click on file you added and set 'Copy to Output Directory' as 'Copy always.

Too many cod-parts in jad file

I created a blackberry application but I am having problems publishing it on my web site. I have uploaded the jad, jar, alx and cod file (from which I extracted the whole content). I also added the missing MIME types. But when I try to download the application by requesting the jad file, I get a 500 error with the details saying that the file myproject-30.cod is missing.
So I looked at the list of cod file... sure enough, they go from 0 to 29. No 30, 31 or above. However, in the jad file, there are references for cod files for up to 110.
My question is: how can I configure eclipse to produce the jar file properly? Or, alternatively, how can I modify the jad file to delete references to the 30+ cod files? Or maybe it is that the cod file is missing files?
You may try with blackberry ant tools, task will look like this:
<target name="produce_ota">
<mkdir dir="${ota.dir}" />
<jadtool input="your_app_name.jad" destdir="${ota.dir}">
<fileset dir="${build.dir}" includes="*.cod" />
</jadtool>
</target>
This will produce all needed cod parts and jad file to ${ota.dir} assuming there will be built application in ${build.dir} directory.
Check out slashdev.ca tutorial - Blackberry development with Ant & Eclipse
For some reason, the JAD file was not recreated by the rapc compile tool. Basically, it was created a couple of week ago and that's it, so clearly it was not up-to-date. To force the eclipse plugin to recreate the file, I simply deleted it. The new file is now working fine.

Resources