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

$(OutDir) and $(TargetPath) macros are empty

$
0
0

Hello everybody.

I have a problem building a solution (with multiple projects) in Visual Studio 2012 w/Update 1.

I started to experience an issue during the build process (DEBUG mode). It seems that the post-build event does not set a value for the $(OutDir) and $(TargetPath) macros. So my post-build script (an XCOPY) fails.

The build process worked fine in the past weeks. I don't remember any change to my VS installation/configuration except the installation of the Update 1.

Any idea?

Thank you.

Kind regards.

Marcello


.:. Marcello Rutter .:.


Is there a way to override $(VCTargetsPath) from the project file?

$
0
0

I needed to build my software for several different platforms using Microsoft Visual C++ and MSBuild.  I added the platforms to the $(VCTargetsPath) directory and created the .props and .targets files.  I then copied the files to my configuration management repository, defined a path to the parent directory for the copied files: $(CM_REPO_PATH), and wanted to redirect the build system to use the files in the repository.

I am able to get the project to work when I create an environment variable on my machine called %MSBuildExtensionsPath% and point it to $(CM_REPO_PATH)\MSBuild.  What I want, though, is to set the $(VCTargetsPath) and/or $(MSBuildExtensionsPath) within the visual studio project...not to set an environment variable on every developer's machine. 

This problem is related to the thread on "Override VCTargetsPath for VS 2010 and MSBuild", and I see similar results.

Anyway, when I add the property group to override the variables, it doesn't seem to work.  Is there a way to do this?

Batch file to run gpresult on remote computers

$
0
0
I want to take out the list of policies applied on a list of computers using batch file. How should i do it??? i am new to batch scripting.

\m/

TFS2013 build copies extra assemblies by CopyFilesMarkedCopyLocal

$
0
0

Hi there

I have issue with tfs team build. There is a solution with several dozen of projects and I've created a build definition for it. Everything works fine except assemblies placing in bin directories which currently is completely non-deterministic. 

Below I present simplified structure of my project with references

Service1
- Library1 (copy local:true / ref by project)
// types from Reference1 and Reference2 aren't used 
Service2
- Library1 (copy local:true / ref by project)
// types from Reference1 and Reference2 aren't used
Service3
- Library1 (copy local:true / ref by project)
- Reference2 (copy local:true / ref by file)
- Reference3 (copy local:true / ref by file)
Library1
- Reference2 (copy local:false / ref by file)
- Reference3 (copy local:false / ref by file)

For each team build of same sources version bin directories looks different. Below some cases of outputs:

Case1: (correct output)
Service1\bin: Service1.dll, Library1.dll
Service2\bin: Service2.dll, Library1.dll
Service3\bin: Service3.dll, Library1.dll, Reference2.dll, Reference3.dll

Case2:
Service1\bin: Service1.dll, Library1.dll, Reference2.dll, Reference3.dll
Service2\bin: Service2.dll, Library1.dll, Reference2.dll, Reference3.dll
Service3\bin: Service3.dll, Library1.dll, Reference2.dll, Reference3.dll

Case3:
Service1\bin: Service1.dll, Library1.dll, Reference2.dll, Reference3.dll
Service2\bin: Service2.dll
Service3\bin: Service3.dll, Library1.dll, Reference2.dll, Reference3.dll

Additionally I've observed that issue is generated during CoreCompile action and from same sets of references different sets of files are copied in _CopyFilesMarkedCopyLocal action.

Is there any fix for such behavior and what can cause this ?

How to create package bundles with makeappx.exe in win8.1/vs2013?

$
0
0

Hi, Dear all,

I am developing an app on win8.1/vs2013, and it could be built with both msbuild.exe and the vs2013 IDE. With the IDE we could create a mixed packages which contains the both arm and x86 versions with vs2013 when creating the package.

 

I have two questions:

1. could we do it with msbuild.exe? I think there should exist a "standard" procedure or code segment but would you please give me any hint? I've studied the output of the IDE but it is really not useful.

2. if I make the build command in a makefile or .cmd file, could we assign the output path for the bundle? I mean by setting the path as an environment variable or something else in the Makefile or a .cmd file, then the .vcxproj could consume it.

 

Thank you all very much!

Referenced assembly 'mscorlib.dll' targets a different processor

$
0
0

hi.

I have a VS2013 solution that has several build configurations; one of them builds for x64, another for x86. The solution contains c#, cli and c++ Projects. It also has localized resources that get build into satellite assemblies during the build.

The solution builds ok and the resulting binary runs just fine. However, during the build, i get the warning

"Referenced assembly 'mscorlib.dll' targets a different processor".

This only happens in the x64 build, and it only happens for projects within the solution that have localized resources. How can i get rid of this warning?

WM_THXADVANCE
-thomas woelfer


