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

Duplicate Template Alias Compiler Bug?

$
0
0
#include <string> //remove this header to remove the compiler error

template<class T>
class A {
  public:
    A(){}
};

template<class T>
using AA = A<T>;

//duplicate using statement
template<class T>
using AA = A<T>;

int main(int argc, char *argv[]) {
    // template instantiation not required to produce error
    //AA<int> a;
    return 0;
}

Compiling this code with:

cl main.cpp /EHsc

Results in strange compiler errors (and only if the string header is included)

Using msbuild tools:  compiler version: 19.00.24210 for x64  on windows 8.1 with windows 8 SDK installed.

Can anyone reproduce this?

Mokhtar


How can I get the Error Code from Error List in VS 2015/2017 with DTE? Or other ways can get error code?

$
0
0

I want to extend the Error List in Visual studio 2015/2017,I only use the DTE can get the ErrorItem however the ErrorItem don'e contain the ErrorCode just like below, how can i get the error code? Thanks in advance! 


Adding of .RC2 file

$
0
0

hi dont find any option to add .RC2 file, im using VS2005 do let me know how to

How to get Folder auto complete in Visual Studio 2015?

$
0
0

My folder auto complete isn't working anymore.

Before I can type src="~/" and it will give me a list of suggested folders and images in my CONTENT folder.

Now it doesn't !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

What should I do to resolve this?

Any fix for the MSB3491 Could not write lines to file "D:\code\..\tools\optimized\obj811\amd64\Tools\Tools.tlog\Tools.lastbuildstate". Could not find a part of the path '

$
0
0

How do i fix the error

MSB3491    Could not write lines to file "D:\code\..\tools\optimized\obj811\amd64\Tools\Tools.tlog\Tools.lastbuildstate". Could not find a part of the path 'D:\some-path\tools\optimized\obj811\amd64\Tools\Tools.tlog\Tools.lastbuildstate'.

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets    312    

Indeed Tools.tlog does not exist .................

C# project : setting output directory to solution dir

$
0
0
Hello.

C++ projects outputs binaries in $(SolutionDir)$(ConfigurationName) (parameter in configuration properties/general).
I'd like to do the same for a C# project, so that the generated exe file will be next to some native dlls copied in $(SolutionDir)$(ConfigurationName) via a custom build step of a C++ managed project.

Looking to this page (http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=92755), setting $(SolutionDir)$(ConfigurationName)\ in properties/build tab of a C# project should work. But in my case it creates a directory named "$(SolutionDir)$(ConfigurationName)" in the project directory, next to bin, obj, and the source files.

I am using VS 2005 standard.

Any idea?

Need efficient way to run large number of SQL data scripts during deployment

$
0
0

I'm going to be deploying a SQL DB project to multiple servers and databases using TFS 2015.  I need to run a large number (i.e., 1,000 or so) of data scripts as part of each deployment.  

The data scripts populate/update configuration tables required by our front end so link it with the stored procedures in the database.  It's not an ideal solution, but it's what I have to work with.  

In the old days of TFS 2005, this would be a snap...I'd just add them all to the .lst file, they'd be part of the build script, and we'd run it across all installations.  

Unfortunately, TFS 2015, while making other things easier, seems to make this much harder.  I've seen articles on running SQL scripts as part of a post-build event using a Powershell script, but this would have two problems:

  1. There are an awful lot of scripts, broken into folders, subfolders and sub-subfolders.  Scripting it would be a nightmare.  
  2. Since I'm deploying to multiple DBs on multiple servers, the specification of the server and database in the Powershell script would be a real problem.  

Is there really no way to make data scripts part of the build process in TFS 2015?  Is there another, simpler alternative that I've missed?  

Can't get SQL project to build correctly

$
0
0

I'm having trouble getting a SQL project to build correctly in Visual Studio 2015 Community.

