PostBuildEvent error copying config file - c#

i am trying to build my project and getting this error:
Error 148 The command "copy "C:\Users\agordon\Documents\Visual Studio 2008\Projects\SubversionRepository\Internal Application\eFormsSystem\eFormsApp\Debug.config" "C:\Users\agordon\Documents\Visual Studio 2008\Projects\SubversionRepository\Internal Application\eFormsSystem\eFormsApp\bin\Debug\eFormsApp.exe.config"
copy "C:\Users\agordon\Documents\Visual Studio 2008\Projects\SubversionRepository\Internal Application\eFormsSystem\eFormsApp\Debug.config" "C:\Users\agordon\Documents\Visual Studio 2008\Projects\SubversionRepository\Internal Application\eFormsSystem\eFormsApp\App.config"" exited with code 1. C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets 3397 13 eFormsApp
here is the compiler generated code for this copying process:
<Target
Name="PostBuildEvent"
Condition=
"
'$(PostBuildEvent)'!=''
and
(
'$(RunPostBuildEvent)'!='OnOutputUpdated'
or
'$(_AssemblyTimestampBeforeCompile)'!='$(_AssemblyTimestampAfterCompile)'
)
"
DependsOnTargets="$(PostBuildEventDependsOn)">
<Exec WorkingDirectory="$(OutDir)" Command="$(PostBuildEvent)" />
</Target>
the error points to this line:
<Exec WorkingDirectory="$(OutDir)" Command="$(PostBuildEvent)
what am i doing wrong?

For me, the source config file did not exist (I had custom build profile). Once I copied that config file from another known good one and modified it for my environment, everything started working.

Related

How to resolve console application exited with code 9009

Im try to run a c# console application in build process by using below command
<Target Name="AfterBuild" AfterTargets="AfterBuild">
<Exec Command="$(ProjectDir)$(OutputPath)$(AssemblyName).$(OutputType)" />
</Target>
Error when Build : error exited with code 9009
Note : This error occurs due to my project have space in parent folders
this same scenario working fine when parent folder name does not have space
How to resolve this issue?

How to build Visual studio Setup project using command-line?

I have a sample WPF project and I created a Setup project to it. Now I want to build the project and Setup project through the command line.
I tried with this
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe
C:\Users\nandh\source\repos\CommendApp\CommendApp\CommendApp.csproj
command for build the project file it is successfully worked.
Then use with
devenv /build Debug
"C:\Users\nandh\source\repos\CommendApp\CommendApp.sln" /project
"C:\Users\nandh\source\repos\CommendApp\App\App.vdproj" /projectconfig
Debug
for build the setup project it shows error.
------ Starting pre-build validation for project 'App' ------
ERROR: An error occurred while validating. HRESULT = '8000000A'
------ Pre-build validation for project 'App' completed ------
Regards.
Have reproduced same issue in my machine. And resolve it by workaround from it3xl.
Create a Text Document file in desktop and copy the content from this xx.bat file into it. (for professional editon)
Save and rename the text document from xx.txt to Test.bat
Double click the Test.bat file, then this issue goes away when i rebuild them by devenv command.
Hope it helps.
Here is my build.bat script using Visual Studio Installer Projects Extension in Visual Studio 2022. Hope it helps someone.
#echo off
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
set "{{=setlocal enableDelayedExpansion&for %%a in (" & set "}}="::end::" ) do if "%%~a" neq "::end::" (set command=!command! %%a) else (call !command! & endlocal)"
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
del build.log
%{{%
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\devenv.exe"
XXXX.sln
/out build.log
/build Release
/project XXX.Setup\XXX.Setup.vdproj
/projectconfig Release
%}}%

Wix installer build failure : error CNDL0103: The system cannot find the file