http://www.die.de/blog

Calculate Code Metrics for a Solution

$
0
0

Hi,

  I would like to export the Code metrics for a solution file from command line. How can i acheive this.?

  I came to know that we could acheive it through a tool given by Microsoft called "Metrics Power Tool", But the problem is that, the file which is coming as outpt is an XML file. I need it in an excel format similar to the one provided from export optioon available through Visual Studio IDE.

  Please share your thoughts/ideas on it.

  

 

Duplicate items are not supported by the "Resources" parameter error when building project

$
0
0
Hello,
         While building our current project using Visual studio 2005 we stumbled on this error,
===
Error    16    The item "xxx" was specified more than once in the "Resources" parameter.  Duplicate items are not supported by the "Resources" parameter
===
          we traced the issue down to resource file naming convention differences between Windows Vista and Windows XP
ie, for a given form, if we include chinese traditional and chinese simplified resources,
On Vista
the resx files must be named with zh-HANS / zh-HANT , using zh-CHS/zh-CHT VS2005 will choke
On XP
the resx files must be named with zh-CHS/zh-CHT, using zh-HANS/zh-HANT VS2005 will choke
         This is really causing trouble, as we develop both in XP and Vista, is there any way we can avoid this ( beside excluding the languages)
        
any help is greatly appreciated.

Hyt.

Publish XBAP applications from msbuild?

$
0
0
Is there a way to publish my XBAP  application from inside my msbuild script?

We have an integration server that is setup just like our production server.  I have scripts that deploy all of our other projects, but I can't get msbuild to publish the xbap applications the way VisualStudio does.  

Is there a way to automate the publication of xbap apps as part of my build process? 
EAI Architect

forcing a target to clean and rebuild using msbuild

$
0
0
how to clean a solution file and build, using msbuild.

ImportTask not recognized.

$
0
0

Hi,

 I'm fairly new to the details of MSBuild and I'm running into a problem concerning the Import Task.
We need dev environment specific task to get done with each local build. We don't want these task in Post-Build scripts because they affect people when we say add new references. So here's where I'm at...

Overriding AfterBuild in our main csprj file like so

<Target Name="AfterBuild">
    <Message Text="This is the AfterBuild target" Importance="normal" />
    <Exec Command="echo ------------------------------------------------------------------------------" />
    <Exec Command="echo  Moving support files to staging area." />
    <Exec Command="echo ------------------------------------------------------------------------------" />
   
    <Import Project="$(ProjectDir)\Deployment\PostBuild.targets"/>
   
</Target>

Throws this...

Error 100 The "Import" task was not found. Check the following: 1.) The name of the task in the project file is the same as
the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.)
The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the
"C:\Program Files (x86)\MSBuild\12.0\bin" directory...... 


Am I missing an Assembly reference or something? I'm struggling to find what assembly to Import type exist in and how to add that reference.


I appreciate your time,
  Travis


Travis

VC++ Directories?

$
0
0

Hi,

I can't compile c/c++ app in VS 2012. The problem is with the include directive, the compiler not recognizing the include keyword. This is problem only with the standard libraries, stdio, iostream etc... 

Actually vs c++ point to c:/program files/visual studio 11.0 .... also i have 12.0 folder maybe this is the problem....

Can someone help me how to point to the include directories to point to right place to recognize standard libraries...

Thanks


no-unknown-pragmas Triggering error

$
0
0

Hello,

I am using cmake in conjunction with VS12 64 bit.  Cmake is generating the flag "-Wno-unknown-pragmas" and VS is complaining: Command line error D8021: invalid numeric argument '/Wno-unknown-pragmas'.  I am trying to compile to flann library.  Is this a change that was made in Visual Studio, or should cmake not have generated that flag?  The intel compiler thinks it's a valid flag, not sure about msbuild.  http://software.intel.com/sites/products/documentation/doclib/iss/2013/compiler/cpp-lin/GUID-D060680A-1A18-4574-8291-5C74E6E31335.htm

Thanks,

Eric




custom csproj

$
0
0

Hello,

i have custom csproj file: (Imports and PropertyGroups are removed)

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"><ItemGroup>  <Compile Include="..\..\**\*.cs" Exclude="..\..\**\*.aspx.cs;..\..\**\*.ascx.cs;..\..\CsScripts\**\*.cs"><Link>$([System.String]::Copy('%(Compile.RelativeDir)').Substring(6))%(Compile.Filename).cs</Link></Compile></ItemGroup><ItemGroup><Content Include="@(Compile->'%(rootdir)%(directory)WebTemplate.xml')" /></ItemGroup></Project>

this works, but it will include some unwanted *.cs files... 

Basically i want to select all *.cs files if there is WebTemplate.xml file in same firectory

