build succeeds publish fails visual studio 2012 WPF project - visual-studio-2012

I have a WPF project that I normally publish for click once installs
The project stopped publishing about 3 days ago.
If I build and/or run the project from code it succeeds but publish fails.
Cannot publish because a project failed to build. 1 1 ProjectName
Could not find file 'obj\x86\Debug\ProjectName.exe'. ProjectName
Funny thing is if I look in the obj\x86\Debug folder it appears to put the ProjectName.exe in for a split second and then remove it again before failing.
The error in the output window is:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3075,5): error MSB3113: Could not find file 'obj\x86\Debug\ProjectName.exe'.
Error: Cannot publish because a project failed to build.
I've tried the normal stuff like cleaning, rebuilding, rebooting
After changing verbosity of build to diagnostics I got following information on the failure:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3075,5): error MSB3113: Could not find file 'obj\x86\Debug\ProjectName.exe'.
Done executing task "GenerateApplicationManifest" -- FAILED. (TaskId:147)
Done building target "GenerateApplicationManifest" in project "ProjectName.vbproj" -- FAILED.: (TargetId:166)

I was able to discover the answer by following paul's suggestion.
I increased the verbosity of the build project via Tools | Options | Projects And Solution | Build and Run | Project build output verbosity.
Once I looked at the more verbose build output fixing the problem was simple.
The verbose output gave me exactly where the publish was failing so I was then able to fix those problems.

Related

Writing a gradle task to run Junits

I am a newbee to gradle. The task at hand is to add a new gradle task that can run all the junits in the project and show a summary like which testcases passed, failed,skipped etc.
gradle version used is 4.8.1 and junit4.11
The project structure is like this:
Myproject
|_____api
| |_____src
| |_____main
| |_____test
| |____java
|_____cli
|_____src
|_____main
|_____test
|____java
I am able to run the individual tests from intelliJ.
There is a "test" method defined in the build.gradle of "cli" but I am not sure it runs. With command "gradle clean test" the build is successfull but I see no test results.
test {
include '*/cli/src/test/java/testsuites/*'
exclude '*/cli/src/test/java/com/myproject/mytool/*'
}
I have tried to add dependency and other things that I got from googling and at stackoverflow but of no use.Nothing seems to be working out.Can anyone help me to understand the basic steps and checks that I need to follow to create a gradle task for running junits? any help is appriciated.

build script don't runs when creating a Node.js and React app in Visual Studio

I following a step by step guide to configure Visual Studio 2019 in order develop a Node.js-React app.
The guide is here:
https://learn.microsoft.com/en-us/visualstudio/javascript/tutorial-nodejs-with-react-and-jsx?view=vs-2019
Briefly, the guide tells to configure an npm script (called "build") that should be fired when visual studio compiles, in order to generate app-bundle.js through typescript, using the app.tsx which contains a react component.
This must be done by adding the following code snipped to package.json
"scripts": {
"build": "webpack-cli app.tsx --config webpack-config.js"
}
however it doesn't work, because when i change something in app.tsx and run visual studio debbugger, the web page don't change at all.
If I run the following command using the nuget package console
npm run-script build
then it works fine!
So, is this a VS2019 bug, or is there some trick i miss?
Many Thanks for the help
I had similar problems like yours.
I solved this problem by this undocumented feature of visual studio 2017,2019:
BY manual editing,
You can add the following post-build event to package.json
"-vs-binding": { "AfterBuild": [ "build" ] }
by GUI,
in task runner explorer window,
select "build" task and let popup context menu open using right-mouse-button,
select bindings -> After build (make its preceding check box on)
this will add "-vs-binding" property to your package.json
Either one is okay. This works on vs 2017 and may works on vs 2019 either.
VS2017,2019 nodejs project build process seems
not to actually call my "build" script at all.
we should specify the "build" script as post-build event
for vs default nodejs build action.
It seems weired. I hope Microsoft solve this fault using patches.
task runner explorer capture image

error MSB4086: A numeric comparison was attempted on "$(MSBuildVersion)" that evaluates to "" instead of a number