I am trying to create a Wix CustomActions Assembly to set installer properties at msi installation time for my VS2012 c# solution. In the IDE when I right click and build the installer for the web service (OU.Curriculum.ProductService) I get the following error:
The system cannot find the file 'obj\Debug\VantageInstallerCustomActions_Generated.wxs' with type 'Source'. candle.exe OU.Curriculum.ProductService.Installer
The last few lines of the build output shows the following:
2> C:\Program Files (x86)\WiX Toolset v3.8\bin\Heat.exe dir O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService\obj\Debug\Package\PackageTmp\ -cg OU.Curriculum.ProductService_Generated -dr INSTALLFOLDER -scom -sreg -srd -var var.OU.Curriculum.ProductService_Generated.Target -gg -sfrag -t O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService.Installer\WsxExcludeWebConfig.xslt -out obj\Debug\OU.Curriculum.ProductService_Generated.wxs
2> C:\Program Files (x86)\WiX Toolset v3.8\bin\Heat.exe project O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService\OU.Curriculum.ProductService.csproj -configuration Debug -directoryid INSTALLFOLDER -platform AnyCPU -pog Binaries -pog Symbols -pog Sources -pog Content -pog Satellites -pog Documents -projectname OU.Curriculum.ProductService -ag -sfrag -out obj\Debug\_OU.Curriculum.ProductService.wxs
2> C:\Program Files (x86)\WiX Toolset v3.8\bin\candle.exe -dVantageInstallerCustomActions_Generated.Target=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\VantageInstallerCustomActions\obj\Debug\Package\PackageTmp\ -d"DevEnvDir=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\\" -dSolutionDir=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\ -dSolutionExt=.sln -dSolutionFileName=OU.Curriculum.Products.sln -dSolutionName=OU.Curriculum.Products -dSolutionPath=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.Products.sln -dConfiguration=Debug -dOutDir=bin\Debug\ -dPlatform=x86 -dProjectDir=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService.Installer\ -dProjectExt=.wixproj -dProjectFileName=OU.Curriculum.ProductService.Installer.wixproj -dProjectName=OU.Curriculum.ProductService.Installer -dProjectPath=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService.Installer\OU.Curriculum.ProductService.Installer.wixproj -dTargetDir=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService.Installer\bin\Debug\ -dTargetExt=.msi -dTargetFileName=OU.Curriculum.ProductService.Installer.msi -dTargetName=OU.Curriculum.ProductService.Installer -dTargetPath=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService.Installer\bin\Debug\OU.Curriculum.ProductService.Installer.msi -dOU.Curriculum.ProductService.Configuration=Debug -d"OU.Curriculum.ProductService.FullConfiguration=Debug|AnyCPU" -dOU.Curriculum.ProductService.Platform=AnyCPU -dOU.Curriculum.ProductService.ProjectDir=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService\ -dOU.Curriculum.ProductService.ProjectExt=.csproj -dOU.Curriculum.ProductService.ProjectFileName=OU.Curriculum.ProductService.csproj -dOU.Curriculum.ProductService.ProjectName=OU.Curriculum.ProductService -dOU.Curriculum.ProductService.ProjectPath=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService\OU.Curriculum.ProductService.csproj -dOU.Curriculum.ProductService.TargetDir=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService\bin\ -dOU.Curriculum.ProductService.TargetExt=.dll -dOU.Curriculum.ProductService.TargetFileName=OU.Curriculum.ProductService.dll -dOU.Curriculum.ProductService.TargetName=OU.Curriculum.ProductService -dOU.Curriculum.ProductService.TargetPath=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\OU.Curriculum.ProductService\bin\OU.Curriculum.ProductService.dll -dVantageInstallerCustomActions.Configuration=Debug -d"VantageInstallerCustomActions.FullConfiguration=Debug|x86" -dVantageInstallerCustomActions.Platform=x86 -dVantageInstallerCustomActions.ProjectDir=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\VantageInstallerCustomActions\ -dVantageInstallerCustomActions.ProjectExt=.csproj -dVantageInstallerCustomActions.ProjectFileName=VantageInstallerCustomActions.csproj -dVantageInstallerCustomActions.ProjectName=VantageInstallerCustomActions -dVantageInstallerCustomActions.ProjectPath=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\VantageInstallerCustomActions\VantageInstallerCustomActions.csproj -dVantageInstallerCustomActions.TargetDir=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\VantageInstallerCustomActions\bin\Debug\ -dVantageInstallerCustomActions.TargetExt=.dll -dVantageInstallerCustomActions.TargetFileName=VantageInstallerCustomActions.dll -dVantageInstallerCustomActions.TargetName=VantageInstallerCustomActions -dVantageInstallerCustomActions.TargetPath=O:\TFS\Vantage\Curriculum\source\OU.Curriculum.Products-Release2.1-Dev-Violet\VantageInstallerCustomActions\bin\Debug\VantageInstallerCustomActions.dll -out obj\Debug\ -arch x86 -ext "C:\Program Files (x86)\WiX Toolset v3.8\bin\\WixUtilExtension.dll" -ext "C:\Program Files (x86)\WiX Toolset v3.8\bin\\WixIIsExtension.dll" obj\Debug\VantageInstallerCustomActions_Generated.wxs Product.wxs obj\Debug\Product.Generated.wxs obj\Debug\_OU.Curriculum.ProductService.wxs
2>candle.exe(0,0): error CNDL0103: The system cannot find the file 'obj\Debug\VantageInstallerCustomActions_Generated.wxs' with type 'Source'.
2>Done building project "OU.Curriculum.ProductService.Installer.wixproj" -- FAILED.
========== Build: 1 succeeded, 1 failed, 6 up-to-date, 0 skipped ==========
Here is my solution setup:
I'm struggling to understand why "VantageInstallerCustomActions_Generated.wxs" is being requested and causing the error as I have not included it. I can see it in the output but have no idea what has caused it to be added to the candle.exe cmd line. Any ideas how to remove it ?
Update: I believe it may have something to do with my OU.Wix.targets file:
<Project
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="BeforeBuild">
<MSBuild Projects="%(ProjectReference.FullPath)"
Targets="Package"
Properties="Configuration=$(Configuration);Platform=AnyCPU"
Condition="'%(ProjectReference.WebProject)'=='True'" />
<PropertyGroup>
<DefineConstants>%(ProjectReference.Filename)_Generated.Target=%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\;</DefineConstants>
<CompilerAdditionalOptions>$(IntermediateOutputPath)%(ProjectReference.Filename)_Generated.wxs</CompilerAdditionalOptions>
<LinkerAdditionalOptions>$(IntermediateOutputPath)%(ProjectReference.Filename)_Generated.wixobj</LinkerAdditionalOptions>
</PropertyGroup>
<HeatDirectory OutputFile="$(IntermediateOutputPath)%(ProjectReference.Filename)_Generated.wxs"
Directory="%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\"
Transforms="$(MSBuildProjectDirectory)\WsxExcludeWebConfig.xslt"
DirectoryRefId="INSTALLFOLDER"
ComponentGroupName="%(ProjectReference.Filename)_Generated"
AutogenerateGuids="false"
GenerateGuidsNow="true"
SuppressCom="true"
SuppressFragments="true"
SuppressRegistry="true"
SuppressRootDirectory="true"
ToolPath="$(WixToolPath)"
Condition="'%(ProjectReference.WebProject)'=='True'"
PreprocessorVariable="var.%(ProjectReference.Filename)_Generated.Target"
/>
</Target>
</Project>