For example from structure bellow it will select Dir1/file1.cs and Dir3/Dir3-1/file3-1.cs as Compile and both WebTemplate.xml as Content...

  • Dir1
    • file1.cs
    • WebTemplate.xml
  • Dir2
    • file2.cs
  • Dir3
    • Dir3-1
      • file3-1.cs
      • WebTemplate.xml
    • Dir3-2
      • file3-2.cs

I tried this, but it doesnt work:

<Compile Include="..\..\**\*.cs" Exclude="..\..\**\*.aspx.cs;..\..\**\*.ascx.cs;..\..\CsScripts\**\*.cs" Condition="Exists(@(Compile->'%(rootdir)%(directory)WebTemplate.xml'))"><Link>$([System.String]::Copy('%(Compile.RelativeDir)').Substring(6))%(Compile.Filename).cs</Link></Compile>

thanks for any help...

cheers

Problem with VS 2013 build/ MVC5 EF6

$
0
0

This has happened twice now, so I have to ask; are there teething problems with VS 2013? 

I have gone to bed twice, feeling happy that I had achieved something, only to find when I tried to continue  my work the next day - it was gone! The code I had debugged stopped working and none of the Models were recognised. They all came up empty when I ran my query.

My Entities connection seemed to be corrupt, and while I tried to build and rebuild again and again, it does not see the existing model.

Has this happened to others?

Today was a crusher. I had spent 3 days (MY WEEKEND!) getting the damn viewmodel to populate properly with a linq query, went to sleep satiated, only to find this morning my Model is completely empty!

My data is STILL in my database, my connection string is still valid, nothing has changed there; my controller codes have not changed, its all as I left it and I cannot fathom why my viewmodel that worked so well last night is empty!

I know the price for being a "first adaptor", I've been at this for 20 years, but c'mon! What's up with this? Is there something we should know about Visual Studio 2013?

Alex Robinson


Never a dull moment



error LNK1318: Unexpected PDB error; FORMAT (11)

$
0
0

When compiling a large C++ project with VS 2012 I periodically get this error:

error LNK1318: Unexpected PDB error; FORMAT (11)

The error goes away if I rebuild the non-linking projects again. What does this error mean? I could not find any documentation on the subject. Is it a bug in the linker or, perhaps, an indication of disk failure? It's a brand new disk and I never saw any other indication of potential failure than this error.

Please advise.

Web Site Project Builds in Devenv but not in MSBuild

$
0
0

I'm on VS2012 Update 3 using TFS2012.

I build the same solution using devenv and msbuild.  When I get to the Web Site projects, devenv doesn't report any errors, but msbuild does repeatedly.  Sample of the logs for both:

**Devenv:**

114>------ Build started: Project: C:\...\API\, Configuration: Debug Any CPU ------  
114>Could not get dependencies for project reference 'A'Could not get dependencies for project reference 'BusinessLogic' Could not get dependencies for project reference 'BusinessLogic.ASPAgents' Could not get dependencies for project reference 'DataAccessLogicComponents' Could not get dependencies for project reference 'UI'Validating Web Site
114>Building directory '/API/'.  
114>  
114>Validation Complete

**MSBuild:**

 121>C:\Scrubbed\API.metaproj : warning MSB3274: The primary reference "C:\Scrubbed\PreMVC\A\bin\Release\A.dll" could not be resolved because it was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".  
   121>C:\Scrubbed\API.metaproj : warning MSB3274: The primary reference "C:\Scrubbed\PreMVC\BusinessLogic\bin\Release\A.Web.BusinessLogic.dll" could not be resolved because it was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".  
   121>C:\Scrubbed\API.metaproj : warning MSB3275: The primary reference "C:\Scrubbed\PreMVC\BusinessLogic\bin\Release\A.Web.BusinessLogic.dll" could not be resolved because it has an indirect dependency on the assembly "A, Version=0.0.0.15, Culture=neutral, PublicKeyToken=060d385c0c45e767" which was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".  

         C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /API -p PreMVC\API\ -u -f PrecompiledWeb\API\ 

   121>C:\Scrubbed\PreMVC\API\App_Code\File1.cs(7): error CS0234: The type or namespace name 'BusinessLogic' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj]  
   121>C:\Scrubbed\PreMVC\API\App_Code\File1.cs(8): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj]  
   121>C:\Scrubbed\PreMVC\API\App_Code\File1.cs(12): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj]  
   121>C:\Scrubbed\PreMVC\API\App_Code\File2.cs(7): error CS0234: The type or namespace name 'BusinessLogic' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj]
   121>C:\Scrubbed\PreMVC\API\App_Code\File2.cs(8): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj]  
   121>C:\Scrubbed\PreMVC\API\App_Code\File2.cs(12): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj]
   121>C:\Scrubbed\PreMVC\API\App_Code\File3.cs(7): error CS0234: The type or namespace name 'BusinessLogic' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj]
   121>C:\Scrubbed\PreMVC\API\App_Code\File3.cs(8): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj]  
   121>Done Building Project "C:\Scrubbed\API.metaproj" (Rebuild target(s)) -- FAILED.

