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

Regarding Multiple Conditions in Traget

$
0
0

Hello

I need to execute target based on multiple conditions.And i have following tag and its throwing me an error.

<Target Name="sometarget" Condition="'$(Configuration)' !== 'Server' or '$(DevServer)'=='true' or  '$(TestServer)'=='true' or '$(ComputerName)'=='XXX' or '$(ComputerName)'=='XXX'">

Error: Found an unexpected character ' ' at position 23 in condition

can any one help with this issue.

Thanks.



How to add multiple condition in the Condition=" " statement

$
0
0

 

 

 

<

CopyCondition=" '$(BuildBreak)'!='true' " I want put more than one condition what is the syntax.

 

 

 

SourceFiles="@(DllToCopy)"

 

 

DestinationFiles="@(DllToCopy ->'$(DropLocation)\$(BuildNumber)\Batch\%(Filename)%(Extension)')" />

 thank you

 

Building a single project using MSBuild independently

$
0
0

Hi!

I am hoping you could help me out regarding this.

I have a Visual Studio solution that can build a number of projects, one of the projects (example app) depends on the other projects.

I want to make a folder with only example app and the binaries, so that it's possible to build example app, independent of the other projects.

I am using MSBuild command line. 

How can I do this??

Please help!

Thanks!

TFS Build Definition for WEB API Project built under VS 2013 (4.5 framework)

$
0
0

I need to create a build definition for a WEB API project built in VS 2013 with 4.5 framework. At present, I have created a definition but facing some issues while publishing using publish profile(Web Deploy) method.

1 . Getting this error - C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Transform\Microsoft.Web.Publishing.AspNetCompileMerge.targets (418): Can't find the valid AspnetCompilerPath

2. How to provide encrypted password in MS Build Argument - /p:DeployOnBuild=True /p:PublishProfile=WebAPIServerProfile /p:VisualStudioVersion=12.0 /p:AllowUntrustedCertificate=True /p:Password=MyPassword

how to set IIS properties on deploy

$
0
0

I was able to get Continuous integration, TFS build and webdeploy (from the tfs build server to a dev server) – all working.

One question: my IIS application currently gets deployed by WebDeploy with all the usual IIS defaults.

I’d like to customize this so that I can specify or override some IIS properties such as the physical path, the app pool to be used, etc.

I didn’t see command line parameters to do that…but there must be a way … 

Listed below are my current MSBuild Arguments that are in the build definition. I’m using VS and TFS 2012 and windows 2012 (not r2). 

Thanks. Chris

/p:GenerateProjectSpecificOutputFolder=true /p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:MSDeployPublishMethod=WMSVC  /p:MSDeployServiceUrl=https://server1:8172/msdeploy.axd /p:AllowUntrustedCertificate=true /p:DeployIISAppPath="Default Web Site/MyIISApplication" /p:UserName=myServer\MyUserId /p:Password=myPassword

Devenv /Rebuild setup project meet an c# compiler cannot load error.

$
0
0

Hello, Experts

I have an setup project within VS2010, and I have a msbuild script which invoke the devenv to build it to a setup file. But recently, there is nothing change in the build environment, it suddenly give an error like following:

error  : Project 'TestProject' could not be opened because the Mic
rosoft Visual C# 2010 compiler could not be created. QueryService for '{7D960B16-7AF8-11D0-8E5E-00A0C911005A}' failed.

'TestProject' is written in C#.

But it can be build when I manually open VS2010 to build it.

After run command "devenv /Log", I found, when I meet the error, it always has following load package  error, and every time it is the same.

I am still researching what cause that error. Please give me some help.

BTW: if I build with Devenv /SafeMode, it will work, because it skip load these package, but I want to find the issue and solve it, I cannot use safemode all the time.

Thanks & Best Regards

Carson

Visual Studio generates hundreds of MSBuild.exe processes on build, causing build to fail.

$
0
0

Hello there,

My Visual Studio has recently been having problems in which when I build my application (Run without debugging) Visual Studio opens about 200 processes and the build fails.

These processes do not disappear, which causes slowdowns as each takes up about 3-4MB of memory.

The processes are mostly MSBuild.exe, and I believe conhost.exe.