MSTest.exe (VS2012) crashes QTAgent32.exe

i am trying to execute our tests via cmdline.
I use VS2012, but i always get this error:
When i run the tests directly in VS2010 on the same machine they run fine.
I can't use VS2010 for cmdline because we have the wrong license ( assembly finding doesn't work ) so i have to use 2012.
All Windows updates are present.
Has somebody had similar issues with MSTest/VS2012 ?
If you want to keep VS 2012 update 2, 3, or 4 installed, you can try the below workaround:
Run the below commands in the command line:
DEL /S %windir%\*Microsoft.VisualStudio.QualityTools.Tips.UnitTest.AssemblyResolver.ni.dll*
DEL /S %windir%\*Microsoft.VisualStudio.QualityTools.ExecutionCommon.ni.dll*
This is a workaround provided by Microsoft guys.
You need run this batch again after you install Visual Studio updates or sometime even Windows Updates.
I followed Yanhua's Microsoft article link and found a workaround that I liked better than deleting random files:
Use vstest.console.exe instead of mstest.exe.
Note, the arguments for vstest.console.exe are different. It wants a space-separated list of test.dll's
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "TestProject1.dll"
Here is my msbuild setup that does the same thing:
<PropertyGroup>
<MSTEST>"$(VS110COMNTOOLS)..\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"</MSTEST>
</PropertyGroup>
...
<Target Name="MyTests" >
<ItemGroup>
<!-- These Items should be evaluated at Target runtime -->
<TestFiles Include="..\Tests\**\bin\$(Configuration)\*.Test.dll" />
</ItemGroup>
<!-- Run Tests -->
<PropertyGroup>
<!--TestSuccessOrNot is the property specify whether the Test is sucess or not -->
<TestSuccessOrNot>1</TestSuccessOrNot>
</PropertyGroup>
<Exec Command="$(MSTEST) #(TestFiles, ' ')" >
<Output TaskParameter="ExitCode" PropertyName="TestSuccessOrNot"/>
</Exec>
<Error Text="Tests Failed" Condition="$(TestSuccessOrNot) == '1'" />
</Target>
I have had the same problem. I just removed update 2 of Visual Studio 2012.
Steps:
Remove update 2 of Visual studio 2012 (via View installed updates)
Restart system
Change installation of Visual Studio 2012 (via Uninstall or change a program->change->Fix)
Restart system

Problem with building with csc task in Ant

I have an ant build target using csc:
<target name="compile">
<echo>Starting compiling ServiceLauncher</echo>
<csc optimize="true" debug="true" warnLevel="1"
unsafe="false" targetType="exe" failonerror="true"
incremental="false" mainClass = "ServiceLauncher.Launcher"
srcdir="ServiceLauncher/Launcher/"
outputfile="ServiceLauncher.exe" >
<reference file="libs/log4net.dll"/>
<define name="RELEASE"/>
</csc>
</target>
When I run it, the following exception comes up:
csc failed: java.io.IOException: Cannot run program "csc": CreateProcess error=2, The system cannot find the file specified
However, it runs without the exception but never correctly builds the .exe file, when I manually add in an empty ServiceLauncher.exe.
How can I correctly build this .Net project "ServiceLauncher"?
My guess is that csc.exe is not on the execute path.
From the documentation for the csc task:
csc.exe on Windows or mcs on any other platform must be on the execute path, unless another executable or the full path to that executable is specified in the executable parameter

Categories