Closed icnocop closed 11 months ago
I was able to resolve those compiler errors by doing the following
<Project Sdk="MSBuild.Sdk.Extras/3.0.44">
to <Project Sdk="Microsoft.NET.Sdk">
<OutputPath>bin</OutputPath>
within <PropertyGroup></PropertyGroup>
<Import Project="$(MSBuildProgramFiles32)\MSBuild\Microsoft\Silverlight\v5.0\Microsoft.Silverlight.CSharp.targets" />
However, I get the following warning message:
C:\Program Files\dotnet\sdk\7.0.401\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.targets(37,3): warning MSB4011: "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.CSharp.targets" cannot be imported again. It was already imported at "C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v5.0\Microsoft.Silverlight.CSharp.targets (20,5)". This is most likely a build authoring error. This subsequent import will be ignored. [E:\github\icnocop\MSBuildSdkExtras\Tests\SilverlightApplicationExtras\SilverlightApplicationExtras.csproj]
Is there a way to resolve the warning message?
Thank you.
I was able to resolve it using the following:
<Project Sdk="MSBuild.Sdk.Extras/3.0.44">
<PropertyGroup>
<TargetFrameworks>sl5</TargetFrameworks>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SilverlightApplicationExtras</RootNamespace>
<AssemblyName>SilverlightApplicationExtras</AssemblyName>
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<SilverlightApplication>true</SilverlightApplication>
<SupportedCultures>
</SupportedCultures>
<XapOutputs>true</XapOutputs>
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
<XapFilename>SilverlightApplicationExtras.xap</XapFilename>
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
<SilverlightAppEntry>SilverlightApplicationExtras.App</SilverlightAppEntry>
<TestPageFileName>SilverlightApplicationExtrasTestPage.html</TestPageFileName>
<CreateTestPage>true</CreateTestPage>
<ValidateXaml>true</ValidateXaml>
<EnableOutOfBrowser>false</EnableOutOfBrowser>
<OutOfBrowserSettingsFile>Properties\OutOfBrowserSettings.xml</OutOfBrowserSettingsFile>
<UsePlatformExtensions>false</UsePlatformExtensions>
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
<LinkedServerProject>
</LinkedServerProject>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWpf>true</UseWpf>
<ImportFrameworkWinFXTargets>true</ImportFrameworkWinFXTargets>
<OutputPath>bin</OutputPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Windows" />
<Reference Include="system" />
<Reference Include="System.Core" />
<Reference Include="System.Net" />
<Reference Include="System.Xml" />
<Reference Include="System.Windows.Browser" />
<Reference Include="System.Windows.Controls" />
<Reference Include="System.Windows.Controls.Navigation" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\AppManifest.xml" />
</ItemGroup>
<ItemGroup>
<Page Include="**\*.xaml" SubType="Designer" Generator="MSBuild:Compile" />
</ItemGroup>
<Target Name="BeforeMarkupCompilePass1" BeforeTargets="MarkupCompilePass1">
<ItemGroup>
<Page Include="**\*.xaml" Exclude="App.xaml;**\bin\**\*.xaml;**\obj\**\*.xaml" SubType="Designer" Generator="MSBuild:Compile" />
</ItemGroup>
</Target>
<Target Name="BeforeMainResourcesGeneration" BeforeTargets="MainResourcesGeneration">
<RemoveDuplicates Inputs="@(MainEmbeddedFiles)">
<Output
TaskParameter="Filtered"
ItemName="UniqueMainEmbeddedFiles"/>
</RemoveDuplicates>
<ItemGroup>
<MainEmbeddedFiles Remove="@(MainEmbeddedFiles)" />
<MainEmbeddedFiles Include="@(UniqueMainEmbeddedFiles)" />
</ItemGroup>
</Target>
</Project>
Hi.
Thank you for
MSBuild.Sdk.Extras
.I'm trying to migrate an old style project to the new SDK-style project using MSBuild.Sdk.Extras.
The project has XAML pages.
I'm getting errors like
CS0103: The name 'InitializeComponent' does not exist in the current context
.Here's a fork of this repo with the test project added: https://github.com/icnocop/MSBuildSdkExtras
It requires https://marketplace.visualstudio.com/items?itemName=RamiAbughazaleh.SilverlightProjectSystem2022 to successfully build the
SilverlightApplication
project, which does not useMSBuild.Sdk.Extras
.The
SilverlightApplicationExtras
project was created which usesMSBuild.Sdk.Extras
and this project has errors when trying to build.The projects pretty much have the same code except for the differences in the csproj file.
Any ideas?
Thank you.