Any ideas?

using MSbuild to automate build with multiple programming language

$
0
0

Our client wants to automate the build (common task like pull code out of source control, build code, copy to deployment folder etc...) for multiple projects. It is currently manul process.Some projects are in Vb5/ Vb6, some projects are written in .net and some projects using both VB6 &.net. They are using VSS and SVN (subversion) as a source repository. They want to use Msbuild to automate the build for all these projects. I have few questions regarding this

  1. Is it possible to automate VB5, VB6 projects using MSbuild ?
  2. Do we need to write separate Msbuild script for each and every project or Is there any way we can simplify this process of automating in above scenario – multiple programming language, different source control?

 

Any help/suggestion on this is greatly appreciated. Thanks in advance!


Cannot programmatically package project with MSBuild

$
0
0

I am trying to package a Visual Studio .csproj with MSBuild programmatically (using namespace Microsoft.Build.Evaluation). I can correctly package this project with command like like

MSBuild"C:\Users\Documents\Visual Studio 2010\Projects\TestMvc\TestMvc\TestMvc.csproj"/T:Package

But when I use the following code (I implemented my own logger, but it does not matter here):

var project =newMicrosoft.Build.Evaluation.Project(@"C:\Users\Documents\Visual Studio 2010\Projects\TestMvc\TestMvc\TestMvc.csproj");var logger =newOutputLogger(_panel);List<Microsoft.Build.Framework.ILogger> loggers =newList<Microsoft.Build.Framework.ILogger>();
            loggers.Add(logger);var targets =newstring[]{"Package"};var result = project.Build(targets, loggers);Microsoft.Build.Evaluation.ProjectCollection.GlobalProjectCollection.UnloadProject(project);

Solution is not built. Logger gives me an error "Output file "obj\Debug\TestMvc.dll" does not exist."

After I build this project in Visual Studio manually (when all the binaries are successfully built), then this code packages the project succesfully. So there are all nesessary binaries available already.

The question is: why "Package" target launched programmatically is not equal to "Package" lanunched by command line and how to force the former do the same action as its commandlike counterpart?

UPD: If I use command line, I get the following result

Build started 17.12.201218:48:21.Project"TestMvc\TestMvc.csproj" on node 1(Package target(s)).ValidateGlobalPackageSetting:
  $(PackageAsSingleFile)isTrue
  $(PackageFileName)is obj\Debug\Package\TestMvc.zip.Validating...GenerateTargetFrameworkMonikerAttribute:Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.CoreCompile:
  c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Csc.exe /noconfig ......CopyFilesToOutputDirectory:Copying file from"obj\Debug\TestMvc.dll" to "C:\temp\build\TestMvc.dll".TestMvc-> C:\temp\build\TestMvc.dllCopying file from"obj\Debug\TestMvc.pdb" to "C:\temp\build\TestMvc.pdb".

If I use programmatic launch, I get the following log:

Project"TestMvc\TestMvc.csproj"(Package target(s)):TargetValidateGlobalPackageSetting:
    $(PackageAsSingleFile)isTrue
    $(PackageFileName)is obj\Debug\Package\TestMvc.zip.Validating...TargetGenerateTargetFrameworkMonikerAttribute:Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.TargetCopyFilesToOutputDirectory:Copying file from"obj\Debug\TestMvc.dll" to "C:\temp\build\TestMvc.dll".
    c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2868,9): error MSB3021:Unable to copy file "obj\Debug\TestMvc.dll" to "C:\temp\build\TestMvc.dll".Couldnot find file 'obj\Debug\TestMvc.dll'.Done building target "CopyFilesToOutputDirectory"in project "TestMvc.csproj"-- FAILED.Done building project "TestMvc.csproj"-- FAILED.

So CoreComplile target is not launched and I still don't understand why.

UPD2. If I save my project in code by calling project.Save("filename.xml"), resulting project file is the same as my TestMvc.csproj. So by this I've checked that projects are similar.

UPD3. Same errors occurs for Build target.


Do I have to code the AppManifest.xml file myself?

$
0
0

I just went to submit my app to the store, but it had an error with the manifest file. Here's what I've got:

<Deployment xmlns="http://schemas.microsoft.com/client/2012/deployment"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"><Deployment.Parts></Deployment.Parts></Deployment>

Now i'm a noob to the developing scene, but there is something not right about the code in the manifest? Is Visual Studio supposed to code the manifest automatically or have I got to do it all myself?

If someone could answer or give me advice it would be appreciated :) Thanks

Viewing all 2763 articles
Browse latest View live


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