I need to build a script that can a) stand up tables & indexes for new customer databases and b) update existing customer databases with new tables, columns & indexes.  For future versions, I need to be able to generate partial builds that include only the table scripts that have been updated.  All of this is stuff I've done in much earlier versions of VS, which somebody else had already configured. 

I've got 100+ table creation scripts that I've added to the database project.  Each one includes an existence check for the table, that looks like this: 

IF OBJECT_ID('PDE_VALIDATION_NOTES','U') IS NULL
BEGIN

When I build the project, every one of these existence checks is flagged as an error...even though I can copy & paste the code into SSMS and it runs without error. 

Visual Studio also builds database creation into the build scripts, which is neither needed nor wanted.  The databases will be already be created with the desired options. 

I've looked through all the configuration settings I can find, but can't find one that controls either issue.  How do I get Visual Studio to build my table creation scripts into a single deployment script, without flagging existence checks as errors and without trying to create the database? 


MSBuild error BC30002: Type 'Windows.Forms.DataGridViewTextBoxColumn' is not defined.

$
0
0

Hello,

Our winforms custom control (Class Library) project using the DataGridView control & .NET Fx 4.5 will successfully build without error in the VS IDE, as well as via a command line script (automating devenv.exe); it also builds without error using the MSBuild.exe as long as the attempt to use MSBuild.exe is on a machine that has VS IDE installed. 

So, the following two command line scripts both work on developer-centric machines that have both VS & MSBuild installed:

"%VS120COMNTOOLS%..\IDE\devenv.exe" /rebuild Release C_MyControl.sln
"%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe" C_MyControl.sln /t:Rebuild /p:Configuration=Release;Platform=x86

However, on a tester's machine --where VS is not installed-- we use MSBuild to create the assemblies and so the first option above is not an applicable...we have to use the second command line script.  When I try the 2nd command line script from above on a tester's machine then I get the following build error messages:

error BC30002: Type 'Windows.Forms.DataGridViewTextBoxColumn' is not defined.
error BC30002: Type 'Windows.Forms.DataGridViewButtonColumn' is not defined.
error BC30002: Type 'Windows.Forms.DataGridViewCheckBoxColumn' is not defined.
error BC30002: Type 'Windows.Forms.DataGridViewComboBoxColumn' is not defined.

NOTE: the above errors only occur when using MSBuild on a machine that does not have Visual Studio already installed.

What can I do to resolve this?

Thanks in advance.

Build error: XC1043

$
0
0

Hi

We have a project that started giving following error

Error      12           Extension 'Microsoft.Activities.Build.Validation.ValidationBuildExtension' threw an exception of type 'System.Reflection.ReflectionTypeLoadException' :  'Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.'.                C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Xaml.targets       347         5                

Upon further investigation I gather following information in the output window

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Xaml.targets(347,5): error XC1043: Extension 'Microsoft.Activities.Build.Validation.ValidationBuildExtension' threw an exception of type 'System.Reflection.ReflectionTypeLoadException' :  'Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.'.
10>Done executing task "CompilationPass2Task" -- FAILED. (TaskId:138)
10>Done building target "XamlMarkupCompilePass2" in project "XYZXYZ.csproj" -- FAILED.: (TargetId:215)

I have narrowed down the troubling xaml to Service Contracts. If i exclude them from projects, they work fine.

However, the issue is harder to fix because the same code works on 2/6 machine and 4/6 machines end up with same error.

Looking forward to help

VisualStudio Version 12.0.4629.00 Update 5 / .NET Franework Version 4.6.01055

Regards


SSIS build using MSbuild

$
0
0

Hi i am build ssis package using msbuild 

take reference form https://www.simple-talk.com/sql/ssis/deployment-automation-for-sql-server-integration-services-ssis/?view=print 

msbuildfile is as bellow which is located where project is located 