Thank you

The element beneath element is unrecognized C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets error

$
0
0

Hi all

I was working on my project and everything was ok. But there was a problem my intellisense was not working properly. I searched the issue from internet and applied the found solutions. They said delete the 10.0 file from computer under %AppData% . After that my project started not working. Also I put the file back it still gives the error 

The element <#text> beneath element <PropertyGroup> is unrecognized C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets error

I read other solutions but could not solve. It is so urgent , I am waiting help. 

Thank you.



VS2012 always report "unable to translate Unicode \uD887 at index 952 to specified code page" error when i build a project.

$
0
0

I just tying VS2012 on win7, however, whenever i build a project( web, windows form, etc), it always report below error. i can't continue with VS 2012 , could someone help me?

Error 1 The build stopped unexpectedly because of an internal failure.
System.Text.EncoderFallbackException: Unable to translate Unicode character \uD887 at index 952 to specified code page.
   at System.Text.EncoderExceptionFallbackBuffer.Fallback(Char charUnknown, Int32 index)
   at System.Text.EncoderFallbackBuffer.InternalFallback(Char ch, Char*& chars)
   at System.Text.UTF8Encoding.GetByteCount(Char* chars, Int32 count, EncoderNLS baseEncoder)
   at System.Text.UTF8Encoding.GetByteCount(String chars)
   at System.IO.BinaryWriter.Write(String value)
   at Microsoft.Build.BackEnd.NodePacketTranslator.NodePacketWriteTranslator.TranslateDictionary(Dictionary`2& dictionary, IEqualityComparer`1 comparer)
   at Microsoft.Build.Execution.BuildParameters.Microsoft.Build.BackEnd.INodePacketTranslatable.Translate(INodePacketTranslator translator)
   at Microsoft.Build.BackEnd.NodePacketTranslator.NodePacketWriteTranslator.Translate[T](T& value, NodePacketValueFactory`1 factory)
   at Microsoft.Build.BackEnd.NodeConfiguration.Translate(INodePacketTranslator translator)
   at Microsoft.Build.BackEnd.NodeProviderOutOfProcBase.NodeContext.SendData(INodePacket packet)
   at Microsoft.Build.BackEnd.NodeProviderOutOfProc.CreateNode(Int32 nodeId, INodePacketFactory factory, NodeConfiguration configuration)
   at Microsoft.Build.BackEnd.NodeManager.AttemptCreateNode(INodeProvider nodeProvider, NodeConfiguration nodeConfiguration)
   at Microsoft.Build.BackEnd.NodeManager.CreateNode(NodeConfiguration configuration, NodeAffinity nodeAffinity)
   at Microsoft.Build.Execution.BuildManager.PerformSchedulingActions(IEnumerable`1 responses)
   at Microsoft.Build.Execution.BuildManager.HandleNewRequest(Int32 node, BuildRequestBlocker blocker)
   at Microsoft.Build.Execution.BuildManager.IssueRequestToScheduler(BuildSubmission submission, Boolean allowMainThreadBuild, BuildRequestBlocker blocker) e:\oliver\my documents\visual studio 2012\Projects\WindowsFormsApplication3\WindowsFormsApplication3\WindowsFormsApplication3.csproj WindowsFormsApplication3

Microsoft.Build.Construction compatibility with project files saved by future versions of Visual Studio

$
0
0

As described in MSBuild is now part of Visual Studio!, MSBuild 4.5 is part of the .NET Framework, but MSBuild 12.0 and later versions ship only in a separate Microsoft® Build Tools package, which is installed as part of Visual Studio. I'm wondering how those later versions are going to extend the format of project files, and whether such changes will eventually make it impossible to manipulate the project files via the ProjectRootElement class of MSBuild 4.5. I do not mean actually building the project; rather, I mean loading a project file, adding or removing some items in it, and saving it back.

Has Visual Studio "14" CTP already changed the project file format so that MSBuild 4.5 cannot load it, or loading and saving it would cause some details to be lost? How likely are future versions of Visual Studio to make such changes?

