AsemblyInfo with path that has a space

May 26, 2011 at 7:14 AM

Hi, I have the following code below that updates the AssemblyInfo.cs file of a project. It works on projects without spaces in the path. But as soon as I put a directory with a space it does not work.

I am using msbuild .net 4 and Extension pack 4.

 

I tried a few things like putting %20 where the space is but nothing is working so far. Is there anyway around this? Thanks

 

<CreateItem Include="$(Pathwithspace)">

<Output ItemName="AssemblyInfo" TaskParameter="Include"/>       

</CreateItem>

<AssemblyInfo AssemblyInfoFiles="@(AssemblyInfo)"

  AssemblyDescription="$([System.DateTime]::Now)" >

</AssemblyInfo>

Coordinator
May 26, 2011 at 8:33 AM

It shoudl work fine. I cant repro the issue.

 

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Import Project="$(MSBuildExtensionsPath)\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks"/>
    <Target Name="Default">
        <ItemGroup>
            <AssemblyInfo Include="C:\a space\ExtraAssemblyInfo.cs"/>
        </ItemGroup>
        <AssemblyInfo AssemblyInfoFiles="@(AssemblyInfo)" AssemblyDescription="$([System.DateTime]::Now)"/>
    </Target>
</Project>

works as expected for me

May 26, 2011 at 9:12 AM

I have multiple machines and just checked it on my win 2003 server machine and it worked fine. However, it is not working on my win 2008 machine. Notice it is complaining about a D: drive when my computers D: drive is a DVD drive.  I guess I will try and see if I can find any sort of setup difference between the two machines. 

Thanks

c:\projects space\build.xml(7,9): error MSB4018: "AssemblyInfo" task failed unexpectedly

.\r
c:\projects space\build.xml(7,9): error MSB4018: System.FormatException: 
Input string was not in a correct format. \r
c:\projects space\build.xml(7,9): error MSB4018:    Location System.Version.VersionR
e
sult.SetFailure(ParseFailureKind failure, String argument)\r
c:\projects space\build.xml(7,9): error MSB4018:    Location System.Version.TryParse
C
omponent(String component, String componentName, VersionResult& result, Int32&
parsedComponent)\r
c:\projects space\build.xml(7,9): error MSB4018:    Location System.Version.TryParse
V
ersion(String version, VersionResult& result)\r
c:\projects space\build.xml(7,9): error MSB4018:    Location System.Version.Parse(St
r
ing input)\r
c:\projects space\build.xml(7,9): error MSB4018:    Location System.Version..ctor(St
r
ing version)\r
c:\projects space\build.xml(7,9): error MSB4018:    Location MSBuild.ExtensionPack.F
r
amework.AssemblyInfo.UpdateMaxVersion(String& maxVersion, String newVersion) location

 D:\Projects\MSBuildExtensionPack\Releases\3.5.9.0\Main3.5\Framework\Framework\
AssemblyInfo\AssemblyInfo.cs: line 1138\r
c:\projects space\build.xml(7,9): error MSB4018:    Location MSBuild.ExtensionPack.F
r
amework.AssemblyInfo.Execute() Location D:\Projects\MSBuildExtensionPack\Releases\3.
5
.9.0\Main3.5\Framework\Framework\AssemblyInfo\AssemblyInfo.cs: line 1022\r
c:\projects space\build.xml(7,9): error MSB4018:    Location Microsoft.Build.BackEnd
.
TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()\r
c:\projects space\build.xml(7,9): error MSB4018:    Location Microsoft.Build.BackEnd
.
TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskL
oggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExe
cutionMode howToExecuteTask, Boolean& taskResult)