<?xml version="1.0" encoding="Windows-1252"?>
<Project  xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
          DefaultTargets="SSISBuild">

  <UsingTask TaskName="DeploymentFileCompilerTask" AssemblyFile="C$(VS140COMNTOOLS)\IDE\PrivateAssemblies\Microsoft.SqlServer.IntegrationServices.Build.dll" />
  <Target Name="SSISBuild" Condition="'$(SSISProj)' != ''">
    <PropertyGroup>
      <SSISProjPath>..\$(SSISProj)\$(SSISProj).dtproj</SSISProjPath>
    </PropertyGroup>
    <Message Text="Building SSIS project: $(SSISProjPath) using the configuration: $(CONFIGURATION)........" />
    <DeploymentFileCompilerTask
      InputProject="$(SSISProjPath)"
      Configuration="$(CONFIGURATION)"
      ProtectionLevel="DontSaveSensitive">
    </DeploymentFileCompilerTask>
  </Target>
</Project>


i am getiing error while use



Code Analysis not working in Release mode

$
0
0

Hi,

I implemented code analysis in my project. 

There are two modes:

1.Debug

2. Release

Code violations are detected in debug mode but not in Release mode.

I checked the project property and found that "Debug info" for debug mode is "full"

but for release mode it was "pdb-only" so made change to full and it is able to detect the violations.

So my question is will it not work with pdb-only in release mode?

How to specify the configuration and target .NET Framework version for the Microsoft Build Engine?

$
0
0

I am trying to do a Release build using the .NET Framework 3.5 and the Build Engine. The Build Engine is trying to use .NET Framework 2.0 even after specifying 3.5. How do I specify the configuration and the target framework?

public bool Compile(string solutionName)
{
    if (!File.Exists(solutionName))
        throw new FileNotFoundException("File not found: " + solutionName);

    Engine engine = new Engine();
    engine.BinPath = @"C:\Windows\Microsoft.NET\Framework64\v3.5\msbuild.exe";
    engine.DefaultToolsVersion = "3.5";

    ConsoleLogger logger = new ConsoleLogger();
    engine.RegisterLogger(logger);

    bool result = engine.BuildProjectFile(solutionName);
    engine.UnregisterAllLoggers();

    return result;
}

Application Error

$
0
0

Dear Experts,

I am new to VC++ and started developing simple application using C++.  The code compile properly and when executing I am getting following error in both Debug and release mode. 

attached the screenshot of the error message.

Thanks and Regards,

Suresh


Thanks in Advance Suresh M
If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful"

"fatal error C1108: unable to find DLL: 'TLBREF.dll'" (Visual Studio 2010)

$
0
0

Hi,

compiling my c++ Project with msbuild from visual Studio 2010 on Windows 10 I got the error:

fatal error C1108: unable to find DLL: 'TLBREF.dll'

on one of my Computer. On a other one, same Windows and Visual Studio Version it works fine. I can not find any differences between the two machines. TLBREF.dll is available in all .Net Framework Folders.

Has anyone an idea what I may check?

Thanks,

Daniel


"Al.exe not found issue" while building 4.0 framework projects with resource files in msbuild

$
0
0

Hi All,

I am facing an issue with building an project with reference file through msbuild in command prompt. Here i have installed VS2017 RC build in my machine and it results in "al.exe could not be found" error.

Works fine when executing the projects in visual studio and only issue occurs through msbuild.

And also the issue didnt occur in some other machines with installed VS2010, VS2012, VS2013 and VS2013.

Issue occurs only when building projects with resource files through msbuild in a machine installed with only VS2017.

Regards,


Amal Raj U

Why is *.designer.vb and *.resx not being added dependent when adding as link in VS2015

$
0
0


I asked this question here also http://stackoverflow.com/questions/41386761/why-is-designer-vb-and-resx-not-being-added-dependent-when-adding-as-link-in

This is in my project when I add as a link a form into VS2015.

