Quantcast
Channel: MSBuild forum
Viewing all 2763 articles
Browse latest View live

How to make an ItemGroup reference a set of subdirectories instead of files?

$
0
0
I just started using MSbuild this weekend, and I'm loving it so far, but my work has produced some questions. 
With the current ItemGroup notation, is there a way to make an itemgroup that grabs all subdirectories for a particular directory?  We have a set of N builds, and they are stored in directories like so:
Builds\
    Product1.0.0.0\
    Product1.5.0.0\
    Product2.0.0.0\
    Product2.3.0.0\
  
I am currently trying to make an MSBuild file that helps me build patches between every version of our product and the last version of our product.  To do that, I need to iterate over each of these directories.  My first instinct was to use ItemGroups cool file finding ability to find all of my subdirectories:

<ItemGroup>
    <BuildDirectories Include="Builds\*"/>
</ItemGroup>

Unfortunately, it looks like ItemGroup just knows how to find files.  As a workaround, I currently know that every build folder will have a PatchNotes.html file inside, so I search for that recursively (Builds\**\PatchNotes.html) and then iterate over the RecursiveDir metadata of my items.  This works, but I am not sure that I'll always have the luxury of knowing that each of my sub-folders will have a unique file.  Do I need to write my own task to get subdirectory items so conveniently?

Many thanks,

   Taylor

How to see the command line? ("Forcing rebuild of all source files due to a change in the command line since the last build. " problem)

$
0
0

 VS2010, building a native C++ project, only ever building in VS2010. Problem: every half-dozen builds or so, MSBuild decides the command line has changed, logs the "Forcing rebuild of all source files due to a change in the command line since the last build." message, and rebuilds my entire project.

 

 I am doing nothing different when this happens -- every time, I just edit a .cpp file and hit build, but sometimes it thinks the command line has changed, for some reason. I am not touching the project file/settings, and looking at other similar questions, no, I am not running devenv from the command line, and this is the standard MSVC compiler. I'm not sure if this is related to number of builds, or some sort of elapsed-time issue; I can't make it happen to order, but I also can't stop it from happening..

 

 How can I find out what the command line _is_? Maybe that way I could at least see why MSBuild thinks it's changed.

 

 -- dan

 

 

Discrepancy between command-line MSBuild and External Tools MSBuild for VS 2013

$
0
0

I am using MSBuild from the command-line to build my solution and it fails on my Visual Studio 2013 Web Application projects with the following error message:  "The imported project C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplication\Microsoft.WebApplication.targets" was not found.  Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

When I examined my .csproj Web Application project, I found the following line:

<PropertyGroup><VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion><VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath></PropertyGroup><Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />

Therefore, it seems that when I am running the project through the command line, the value is being translated to v11.0 rather than v10.0!

However, if I set up MSBuild as an External Tool within Visual Studio 2013, the build works just fine without any error messages.

I am completely perplexed at this issue which somehow appears to be a defect in MSBuild project file handling but I cannot determine the root cause.

Please advise as to how to solve this problem.

Thanks.

How to start an exe (with arguments) using batch file

$
0
0

I have an exe which will use arguments

When i try to start the exe, it works and till I close the application the command prompt waits

i tried using start command but couldn't able to pass my argument.

Is there any way I can just only start the application and use the command prompt without waiting for the application to close its handle ? 

ToolsVersion errors from MSBuild. Visual Studio 2012 and 2013.

$
0
0

Running a program using a dirent.h header file. File compiled before installing Visual Studio 2013. Now will compile but not run properly and throw debug errors.

I removed visual studio 2013 and will retry installing it after I solve my 2012 issue.

I uninstalled and re installed 2012.

Now visual studio 2012 compiles the program but has ToolsVersion errors.

Specifically: "Project file contains ToolsVersion="12.0". This toolset may be unknown or missing, in which case you may be able to resolve this by installing the appropriate version of MSBuild, or the build may have been forced to a particular ToolsVersion for policy reasons. Treating the project as if it had ToolsVersion="4.0". For more information, please see http://go.microsoft.com/fwlink/?LinkId=291333."

I didn't find any relevant information pertaining to the issue on the link. 

