loresoft / msbuildtasks

The MSBuild Community Tasks Project is an open source project for MSBuild tasks.
BSD 2-Clause "Simplified" License
946 stars 271 forks source link

Cannot create AssemblyInfo for CodeLanguage="CPP" #233

Open KerstinKeller opened 8 years ago

KerstinKeller commented 8 years ago

I have installed msbuildtasks for Visual Studio 2015 and want to create the AssemblyInfo.cpp file for my C++/CLI project.

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Target Name="Version">
    <AssemblyInfo
        CodeLanguage="CPP"
        OutputFile="..\src\AssemblyInfo.cpp"
        AssemblyTitle="project"
        AssemblyDescription="project"
        AssemblyCompany="project"
        AssemblyProduct="project"
        AssemblyCopyright="Copyright"
        ComVisible="false"
        CLSCompliant="true"
        AssemblyInformationalVersion="v1.0.0"
        AssemblyVersion="1.0.0"
       AssemblyFileVersion="1.0.0" />
  </Target> 
</Project>

However, when running the task I get the output:

1>D:\xxx.targets(4,5): error : The C++/CLI code provider wasn't found. Make sure you have Visual C++ installed. 1>D:\xxx.targets(4,5): error MSB4018: The "AssemblyInfo" task failed unexpectedly. 1>D:\xxx..targets(4,5): error MSB4018: System.NullReferenceException: Object reference not set to an instance of an object. 1>D:\xxx.targets(4,5): error MSB4018: at MSBuild.Community.Tasks.AssemblyInfo.GenerateFile(TextWriter writer) 1>D:\xxx..targets(4,5): error MSB4018: at MSBuild.Community.Tasks.AssemblyInfo.Execute() 1>D:\xxx..targets(4,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() 1>D:\xxx..targets(4,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()

I have added CppCodeProvider to my projects references, however, that has not helped. From the sources (https://github.com/loresoft/msbuildtasks/blob/master/Source/MSBuild.Community.Tasks/AssemblyInfo.cs) it seems that AssemblyInfo task is looking for CppCodeProvider '8.0.0.0', however for the project references I can only pick version '10.0.0.0'

What is the proper way to include the CppCodeProvider or is this a bug?

ybeapps commented 6 years ago

I have the same problem... take a look at this: private const string CppCodeProviderAssembly = "CppCodeProvider, "+ "Version=8.0.0.0, " + "Culture=neutral, " + "PublicKeyToken=b03f5f7f11d50a3a, " + "processorArchitecture=MSIL";

Eruvisu commented 3 years ago

I also have this problem. Can we get an update about the pull request that has been created by @jmairboeck?