The context of these questions is that we have a proprietary utility that generates or updates .csproj files. Nowadays, it loads the project file with System.Xml.Linq, manipulates the XML tree, and writes it out again. This works pretty well but the resulting indentation is not exactly the same as what Visual Studio would generate, which causes spurious differences in version control. I'm thinking of changing the utility to use the classes of the Microsoft.Build.Construction namespace instead, as I expect the resulting files would then match the style used by Visual Studio. However, the utility does not currently depend on Microsoft® Build Tools, and I'd like to keep it that way, so it would instead have to use the MSBuild version that is in the .NET Framework. I'm afraid that this could eventually cause incompatibility with .csproj files saved by future versions of Visual Studio. The current implementation with System.Xml.Linq might not support such files either, but at least we can easily fix it if we come across any problems. Fixing the classes in Microsoft.Build.Construction would not be so easy.

RowNumber function missing numbers

$
0
0

I am using the RowNumber function on a report of mine. In this example the table name is "table1" so my expression is =RowNumber("table1"). I just recently realized that my report is skipping a number or two. It switches what number every so often and how many (for example sometimes it will skip two numbers. It does not leave off any data just skips the number while numbering the rows. Anyone know why it does this? and how to fix the problem?

ASP.NET Web Application build with MSBuild binaries 12.0 does not work on server

$
0
0

Hello,

since I have installed VS 2013 and opened a VS 2010 web application project with VS 2013 I can only use the MSBuild binaries version 12.0 located at
C:\Program Files (x86)\MSBuild\12.0\bin or C:\Program Files (x86)\MSBuild\12.0\bin\amd64 to build my projects over the the command line.

Before I had installed VS 2013 I was able to use MSBuild binaries located at %windir%\Microsoft.NET\Framework\v4.0.30319 or %windir%\Microsoft.NET\Framework64\v4.0.30319
to build my projects over the the command line.

Unfortunately the Web Application projecs build with the 12.0 binaries do not work on my target server (with .NET 4.5.1 and IIS 7.5 installed).

What are the prerequisites for ASP.NET appliation build with 12.0 binaries? What else is needed on the target server beside .NET Framework 4.5.1?

Or how can I build my projects with the 'old' binaries in the Microsoft.NET directory again?

Thanks

"@

$
0
0

When i look at the MFCDLL.MAK, some strange charactors puzzles me:

$D\stdafx.obj $D\stdafxs.pch: stdafx.cpp stdafx.h
 cl @<<
/c $(CPPFLAGS_STATIC) /Ycstdafx.h /Fp$D\stdafxs.pch stdafx.cpp
<<

What's the meaning of "@<<" and "<<"?


Where shall I begin,please,your Majesty!

how to write 2 command lines in "post build event command line " in VS 2010

$
0
0

hi

   may i ask how to write 2 command lines in "post build event command line " in VS 2010?

   for example:

   I want to execute 2 command lines

xcopy "$(ProjectDir)\lib\project.exe" "$(TargetDir)" /Y

xcopy "$(ProjectDir)\lib\project.exe.config" "$(TargetDir)" /Y

  In the BuildEvent how could I write? thank u very much

Faking the ToolsVersion attribute

$
0
0

I have a long running tooling project that creates packages for multiple versions of visual studio (2005/2008/2010/2012/2013). The .csproj files (of which there are dozens) are all heavily macroized using an external targets files that gets the right references, framework version, etc. based on environment variable settings. Although I'm required to have a separate solution file per project for each VS version [these are small files and only the version information at the top changes], I've managed to keep all of the project files loading in all visual studio versions without VS either telling me the files aren't recognized or trying to upgrade them.

The fly in the ointment has been the ToolsVersion attribute, which cannot be macroized due to its placement on the root element of the project file. I always use toolsversion:#.# for command line builds with msbuild, but AFAIK VS doesn't have a similar setting. I've just been setting this attribute to the latest version as new ones roll out: the earlier VS versions have been ignoring unrecognized tools and reverting to their default tool set, and the latest VS version doesn't try to upgrade my project when I open the file.

This worked great until the switch to ToolsVersion="12.0". VS2013 tries to upgrade my projects for any earlier version (the project files were all previously 4.0), but VS2008 refuses to load them at all with this ToolsVersion. After some reading and experimentation, I discovered that VS doesn't care about the number of the ToolsVersion attribute, but rather about what it points to in the registry.

Given that none of the official ToolsVersion numbers work with all of the VS versions I created a fake version instead. The project files now have ToolsVersion="12.34", and I have a small batch file that copies the full contents of 2.0/3.5/4.0/12.0 keys under HKLM\SOFTWARE[\Wow6432Node]\Microsoft\MSBuild\ToolsVersions into the 12.34 key in the same location. I now run my little batch file before opening the projects in a given version of VS (look at the VSVer.bat file in the trunk directory at orm.sf.net if you're curious).

Obviously, this feels like a total hack, but desperate times call for desperate measures. Building the older versions from the latest VS incarnation is not a viable option because I have multiple academic teams that build this project: I can't control which VS version is in use, and I can't make them install specific/multiple/all versions. One project file per VS version is also not a realistic option due the explosion in maintenance costs. Dynamically changing the project files before opening is also not realistic because of the source control implications. Basically, any solution that doesn't allow the same project file to open unmodified in all of the VS versions is unacceptable.

Question:

  1. I'm curious what others have done in this situation.
  2. Is there any other more official way, or should I continue with this approach?
  3. Can I macroize this information in some property group? This would need to work for all of the VS versions.
  4. Is there some hidden VS command line option or setting that does the same thing astoolsversion for MSBuild?

Thanks,

-Matt


Unidentifiable bottleneck when building multiple projects in parallel

$
0
0

We are working in a solution with almost 200 projects in it, most of which results in DLLs and a few executables. Completing a rebuild takes about 16 minutes to build on my computer, a 6 core Intel Xeon with 32GB of RAM. When building MSBuild is instructed to build 12 projects in parallel and to maximize the number of concurrent C++ compilations. We've done some analysis of the build times by measuring the time to rebuild with 1, 2, up to 12 parallel projects and concurrent C++ compilations and the results show that after 4 there is no longer any decrease in build time. We've profiled the system using Performance Monitor which shows 90-95 % CPU load, and very low load on disk. No anti-virus software is active and the processes consuming most CPU are the cl.exe. Just to be sure we've also tried using an SSD disk and it didn't make any difference. We've tried different RAM speeds and while the time to build decreased using the setting 1, 2, and 3 we still hit some bottleneck at 4.

Does anyone have any idea why we aren't seeing any benefit beyond 4 parallel projects/concurrent C++ compilations?

Could I Release my software package with msvcr120.dll (not with a VCRedist_x86.exe)

$
0
0

My application depends on only msvcr120.dll not full vcredist_x86.exe . 

Is this legal?

Want to set properties conditioned on the target running

$
0
0

I want to set a few properties but only when a specific Target is being executed from within my VS project file. For example, when the Publish target is executed. Is there a property that contains the target that is active? I've reviewed a diagnostic log but I don't see anything that is unique to that target execution.

Property Sheet not loading in VS2013

$
0
0

I have a solution that was recently converted from VS2010 to VS2013. In some of the projects we use property sheets to import common configurations, such as include and library dirs. After the conversion the property sheet configuration were not being loaded, even though the "<Import Project="*.props" />" element was present in the *vcxproj.

The workaround I found was to remove the propery sheets from the projects and then re-add them. The diff between the versions showed that only the element position changed. For example:

BEFORE:

  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">

    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
    <Import Project="..\build\FOO.props" />
    <Import Project="..\build\BAR.props" />

  </ImportGroup>

AFTER:

  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">

    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
    <Import Project="..\build\BAR.props" />

    <Import Project="..\build\FOO.props" />

  </ImportGroup>

Why does this happen?

I am using the following configuration:

Visual Studio Professional 2013.

Version 12.0.30723.00 Update 3.

.NET Framework Version 4.5.50938

[Reference Problem] Build dll for each class - One project to several dll

$
0
0

Hello,

I have a build problem on my project. It's a CS project.

I must build each class in my project to a dll. I include others projects in this project by dependencie.

To build several dll I haven't problem. References are ok because I use direct path to build.

My problem it's when I would like build my project on a build server...my server haven't the same path like on my build the project.

So I would like define a build with the references define in my csproj.

I use the tag References="@(Reference)" but I have the bug  : the metadata file 'Microsoft.CSharp' is not find.... and that with all others references : system, system.Core, System.Data...

I had use the alias in the reference but I haven't find a solution with that...I have a problem with the system.Object

Can you help me about the parameters to define to build with the reference define in the csproj and not define with a hard path?

Presently my project build with this definition :

<?xml version="1.0" encoding="utf-8"?><Project ToolsVersion="4.0" DefaultTargets="Rebuild" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"><Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /><PropertyGroup><Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration><Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform><ProjectGuid>{98Z42P4D-3D3A-4BCF-35C6-540F57F10221}</ProjectGuid><OutputType>Library</OutputType><AppDesignerFolder>Properties</AppDesignerFolder><RootNamespace>Print.DataAccess</RootNamespace><AssemblyName>Print.DataAccess</AssemblyName><TargetFrameworkVersion>v4.5</TargetFrameworkVersion><FileAlignment>512</FileAlignment></PropertyGroup><PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "><DebugSymbols>true</DebugSymbols><DebugType>full</DebugType><Optimize>false</Optimize><OutputPath>bin\Debug\</OutputPath><DefineConstants>DEBUG;TRACE</DefineConstants><ErrorReport>prompt</ErrorReport><WarningLevel>4</WarningLevel></PropertyGroup><PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "><DebugType>pdbonly</DebugType><Optimize>true</Optimize><OutputPath>bin\Release\</OutputPath><DefineConstants>TRACE</DefineConstants><ErrorReport>prompt</ErrorReport><WarningLevel>4</WarningLevel></PropertyGroup><PropertyGroup><SignAssembly>false</SignAssembly></PropertyGroup><PropertyGroup><AssemblyOriginatorKeyFile></AssemblyOriginatorKeyFile></PropertyGroup><ItemGroup><Reference Include="System" ></Reference><Reference Include="System.Core" ></Reference><Reference Include="System.Xml.Linq" ></Reference><Reference Include="System.Data.DataSetExtensions" /><Reference Include="Microsoft.CSharp" ></Reference><Reference Include="System.Data" ></Reference><Reference Include="System.Xml" ></Reference></ItemGroup><ItemGroup><Compile Include="DataFlow1.cs"><Plugin>true</Plugin></Compile><Compile Include="DataFlow2.cs"><Plugin>true</Plugin></Compile><Compile Include="DataFlow3.cs"><Plugin>true</Plugin></Compile><Compile Include="DataFlow4.cs"><Plugin>true</Plugin></Compile><Compile Include="Properties\AssemblyInfo.cs" /></ItemGroup><ItemGroup><ProjectReference Include="..\SAndBoxBuildMulti\Interface\Interface.csproj"><Project>{e3debzad-ddab-4cc2-8105-3772pdlebbe8}</Project><Name>Interface</Name></ProjectReference></ItemGroup><ItemGroup><Content Include="TextFile1.txt" /></ItemGroup><Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /><Target Name="BuildPlugins"><CSC 
	Condition="%(Compile.Plugin) == 'true'" 
	Sources="%(Compile.FileName).cs;Properties\AssemblyInfo.cs" 
	TargetType="library" 
	OutputAssembly="$(OutputPath)%(Compile.FileName).dll" 
	EmitDebugInformation="true" 
	NoConfig="true"
	DisabledWarnings="1701,1702"
	NoStandardLib="true"
	ErrorReport="prompt"
	WarningLevel="4"
	DefineConstants="DEBUG;TRACE"
	References="D:\Profiles\lab1\Documents\Visual Studio 2012\Projects\SandBoxBuildMulti\Interface\bin\Debug\Interface.dll;C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll; C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.configuration.dll; C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll; C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll; C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll; C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.XML\v4.0_4.0.0.0__b77a5c561934e089\System.XML.dll"/></Target><Target Name="Clean"><Delete Files="$(OutputPath)*.*" /></Target><Target Name="Rebuild" DependsOnTargets="Clean;BuildPlugins"></Target><PropertyGroup><PostBuildEvent></PostBuildEvent></PropertyGroup></Project>

Best Regards

Rabbiwan

Viewing all 2763 articles
Browse latest View live


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