.ccproj wouldn't build for no apparent reason - visual-studio-2010

I'm playing with a Azure sample from here. After some (rather non-damaging IMO) manipulations the project will no longer build - when I hit "Build" the following appears in output:
------ Rebuild All started: Project: CloudService, Configuration: Debug Any CPU ------
Target "_CheckForInvalidConfigurationAndPlatform" in file "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets" from project "C:\Temp\AzureAdvancedRolesSource\Ex2-StartupTasks\CS\Begin\CloudService\CloudService.ccproj" (entry point):
.... many, many more lines with nothing looking like an error, then
Task "Message"
Start - PackageComputeService
Task "Message"
ServiceHostingSDKInstallDir is C:\Program Files\Windows Azure SDK\v1.4\
Task "Message"
EnableIntelliTrace is false
Task "Message"
SiteMapping: Web:SampleWebApp -> C:\Temp\AzureAdvancedRolesSource\Ex2-StartupTasks\CS\Begin\SampleWebApp\
Task "Message"
ModelFile is
Task "Message"
OutputDirectory is bin\Debug\CloudService.csx\
Task "Message"
PackRoles is C:\Temp\AzureAdvancedRolesSource\Ex2-StartupTasks\CS\Begin\CloudService\obj\Debug\SampleWebApp\, Name=SampleWebApp, EntryPoint=SampleWebApp.dll, SourceDir=C:\Temp\AzureAdvancedRolesSource\Ex2-StartupTasks\CS\Begin\SampleWebApp\
Task "Message"
RoleProperties is SampleWebApp, EntryPoint=SampleWebApp.dll, TargetFrameworkVersion=v4.0
Task "Message"
ServiceDefinitionCopy is ServiceDefinition.build.csdef
Task "Message"
ServiceConfigurationCopy is bin\Debug\ServiceConfiguration.cscfg
Task "Message"
Calling ServicePack
Task "CSPack"
Done building project "CloudService.ccproj" -- FAILED.
Build FAILED.
I guess there's something wrong with CSPack. How do I find out what's wrong and how to fix that?

I would suggest trying to run CSPack from the commandline. This will hopefully let you see the error that CSPack is running into when you're trying to build in visual studio.
If you aren't quite sure how to run CSPack, Steve Marx and Ryan Dunn covered how to use CSPack in an episode of Cloud Cover.
Note that there is a special location for your Startup Tasks to be placed in order for the CSPack Utility to be able to execute properly, I have outlined this in my blog post "Installing PHP on Windows Azure Leveraging Full IIS Support".
Good Luck!
~Cory()

That turned out to be some unreproduceable problem with CSPack which I resolved by deleting all the stuff in the "cloud solution" directory (C:\Temp\AzureAdvancedRolesSource\Ex2-StartupTasks\CS\Begin\CloudService\ in the sample) except the very files that were there initially.

Related

MyTask getting unwantedly executed when building

I want to print a link to our team's documentation if the developer types:
gradle help
using this task:
task help {
println "Full Documentation"
println "https://confluence.org.com/Help"
}
which it does.
However, I do not want it to execute when I run:
gradle build
Is the help task supposed to run whenever build is run? If not, why does this task get executed? As you can tell, my understanding of gradle is limited.
You are effectively overriding the built-in help task that Gradle provides. As a result, other tasks or plugins in your project may be referencing that task already or other parts in the overall Gradle build rely or use help in some fashion.
To summarize, do not override Gradle built-in tasks otherwise it will lead to unexpected/unintended consequences.
To fix, rename your task to something other than help.

Why copy task delete stale output on first build?