Trying to deploy the project with Azure Kudu (reading from a BitBucket repo) I get the following error in Deployment Center within Azure Portal...
This error happened with all the latest versions of Microsoft.Net.Compilers NuGet package. The only version that worked was 3.0.0 from 5 months ago.
Anyone knows what's the cause of this? Is Azure Kudu not yet updated?
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling .NET Web Application deployment.
MSBuild auto-detection: using msbuild version '14.0.23107.0 built by: D14REL' from 'D:\Program Files (x86)\MSBuild\14.0\Bin'.
Restoring NuGet package Microsoft.Net.Compilers.3.1.1.
GET https://api.nuget.org/v3-flatcontainer/microsoft.net.compilers/3.1.1/microsoft.net.compilers.3.1.1.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.net.compilers/3.1.1/microsoft.net.compilers.3.1.1.nupkg 937ms
Installing Microsoft.Net.Compilers 3.1.1.
Adding package 'Microsoft.Net.Compilers.3.1.1' to folder 'D:\home\site\repository\packages'
Added package 'Microsoft.Net.Compilers.3.1.1' to folder 'D:\home\site\repository\packages'
NuGet Config files used:
D:\local\UserProfile\AppData\Roaming\NuGet\NuGet.Config
Feeds used:
D:\home\.nuget\
https://api.nuget.org/v3/index.json
Installed:
1 package(s) to packages.config projects
D:\home\site\repository\packages\Microsoft.Net.Compilers.3.1.1\tools\Microsoft.Managed.Core.targets(63,60): error MSB4086: A numeric comparison was attempted on "$(MSBuildVersion)" that evaluates to "" instead of a number, in condition "$(MSBuildVersion) >= 16.1.0". [D:\home\site\repository\MyCompany\MyCompany.csproj]
Failed exitCode=1, command="D:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "D:\home\site\repository\MyCompany\MyCompany.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="D:\local\Temp\8d727f56aa60788";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false /p:SolutionDir="D:\home\site\repository\.\\"
An error has occurred during web site deployment.
\r\nD:\Program Files (x86)\SiteExtensions\Kudu\84.10807.4030\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
### EDIT ###
I also opened an issue # Kudu GitHub repo.
I’ve had a similar issue with a kudu deployment and typescript versions. The basic issue seem to be that kudu is on its way out in favour of Azure DevOps so some dependencies of msbuild are becoming out of date. These are three options that might help you resolve the issue:
Switch to Azure DevOps - you’ll have access to various build agents and much more control over what they are capable of, but generally they’ll just be more up to date
Amend your build script - this is the script that kudu uses and you can customise it and then put it in source control, see this kudu doc for more info. Looks like you’re targeting msbuild 14 but I’m pretty sure 15 should be available and you can point your build script at this and/or make other tweaks
Process some of your build offline, ie before committing - this was my temporary solution with typescript, I was able to transpile to JavaScript and commit the js meaning I could disable typescript processing for kudu
It may also help to dig around in the targets file referenced in your log and trace back where the problem starts through the various msbuild conditions in that file. You can see all this by exploring via a command prompt in kudu.

TeamCity WindowsAzure.targets causing errors in deployment

We are currently trying to setup an Angular 2 project that also contains a Cloud Service project in its solution. We have set up numerous Angular 1 projects containing Cloud Service projects and have had no errors. When trying to run the MSBuild step for the Angular 2 project, we get the following error on the TeamCity build server:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Windows Azure Tools\2.7\Microsoft.WindowsAzure.targets(2787, 5): error MSB3021: Unable to copy file "C:\TeamCityBuildAgent\temp\buildTmp\.NETFramework,Version=v4.6.1.AssemblyAttributes.cs" to "C:\SourceControlFolder\Apps\MyApp\MyApp.CloudDeployment\obj\Debug\Website\C:\TeamCityBuildAgent\temp\buildTmp\.NETFramework,Version=v4.6.1.AssemblyAttributes.cs". The given path's format is not supported.
The main problem seems to be the build attempting to throw the full C:\TeamCityBuildAgent.. path into the obj\Debug\Website folder.
My current MSBuild parameters are:
/p:Configuration="Dev"
/p:platform="Any CPU"
/p:OctoPackEnforceAddingFiles=true
/p:OctoPackProjectName=MyApp_Dev
I've tried the following solutions:
Making sure the latest Visual Studio Update is installed (for MSBuild)
Running the install tool to repair Azure Tools 2.7 on the build server.
Changing the debug configuration in the build.
Ensuring TypeScript 1.7.6 is installed on the build server (even though it's an Azure.targets issue) [https://github.com/Microsoft/TypeScript/issues/6215]
Updated the project to Azure Tools 2.9. The same error remains except it's failing on the 2.9 folder instead now.
Curious if anyone else has experienced this error and knows a fix. I'll keep this post updated as I try other solutions.
Update
It appears that what is causing this issue is this line within the .csproj file:
<FilesToIncludeForPublish>AllFilesInProjectFolder</FilesToIncludeForPublish>
This is specified for our build configurations to copy all files generated by the ng build to the output directory of the publish. What I don't understand at the moment is how this works on all of the devs' local machines but does not work on our build server. Will keep this posted as I find more info or any kind of workaround.
This ended up being the fix:
Instead of targeting the .sln in MSBuild, we specifically targeted the .csproj file. This fixed the build errors and allowed us to keep the FilesToIncludeForPublish tag inside.

Nodejs TFS Build Definition

Can anyone let me know how the build definition for a node.js application should look like? Also how to mention the mocha tests in the Automated tests?
First time when I tried to queue a build, I got an error saying:
Microsoft.NodejsTools.targets not found.
So I went and copied the NodejsTools folder with the .target and dll file in my build server. And I didn't see the error.
Now I get the below error:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets (132): Could not copy the file "obj\Debug\OstNodeJs.exe" because it was not found.
You need the node.js framework and the Visual Studio node.js Tools on you build server, too. You just copied the necessarily files and this may result in other problems.
For the executable copy problem you can try to add <Disable_CopyWebApplication>True</Disable_CopyWebApplication> in the project file. See here: Build on TFS wants to copy a executable from Node.js test project

Resources