Exception's thrown when run through debug (exceptions were not thrown previously): "Unhandled exception at at 0x75BEC41F in MassRenameFile.exe: Microsoft C++ exception: std::out_of_range at memory location 0x003FF4A4."

"Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call.  This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention."

"Microsoft Visual C++ Runtime Library Debug Error! ...Invalid allocation size: 4294967288 bytes."

Modifying one source file causes "Forcing rebuild of all source files due to a change in the command line since the last build"

$
0
0

We had a VS2012 solution with 106 projects (C/C++). Recently, when a cpp or c file is changed, hitting Build will cause the whole project rebuild. Sometime when I modify a file and hit Compile (active file only), I can even see that StdAfx.cpp being compiled in the output window (but of course I never modify it), this is a really strange behavior that we never see before.

So I changed output verbosity to Diagnostic and I saw another post describes the same issue, see:

http://social.msdn.microsoft.com/Forums/vstudio/en-US/aca632fa-e1e0-4511-aa03-a309ae547a5b/how-to-see-the-command-line-forcing-rebuild-of-all-source-files-due-to-a-change-in-the-command?forum=msbuild

However, none of those mentioned methods fix the issues.

And by the way, I can see this LNK2011 error now and then:

precompiled object not linked in; image may not run

I had to rebuild the projects dumping this error to continue my work, we never see such error before, so I am wondering it might be related.

So I am wondering whether there is a switch or something like that to tell me exactly which part of the command line had been changed, or, at least tell me the original command line and the new command line? Or specifically, what can be done to help to get this resolved?

By the way, this issue does not happen all the time, it seems to occur randomly. 

Thanks,

Kenny




Incompatibility between .net framework 4.0 and WinXP and v100 toolset?

$
0
0

Thanks in Advance..

Please help me to resolve following issue...

**Problem scenario:** 
Multi-targeted application.
I am working on a Windows MFC-SDI application developed with VisualStudio2010, Win7, v100 toolset. This application is consuming one managed wrapper module, which in turn making use of one legacy .net assembly. Basically it is wrapping this .net assembly which is built and targeted for .net 4.0.
Now, it is required to target this application for Win7 and WinXP both.
This application works fine on Win7 but unable to launch on WinXP?

When I debugged and drill-down problem, I found that wrapper is causing problem. Wrapper works when I build it to target .net 3.5. But it fails for .net 4.0.
The problem is legacy .net assembly which need to be wrapped is unavailable in .net 3.5.

**Note:** .net framework 4.0 and "VC++ 2010 redistributable" is already installed on WinXP machine.

**Error message while launching this on WinXP:**


**Question:**


1. Is there any incompatibility between .net 4.0 and WinXP and v100 toolset?
2. Do I need to take care for any specific project setting in my *.vcxproj of wrapper?


Build VC++ (VS2005) project in MSBuild using TFS 2012 - Possible?

$
0
0

Hi,

I have a VC++ project(.vcproj) that developed in VS2005 IDE. it is not migrated to later versions yet and this project successfully built in VS 2005 IDE only. 

I need to setup automated build for this project and I am using MSBuild in TFS 2012 version. I will need to create a build definition and select vc++(.vcproj ) file. I have installed VS 2005 version in my build server and when I build this project in build sever in VS 2005 IDE , it is building successfully. 

1. Can I build a VC++ project i.e. .vcproj (VS 2005) in MSBuild TFS 2012 ?

2. If Yes, How DO I do that? 

3. If no, Please explain, why and what are the alternative options for me?

Re-Posting in MSBuild forum as suggested in http://social.msdn.microsoft.com/Forums/vstudio/en-US/be471222-3681-472b-b67b-a947d54764af/build-vc-vs2005-project-in-msbuild-using-tfs-2012?forum=tfsbuild#be471222-3681-472b-b67b-a947d54764af

Regards,

Praka


Prakash


How to correct CheckRemoteFx45 and UsingTask declaration?

$
0
0

Hi, I'm hoping someone can help me interpret this error:

Error 1 The "CheckRemoteFx45" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.Tasks.dll.  Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.  0 0 forms