<Compile Include="..\..\..\..\..\ProductionLibs\ProductionLibs\FYIReports\frmFYIReport.designer.vb"><Link>NewFolder1\frmFYIReport.designer.vb</Link>   </Compile><Compile Include="..\..\..\..\..\ProductionLibs\ProductionLibs\FYIReports\frmFYIReport.vb">     <Link>NewFolder1\frmFYIReport.vb</Link>     <SubType>Form</SubType></Compile>
Same formed that was linked in VS2010.
<Compile Include="..\..\..\..\ProductionLibs\ProductionLibs\FYIReports\frmFYIReport.designer.vb">     <Link>FYIReporting\frmFYIReport.designer.vb</Link>     <DependentUpon>frmFYIReport.vb</DependentUpon></Compile><Compile Include="..\..\..\..\ProductionLibs\ProductionLibs\FYIReports\frmFYIReport.vb">     <Link>FYIReporting\frmFYIReport.vb</Link>     <SubType>Form</SubType></Compile>


Notice the missing `<DependentUpon>`.  
This [post](http://stackoverflow.com/questions/35961449/designer-cs-not-showing-in-solution) got me in the right area, my question is why is 2015 not working? This is happening on every form. I am use VB not C#. Although I am missing the `<DependentUpon>` attribute, we are not getting there the same way. If I open the 2010 project in 2015, all is good. Then if I remove the link and re-add it, I am broke. Not sure if I made a mistake, but when I tried to hack the project file and add the `<DependentUpon>`, it still did not work. I can repeat this over and over. I am seeing the same issue with the *.resx file.

FileLoadException on CI machine (SharpSvn, fixups, IAT)

$
0
0
I'm using Fody/StampSvn, but it's not working on my CI machine.
I had problems in the past with StampSvn not working on my local machine, so I had parked it. Now I got back to it and it "works on my machine". I had to clear the Nuget folders, run MSBuild Clear target, etc., but it now works. But I can't get it to work on my CI machine! Not even manually!
The exception I get on the CI machine and I don't get on the local machine:
Failed to load 'C:\Sources\product\Packages\StampSvn.Fody.0.7.8.0\SharpSvn.dll'. Going to swallow and continue to let other AssemblyResolve events to attempt to resolve. Exception:System.IO.FileLoadException: Die Datei oder Assembly "SharpSvn, Version=1.7013.2566.15257, Culture=neutral, PublicKeyToken=d729672594885a28"... Attempt to load an unverifiable executable with fixups (IAT with more than 2 sections or a TLS section.)
This is output from https://github.com/Fody/Fody/blob/d7cab908b4fb9cfac543895f356f81588727ac47/FodyIsolated/InnerWeaver.cs.
And it seems to be the main problem.
I tried to make everything the same on CI and local machine. Files, packages, etc. I ran MSBuild with /v:d and compared the output.
Ideas:
- The user is different. But I don't think that matters.
- The .NET Framework installed was different, but I installed 4.6.2 on CI machine, now they are the same.
- OS is the same.
- I tried with Fusion logging activated, but couldn't see anything useful. Any ideas what to look for?
- Again, the main difference is MSBuild. Locally, I have VS 2015 with SP3 (and I think I had issues BEFORE I installed VS SP3). This results in MSBuild coming up with 14.0.25420.1. My understanding is that this is the result of installing VS 2015 SP3. On the CI machine it says 14.0.23107.0. Having no better idea, I thought I'll try to bring the CI machine up to the newer version. So I copied over the newer MSBuild files. But still when I call MSBuild it says 14.0.23107.0!!!! Although the file definitely has the version 14.0.25420.1!!! I even replaced the files in the GAC, restarted the machine, ... No success!
Does anyone have any idea what to do?
Main goal is the get Fody/StampSvn working. Again, I think the FileLoadException, and I think MSBuild is the problem.
But ANY ideas are welcome!
Thanks,
Christoph

MS Build Task

$
0
0
I created a custom project type that I would like visual studio to be able to build. For this I need a custom build target file. I have tried to create a simple one but keep getting a generic error with no information on whats wrong with it.

I have followed this http://sedodream.com/2013/06/01/HijackingTheVisualStudioBuildProcess.aspx
and still have had no luck.

I looked into the Exec Task documented here
https://msdn.microsoft.com/en-us/library/x8zx72cd.aspx

All the target needs to do is to be able to build using one simple command line argument which is
java -Xmx1024m -jar apktool.jar b "project directory here" -o "output directory here"

I don't even need to check or processes any of the project items because the apktool.jar just takes the full directory and uses it.
If someone could possibly point me in the right direction of getting a simple targets file working I would greatly appreciate it.

FIPS issues in Windows, .NET, and Visual Studio

$
0
0

FIPS issues in Windows, .NET, and Visual Studio

(These are some issues and work-arounds I found while working with System.Security.Cryptography with FIPS enabled. Just wanted to pass them on to help anyone in a similar scenario.)

FIPS (Federal Information Processing Standard) is a standard defined by NIST (National Institute of Standards and Technology) that specifies the security requirements for cryptographic modules. The FIPS standards are often required when working with government data.

The following Microsoft articles provide some information on enabling/disabling the option and the affect it has.

  • System cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing" security setting effects in Windows XP and in later versions of Windows

    • Note that the "Managed" version of the System.Security.Cryptography classes will error with FIPS:

      "Microsoft .NET Framework applications such as Microsoft ASP.NET only allow for using algorithm implementations that are certified by NIST to be FIPS 140 compliant. Specifically, the only cryptographic algorithm classes that can be instantiated are those that implement FIPS-compliant algorithms. The names of these classes end in "CryptoServiceProvider" or "Cng." Any attempt to create an instance of other cryptographic algorithm classes, such as classes with names ending in "Managed," cause an InvalidOperationException exception to occur. Additionally, any attempt to create an instance of a cryptographic algorithm that is not FIPS compliant, such as MD5, also causes an InvalidOperationException exception."
  • Why We’re Not Recommending “FIPS Mode” Anymore (read: "by default")
    Microsoft has decided not to enable FIPS by default…"we’re not telling customers to turn it off – our recommendation is that it’s each customer’s decision to make."
    This is likely due to the complications and problems it can cause for individuals and corporations who do not need to comply with governmental regulations for data processing.

Enabling/Disabling FIPS in Windows

Use the Group Policy Editor (gpedit.msc), set the following option to "Enabled".

This will set the "Enabled" REG_DWORD value to 1 under the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy


Example and Resolving Issues with Visual Studio's Code Analysis

As stated above, the "Managed" cryptography classes are not FIPS compliant. For example, simply attempting to call the constructor for a SHA512Managed class will error:

Dim nonFIPSCompliantHasherAsNew System.Security.Cryptography.SHA512Managed()

Instead, use one of the following:

               Dim cngHasherAsNew System.Security.Cryptography.SHA512Cng()

      Dim svcHasherAsNew System.Security.Cryptography.SHA512CryptoServiceProvider()

In some cases, such as RijndaelManaged, there may not be a valid implementation. This may require selection of a FIPS compliant alternative.

Note that the Microsoft Code Analysis functionality itself is not FIPS compliant. So, when enabling FIPS for testing in a development environment, you may receive compilation errors relating to this.

While it may take some trial and error, the work-around is to locate the related MSBuild.exe.config and disable the FIPS compliancy for it. For example, Visual Studio 2015 appears to use the following:

C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe.config

Edit this file and in the <runtime> section, add/set the enforceFIPSPolicy option to false.

<configuration>                                                          
    <runtime>
        <!-- below tag will disable security policy checking for FIPS -->
        <enforceFIPSPolicy enabled="false"/>
    </runtime>
</configuration>

This same option can be used to disable FIPS enforcement in your application's app.config file. However, it's preferable to actually address your application's cryptography shortcomings rather than bypassing them.

Viewing all 2763 articles
Browse latest View live


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