I have this kotlin gradle build script representing my use case.
I am working with Gradle 6.7.
This is my kotlin gradle build file:
plugins {
java
}
tasks.register("createFile"){
doLast{
projectDir.resolve("tmp.txt").createNewFile()
projectDir.resolve("tmp.txt").writeText("tmp")
}
dependsOn("assemble")
}
tasks.register("createExecFile", Exec::class){
workingDir(buildDir)
commandLine("cmd", "/c", "mkdir destdir\\subdir")
dependsOn("createFile")
}
tasks.register("copyBug", Copy::class){
from(projectDir.resolve("tmp.txt"))
into(buildDir.resolve("destDir"))
dependsOn("createExecFile")
}
Now run gradle copyBug -i.
The first time this will give you this output:
> Task :copyBug Deleting stale output file: E:\repo\BugCOpy\build\destDir Caching disabled for task ':copyBug' because: Build cache is disabled Task ':copyBug' is not up-to-date because: No history is available.
The copy task deletes the file created by the previous exec task.
Now if you rerun this command the copy task won't delete stale file.
So what are those stale file? How can I prevent those file to be deleted? My first build and is different than the other build.
Should I file a bug?
In your createExecFile task you produce output files without telling Gradle about them. So Gradle doesn’t know that this task and the copyBug task use the same output directory. Instead, Gradle believes that copyBug is the only task producing outputs under build/destdir and hence it’s safer to assume that any existing files in that directory should not be there (and are “stale”).
The solution is to tell Gradle that your createExecFile task outputs to build/destdir:
tasks.register("createExecFile", Exec::class) {
workingDir(buildDir)
commandLine("cmd", "/c", "mkdir destdir\\subdir")
// tell Gradle about the output directory
outputs.dir(buildDir.resolve("destdir"))
dependsOn("createFile")
}
See this release notes section for why this behavior was introduced and this explanation to a very similar issue if you want some more background information.
My build process looks like
run gradle (part 1)
do something else
run gradle (part 2)
For me annoyingly running gradle in step 3 would not just add a few files to the output directory but delete that folder as stale first. Even adding
outputs.dir(...)
did not prevent Gradle from removing it as stale. Working out the inputs and outputs of my task looked too tedious, but luckily I found a way to tell Gradle not to perform any up to date tracking:
Example 37. Ignoring up-to-date checks mentions to add
doNotTrackState("Comment why this is needed")
which ultimately helped me to keep the files from build step 1.

Exception calling "GetFullPath" with 1 argument(s): "The path is not of a legal form."

I have a release configured in Visual Studio Team Services using Release Management to run a SonarQube for MSBuild task. The task starts and then fails with the following error:
Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\default\tasks\SonarQubePreBuild\1.0.29\SonarQubePreBuild.ps1
[error]Exception calling "GetFullPath" with "1" argument(s): "The path is not of a legal form."
Is this an error that I'm causing or is this an issue with the task?
"SonarQube for MSBuild" is currently designed to use in "Build" process. So you will see some errors when use it in Release Management. You can submit a feature request on this page: http://visualstudio.uservoice.com/forums/330519-team-services
If you do want to use it in Release Management for now and your are using your own build agent rather than the hosted build agent. You can go to the "Tasks" folder in your build agent directory and update the "Path" variables in the PowerShell script for SonarQube task.
For example, changing the path variable "$env:BUILD_SOURCESDIRECTORY" to "$env:SYSTEM_DEFAULTWORKINGDIRECTORY" in "SonarQubePreBuildImpl.ps1", you will get the SonarQubePreBuild task finished successfully.

Which MSBuild tasks initiate a call to SGen?

I have inherited a complex MSBuild script which builds & deploys multiple solutions. When I run the script I see the following error in log:
SGEN: Cannot generate serialization assembly
C:\B\268\Agents\Agents.XmlSerializers.dll
because it already exists. Use /force to force an overwrite of the
existing assembly.
I agree that Agents.XmlSerializers.dll exists. What I can't determine is which task caused it to be created and which one initiated the attempt to re-create it.
I have searched through the files in the build hierarchy for 'SGen' and found nothing. So I presume that SGen is called implicitly by two (or more) of the tasks in the build.
Can anyone point out what might call SGen?
Thanks.
In the Build Output window, look for...
Task "SGen"
Right above that is the actual "sgen.exe" command.
And as Pawell said, you need full details in your build output. Inside of Studio, it's Tools - Options... - Projects and Solutions - Build and Run - MSBuild project build output verbosity: Diagnostic.

Teamcity Custom Script Log Output

I use a very basic Custom Script in TeamCity 7.0.3 which uses Visual Studio 2010 to build a solution and its installers.
The build was failing and the only relevant error in the TeamCity Build Log is
[13:17:13]Process exited with code 1
When I run the same script from the console, I get a lot of helpful errors about why the build failed.
How can I get TeamCity to include the errors from devenv.exe?
You need to report back the additional info to TeamCity in a way it can interpret.
Look at this article to see how to do it:
http://confluence.jetbrains.net/display/TCD7/Build+Script+Interaction+with+TeamCity
For a basic example:
You can report messages for build log in the following way:
##teamcity[message text='<message text>' errorDetails='<error details>' status='<status value>']

Resources