I received it when I tried to publish a simple web forms application to the azure website, from the Visual Studio 2013 Virtual Machine. The application runs on local host, and I downloaded publishing settings from the azure website. I'm unfamiliar with the UsingTask declaration, so I'd like help to locate and correct this declaration.

Failed to execute command: ""C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\ResGen.exe" After vs2010 upgrade

$
0
0

Full Error:

Error82 Failed to execute command: ""C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\ResGen.exe" /useSourcePath /r:E:\IASTFS2010\IAS\Integration\R3\runtime\IAS.ExtensionMethods.dll /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll "/r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Transactions.dll /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /compile Properties\Resources.resx,obj\Debug\IAS.Architecture.Properties.Resources.resources". The handle is invalid.E:\IASTFS2010\IAS\Integration\R3\Build\IAS.Architecture\IAS.Architecture\TRACKERIAS.Architecture

I see that there are a few Microsoft connects that claim to deal with this issue, but none of the workarounds are working.  The only way I can get my projects to compile is if I change the target framework to 4.0. Which at this point is not an option. Does anyone else have any idea how to fix this? 


FYI: the problem is reproducible if you upgrade a project and a resources (.resx)  file. 

Unable to build a .Net 3.5 application created in VS 2010. It throws resgen.exe failed message

$
0
0
I created .net web application in VS 2010. I am working on WIN7 64bit system. We have target .net 3.5 framework. When trying to build or debug its throwing an exception "can not execute resgen.exe"

Shobin Mathew <a href="http://blog.ancheril.net">AIS Blog</a>

_CopyFilesMarkedCopyLocal target could not copy error msb3027 msb3021

$
0
0

I am getting the following error during a build.

(_CopyFilesMarkedCopyLocal target) -> 
  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(3004,9): error MSB3027: Could not copy xxxxxx. Failed. 
  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(3004,9): error MSB3021: Unable to copy file xxxx is denied. 

On one build server this happens once in a while and restarting the build works.

On a newer build server which has more processors and memory it is failing all the time.

We are using 2010 build agents with upgrade template and tfsbuild.proj file to build our solutions.

I have added the following to the tfsbuild.rsp file without any success

"/p:OverwriteReadOnlyFiles=true"

"/p:BuildInParallel=false"
"/maxcpucount:1"

Could you please help.

Thanks.


Intellisense missing items

$
0
0
I recently switched to VS2010. The Intellisense is acting really weird. Even after I add a reference, say System.Data, the Intellisense will not give me the option of System.Data when you type "using". If I manually add using System.Data, the intellisense won't work when you try to access the class members of System.Data. For example, DataSet is not listed in Intellisense. I have tried resetting the user settings by going to start> run, devenv /resetusersetting, but it did not fix the problem. I don't have this problem in VS2005. Once I add a reference in VS2005, it always appears in the Intellisense. What was I doing wrong?

MSBuild ASPNETCompiler Generates Codedom provider error

$
0
0

Build Server Window 2003

I have a website consisting of class asp and .net 2.0 web forms that I am porting to 4.0. We are also adding MVC 3 into the mix. On my build machine, I have set up .net 4.0 using the full install exe and MVC 3 via the web platform installer. The box also has VS shell installled for getting source for version contol.

The ms build script is here:

<!-- compile website into a dll -->
<ItemGroup>
 
<CodeFilesInclude="$(Source)\XXXXWeb\**\*.cs"/>
</ItemGroup>
<CSCSources="@(CodeFiles)"TargetType="Library"References="@(Reference)"OutputAssembly="XXXWeb.dll">
</CSC>

<!-- compile website after placing XXXWeb.dll into the bin dir of the site -->
<AspNetCompiler
        
VirtualPath="/XXXWeb"
        
PhysicalPath="XXXXXX\DOICLARIS\"
        
TargetPath="F:\Inetpub\XXXWebSite\XXXWeb\"
        
Force="true"
        
Debug="true"
       
/>

When it runs the aspnet compile, I get the following error:

ASPNETCOMPILER : error ASPCONFIG: The CodeDom provider type "Microsoft.VisualC.CppCodeProvider, CppCodeProvider, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" could not be located.

