msbuild project with . in name - msbuild

I want to be able to build only one project in my solution using msbuild /t. The problem occurs when the project name includes a ".", for instance MyProject.Unittests
msbuild reports MSB4057, no matter what I write. I have tried escaping the . with %2e without any success.
I have a similar problem when the project is added to a solution folder with space in the name.
Any help is greatly appreciated.

Related

My VS project keeps getting rebuilt using msbuild

Latest:
This is definitely a bug in msbuild. Other than that there cannot be any other explanation. This could only be happening on Linux or possibly on a wider range.
So i decided to just build one single project with absolutely no dependencies on others in the solution.
Looking at the captured diagnostics, I see these lines which are very promising:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
Input files: Annotations.cs;Auth.cs;AuthorizationConfig.cs;Backend.cs;Billing.cs;Code.cs;...
Output files: .obj/TheAgent.dll;.obj/TheAgent.pdb
Set Property: NoWarn=;1701;1702
15:23:27.396 1>Done building target "CoreCompile" in project "TheAgent.csproj".: (TargetId:40)
It looks like my dll and my pdb weren't built which is what I expected.
However, something must be happening before or after causing the timestamp to change (be that of this build time and not the last).
The timestamp of the dll is updated both in the intermediate object folder (.obj/) and also in the output folder.
Is there a known way of stopping msbuild right after its CoreCompile task?
Update:
I decided to search for is newer this time and found instances of these. I don't know how they have got to the solution/project files though:
Input file ".obj/Common.csproj.CoreCompileInputs.cache" is newer than output file ".obj/Common.pdb".
Further to the above, I came across this:
https://github.com/dotnet/project-system/issues/4736
Thinking that this was the issue, I upgraded to dotnet sdk version 2.2.402.
The end result is still the same :(
Original:
I need some pointers on how to troubleshoot this issue. I am using /t:build to build a solution file.
The resulting executable keeps getting refreshed each time.
First i thought the package restore was causing this. I have removed that step however it didn't make a difference.
Then I looked at this:
https://oz-code.com/blog/visual-studio-keeps-rebuilding-projects-no-good-reason/
I'm basically looking for some text in the diagnostics output which tells me if a target or a file is out of date and needs to be rebuilt. The above link talks about "project 'B' is not up to date". I don't have a not up to date in my msbuild output.
I already had two resources with CopyAlways which I changed to CopyIfNewer.
The above article also talks about circular dependencies. I am checking everything manually. And yes the references to dependent project are actually references to the project outputs (dll's /exe's). So Finding a circular dependency by just checking for that pattern seems a little odd.
There was one more problems in the dotnet platform and/or msbuild causing this to fail.
One of those was this https://github.com/dotnet/project-system/issues/4736
Installing SDK 3.0.100-preview7-012821 or better solved the problem

Build Definition Task File Pattern

For a Visual Studio Team Services Build Definition step Build Solution (Visual Studio Build), how would one structure a pattern to both include and exclude files/folders. For example, to include all .sln files I'm able to use **\*.sln and to exclude node_modules I could us !node_modules. How could I combine this within the Solution field of the Build Solution edit UI?
**\*.sln,!node_modules returns an invalid pattern error. Is there a separator that I can use to specify multiple glob patterns?
Thank you for any help you can provide.
Try to use this value instead:
**\*.sln;-:**\node_modules\**

2 .msi files from one WiX Votive project

As the title says, I want to output 2 .msi files from one project (one is per-user, and the other is per-machine). I have seen in this thread that it can't be done in some conventional way, but perhaps there is a way to do so as some kind of hack in post-build.
I only need to rerun compilation and linking after the original build with slightly changed command line (actually, I need only different Product.wxs file). However, my light and candle command lines are huge, and I would risk making my project hard to maintain if I would hard-code them.
So, in conclusion, I need to know if there is a way to write a command line that would behave the same as Votive does when creating its build command line (getting all the files in project, linking them, passing project dependencies...), only in post build.
P.S.: I also had an idea of getting the whole command line from Votive, and only changing the Product file, that would also help, so if someone has suggestion on how to do it...
Create multiple configurations of your solution / project and set a preprocessor variable to some value for one of the configurations. In your wix source, conditionally include whatever else it is that needs included based on your preprocessor variable.

Problem getting version number from assembly file with msbuild

I'm working on msbuild to get version info from assembly file. But i got a problem that the value $(MaxAssemblyVersion) is always empty. The only difference here is that i got a .Net solution including several projects. So i have a GlobalAssemblyInfo.cs at the root folder and Assemblyinfo.cs inside every included project. Anyone has any suggestion for my situation? Is there any way to work with GlobalAssemblyinfo.cs?
Look forward to your reply!
Every comment will be very helpful and appropriated.
Many thanks,
Depending on what point during the build you need the assembly version, you could extract it from your outputs using the GetAssemblyIdentity Task.

Creating filters for Lua files in VS using CMake's source_group

I've been able to easily get all my headers and source files organized using filters like so:
source_group(Source\ Files\\network FILES
network/lobbylist.cpp
network/network.cpp
network/networkenet.cpp
network/networkfactory.cpp
network/networklinux.cpp
network/networkraw.cpp
network/networkwin.cpp
)
However, today I started adding Lua scripts to my project and found that, although no errors were displayed during project generation and everything seemed to be spelled correctly, CMake didn't add a new filter for the scripts in the solution at all.
source_group(Source\ Files\\scripts FILES
scripts/en_lang.lua
)
I also tried putting the group under the Header Files filter and under the project root, but no go. Does CMake simply not recognize or know what to do with non-.h/.hpp/.c/.cpp/etc files? Is there any way to get around this? Obviously I can still edit the scripts in a separate window or open it manually in VS, but having it right there in the solution explorer would be preferable.
You have to add the lua files to ADD_EXECUTABLE