I have created a class Library, which has some static classes with const strings, which are serving some common strings* for the assembly attributes:
//Assembly: Conwell.Manifest
namespace Conwell.Manifest.AssemblyInfos
{
public static class AdministrationAssemblyInfo
{
public const string Company = "Foo";
public const string Trademark = "Bar";
public const string Copyright = "Baz";
public const string AssemblyVersion = "1.0.*";
public const string ProductName = "Administration";
}
}
In my MVC Project I have this AssemblyInfo:
//Assembly: Conwell.Administration Properties:AssemblyInfo.cs
using System.Reflection;
using System.Runtime.InteropServices;
using Conwell.Manifest.AssemblyInfos;
// CLR Attributes
[assembly: ComVisible(false)]
[assembly: Guid("16abe67b-6992-4a20-83bb-decad83600f0")]
[assembly: AssemblyVersion(AdministrationAssemblyInfo.AssemblyVersion)]
[assembly: AssemblyCulture("")]
[assembly: AssemblyConfiguration("")]
// Informational Attributes
[assembly: AssemblyCompany(AdministrationAssemblyInfo.Company)]
[assembly: AssemblyCopyright(AdministrationAssemblyInfo.Copyright)]
[assembly: AssemblyTitle(AdministrationAssemblyInfo.ProductName)]
[assembly: AssemblyDescription(AdministrationAssemblyInfo.ProductName)]
[assembly: AssemblyProduct(AdministrationAssemblyInfo.ProductName)]
[assembly: AssemblyTrademark(AdministrationAssemblyInfo.Trademark)]
This compiles fine in Debug and Release Mode.
I just tried to publish the whole project, and encountered an error I do not realy unterstand:
The type or namespace name 'Conwell' could not be found (are you missing a using directive or an assembly reference?)
The tmp file contains this:
18.03.2018 23:59:18
System.AggregateException: One or more errors occurred. ---> System.Exception: Publish failed due to build errors. Check the error list for more details.
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Web.Publish.PublishService.VsWebProjectPublish.<>c__DisplayClass40_0.<PublishAsync>b__2()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.ApplicationCapabilities.Publish.ViewModel.ProfileSelectorViewModel.<RunPublishTaskAsync>d__108.MoveNext()
---> (Inner Exception #0) System.Exception: Publish failed due to build errors. Check the error list for more details.<---
===================
The output is this:
13>------ Publish started: Project: Conwell.Administration, Configuration: Release Any CPU ------
13>Connecting to D:\IIS\Test...
13>Transformed Web.config using D:\Dev\Conwell\OnlineSystem\Dev\Conwell.Administration\Web.Release.config into obj\Release\TransformWebConfig\transformed\Web.config.
13>Copying all files to temporary location below for package/publish:
13>obj\Release\AspnetCompileMerge\Source.
13>C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v / -p D:\Dev\Conwell\OnlineSystem\Dev\Conwell.Administration\obj\Release\AspnetCompileMerge\Source -c D:\Dev\Conwell\OnlineSystem\Dev\Conwell.Administration\obj\Release\AspnetCompileMerge\TempBuildDir
13>d:\Dev\Conwell\OnlineSystem\Dev\Conwell.Administration\obj\Release\AspnetCompileMerge\Source\Areas\Global\Views\Help\Info.cshtml(15,0): Warning CS0618: 'Conwell.Administration.Core.Service.ConfigurationService' ist veraltet: 'Methoden in SystemSettings Service implementieren!'
13>d:\Dev\Conwell\OnlineSystem\Dev\Conwell.Administration\obj\Release\AspnetCompileMerge\Source\Views\Shared\Layout.cshtml(34,0): Warning CS0618: 'Conwell.Administration.Core.Service.ConfigurationService' ist veraltet: 'Methoden in SystemSettings Service implementieren!'
13>d:\Dev\Conwell\OnlineSystem\Dev\Conwell.Administration\obj\Release\AspnetCompileMerge\Source\Views\Shared\LayoutPublic.cshtml(45,0): Warning CS0618: 'Conwell.Administration.Core.Service.ConfigurationService' ist veraltet: 'Methoden in SystemSettings Service implementieren!'
13>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Roslyn\csc.exe /out:obj\Release\AssemblyInfo\AssemblyInfo.dll /target:library Properties\AssemblyInfo.cs
13>Properties\AssemblyInfo.cs(8,28): Error CS0103: The name 'AdministrationAssemblyInfo' does not exist in the current context
13>Properties\AssemblyInfo.cs(13,28): Error CS0103: The name 'AdministrationAssemblyInfo' does not exist in the current context
13>Properties\AssemblyInfo.cs(14,30): Error CS0103: The name 'AdministrationAssemblyInfo' does not exist in the current context
13>Properties\AssemblyInfo.cs(15,26): Error CS0103: The name 'AdministrationAssemblyInfo' does not exist in the current context
13>Properties\AssemblyInfo.cs(16,32): Error CS0103: The name 'AdministrationAssemblyInfo' does not exist in the current context
13>Properties\AssemblyInfo.cs(17,28): Error CS0103: The name 'AdministrationAssemblyInfo' does not exist in the current context
13>Properties\AssemblyInfo.cs(18,30): Error CS0103: The name 'AdministrationAssemblyInfo' does not exist in the current context
13>Properties\AssemblyInfo.cs(3,7): Error CS0246: The type or namespace name 'Conwell' could not be found (are you missing a using directive or an assembly reference?)
The warnings are basicly some custom ones, using ObsoleteAttribute
.
Has this something todo with enabled precompilation?
What I have tried so far:
- Creating a static method in my AdministrationAssemblyInfo, calling
Console.WriteLine
. This method I have called fromglobal.asax
in order to preclude any optimization, since all the library contains areconst
. - Clean Solution
- Restart PC
I have absolute no clue, what is causing the issue.
* my main motivation is to have a single location for changing the version, since I use a lot of class libraries