I have executed the same script on a different machine. I have reinstalled .net 4, MVC 3, and even Visual Studio 2010 without any result.

The script executes on other machines.

Any help would be appreciated.

Thanks

Supress Warning in MSBuild

$
0
0

HI,

I want to Supress the warnings of the project when i am using MSBuild. So that warnings like. Private Field xyz never used.

Thanks,

Sumesh

 

 


how to use the customize environment variable in csproj.

$
0
0

I created a web project  , and edit the csproj file.  change the import node  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />  to <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VSVersion)\WebApplications\Microsoft.WebApplication.targets" />,  but it failed to reload . did any guys who know the reason?  additionally , I have set the value of VSVersion in system environment variable equal to 10.0 . how to use the customize environment variable in csproj.

Thx


Visual Studio 2008 not warning for errors when program debug?

$
0
0

Im using VS 2008 , when im debug in my programs , it don't warn me errors.But it has erros?

can any one tell me how to configure settings for this issue??

MSBuild complains of command line change in VC++ VS 2010 Project build

$
0
0

We have a solution which contains some 200 projects. Most of them are VC++ projects. We have been hit with rebuild issues for some projects. In some cases MSBuild process is still running in the background after the build is complete causing VS 2010 to crash.

After troubleshooting the issue further, i noticed that MSBuild complains of command line change and rebuilds cpp files.

The issue is reproducable almost all the time, after building the project from the master solution if i rebuild the project separetly from another VS 2010 instance, it claims that the command line has changed and it rebuilds it.

Forcing rebuild of all source files due to a change in the command line since the last build. (TaskId:22)

After comparing both the command lines, the only difference I find is the /b argument that has been specified for the tracker.exe

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\Tracker.exe /d C:\Windows\Microsoft.NET\Framework\v4.0.30319\FileTracker.dll /i C:\Src\trunk\tempBuild\x64\Debug\WinTools /r C:\SRC\TRUNK\LIBS\WINTOOLS\STDAFX.CPP /b MSBuildConsole_CancelEventbc42312c663c4b3fbf7ad9c0d03688e2  /c "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\CL.exe"  /c /IC:\Src\trunk\commonProperties\..\PrecompiledHeader /IC:\Src\trunk\commonProperties\..\com /IC:\Src\trunk\commonProperties\..\libs /IC:\Src\trunk\commonProperties\..\libs\Imports\x64\Debug\ /Zi /nologo /W3 /WX- /MP /Od /D OEMRESOURCE /D WINTOOLS_BUILD /D WIN32 /D _WINDOWS /D WINVER=0x0502 /D _CRT_SECURE_NO_DEPRECATE /D _WINDLL /D _AFXDLL /D _AFXEXT /D _DEBUG /D _WINDLL /GF /Gm- /EHsc /RTC1 /MDd /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Yc"StdAfx.h" /Fp"C:\Src\trunk\commonProperties\..\tempBuild\x64\Debug\WinTools\PrecompiledHeader.pch" /Fo"C:\Src\trunk\commonProperties\..\tempBuild\x64\Debug\WinTools\\" /Fd"C:\Src\trunk\commonProperties\..\tempBuild\x64\Debug\WinTools\ProgramDatabase.pdb" /Gd /TP /errorReport:prompt StdAfx.cpp (TaskId:22)

Especially the part which is highlighted below:

/b MSBuildConsole_CancelEventbc42312c663c4b3fbf7ad9c0d03688e2

Any thoughts on why would that part be different when executing the same project from two different instances of VS 2010 or is just by design? Am I troubleshooting the issue in an incorrect manner?


Please remember to mark the replies as answers if they help Thanks, --Kuldeep

error CS1606: Assembly signing failed; output may not be signed -- The process cannot access the file because it is being used by another process.

$
0
0

I am getting the following error while using MSBuild: "error CS1606: Assembly signing failed; output may not be signed -- The process cannot access the file because it is being used by another process." This error sometimes occurs and sometimes doesn't while performing a build on the same code base. It also sometimes occurs and sometimes doesn't while using the underlying MS-DOS command. However, it does NOT occur while compiling within VS2005.  It also appears to be the SAME assembly.  Any ideas?

MSBuild Output:

Target MasterBuildAndDeploy:
        Target ActualBuild:
            "C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\..\IDE\devenv.exe" C:\Development\Workspaces\saugust\Endurance.Insurance.IITP\main\BuildScripts\..\\Endurance.ESB.sln /Build Debug /Out "C:\Development\Workspaces\saugust\Endurance.Insurance.IITP\main\BuildScripts\..\\Logs\Endurance.ESB.sln.log"
            C:\Development\Workspaces\saugust\Endurance.Insurance.IITP\main\BuildScripts\Endurance.ESB.MGA.Build.Common.Targets(98,3): error MSB3073: The command ""C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\..\IDE\devenv.exe" C:\Development\Workspaces\saugust\Endurance.Insurance.IITP\main\BuildScripts\..\\Endurance.ESB.sln /Build Debug /Out "C:\Development\Workspaces\saugust\Endurance.Insurance.IITP\main\BuildScripts\..\\Logs\Endurance.ESB.sln.log"" exited with code 1.
        Done building target "ActualBuild" in project "Endurance.ESB.MGA.Build.General.proj" -- FAILED.
    Done building target "MasterBuildAndDeploy" in project "Endurance.ESB.MGA.Build.General.proj" -- FAILED.

VS Output:

------ Build started: Project: Endurance.ESB.Schemas, Configuration: Development .NET ------
Updating references...
Performing main compilation...
C:\Development\Workspaces\saugust\Endurance.Insurance.IITP\main\Endurance.ESB.Common\Endurance.ESB.Schemas\MGA_Policy_Request_Envelope.xsd: warning BEC1006: Node "<Schema>" - The distinguished field 'IsValidated' might not exist in the schema.
C:\Development\Workspaces\saugust\Endurance.Insurance.IITP\main\Endurance.ESB.Common\Endurance.ESB.Schemas\MGA_Policy_Request_XML.xsd: warning BEC1002: Node "EndorsementNumber" - Data type of this field or simple content record (xs:int) and the promoted property 'ns0:EndorsementNo' (xs:string) should be the same or they should map to the same CLR Type.
C:\Development\Workspaces\saugust\Endurance.Insurance.IITP\main\Endurance.ESB.Common\Endurance.ESB.Schemas\MGA_Policy_Request_XML.xsd: warning BEC1002: Node "EndorsementNumber" - Data type of this field or simple content record (xs:int) and the promoted property 'ns0:EndorsementNumber' (xs:string) should be the same or they should map to the same CLR Type.
C:\Development\Workspaces\saugust\Endurance.Insurance.IITP\main\Endurance.ESB.Common\Endurance.ESB.Schemas\MGA_Policy_Request_XML.xsd: warning BEC1005: Node "<Schema>" - The promoted field or simple content record 'ns1:IsValidated' might not exist in the schema.
C:\Development\Workspaces\saugust\Endurance.Insurance.IITP\main\Endurance.ESB.Common\Endurance.ESB.Schemas\PolicyTransactionsBatch.xsd: warning BEC1008: Node "PolicyTransactionsBatch" - Body XPath property is invalid or references a node that may not exist in the schema.
c:\Development\Workspaces\saugust\Endurance.Insurance.IITP\main\Endurance.ESB.Common\Endurance.ESB.Schemas\AssemblyInfo.cs(21,12): warning CS1699: Use command line option '/keyfile' or appropriate project settings instead of 'System.Reflection.AssemblyKeyFile'
error CS1606: Assembly signing failed; output may not be signed -- The process cannot access the file because it is being used by another process. 

Build complete -- 1 errors, 6 warnings 


Shawn (Mail@ShawnAugust.Com)


MSDeploy - how can I set the physical path of the web application on the destination server

$
0
0

I have a web application that I publish to a zip file that will be used by other users to deploy the application onto web servers. When the application is deployed, the Physical Path used for the application in IIS Manager needs to be something other than how it is defined in my build environment.

I'm using parameters to make changes to various config files when the app is deployed with MSDeploy.exe, but I haven't had any success finding a way to set the physical path of the web site.

Any suggestions?

Viewing all 2763 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>